OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class Universe { | 5 class Universe { |
6 Map<Element, CodeBuffer> generatedCode; | 6 Map<Element, CodeBuffer> generatedCode; |
7 Map<Element, CodeBuffer> generatedBailoutCode; | 7 Map<Element, CodeBuffer> generatedBailoutCode; |
8 final Set<ClassElement> instantiatedClasses; | 8 final Set<ClassElement> instantiatedClasses; |
9 final Set<FunctionElement> staticFunctionsNeedingGetter; | 9 final Set<FunctionElement> staticFunctionsNeedingGetter; |
10 final Map<SourceString, Set<Selector>> invokedNames; | 10 final Map<SourceString, Set<Selector>> invokedNames; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bool isSetter() => kind === SelectorKind.SETTER; | 164 bool isSetter() => kind === SelectorKind.SETTER; |
165 bool isCall() => kind === SelectorKind.CALL; | 165 bool isCall() => kind === SelectorKind.CALL; |
166 | 166 |
167 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1; | 167 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1; |
168 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2; | 168 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2; |
169 | 169 |
170 bool isOperator() => kind === SelectorKind.OPERATOR; | 170 bool isOperator() => kind === SelectorKind.OPERATOR; |
171 bool isUnaryOperator() => isOperator() && argumentCount == 0; | 171 bool isUnaryOperator() => isOperator() && argumentCount == 0; |
172 bool isBinaryOperator() => isOperator() && argumentCount == 1; | 172 bool isBinaryOperator() => isOperator() && argumentCount == 1; |
173 | 173 |
| 174 /** Check whether this is a call to 'assert' with one positional parameter. */ |
| 175 bool isAssertSyntax() { |
| 176 return (isCall() && |
| 177 name.stringValue === "assert" && |
| 178 argumentCount == 1 && |
| 179 namedArgumentCount == 0); |
| 180 } |
| 181 |
174 int hashCode() => argumentCount + 1000 * namedArguments.length; | 182 int hashCode() => argumentCount + 1000 * namedArguments.length; |
175 int get namedArgumentCount => namedArguments.length; | 183 int get namedArgumentCount => namedArguments.length; |
176 int get positionalArgumentCount => argumentCount - namedArgumentCount; | 184 int get positionalArgumentCount => argumentCount - namedArgumentCount; |
177 DartType get receiverType => null; | 185 DartType get receiverType => null; |
178 | 186 |
179 bool applies(Element element, Compiler compiler) | 187 bool applies(Element element, Compiler compiler) |
180 => appliesUntyped(element, compiler); | 188 => appliesUntyped(element, compiler); |
181 | 189 |
182 bool appliesUntyped(Element element, Compiler compiler) { | 190 bool appliesUntyped(Element element, Compiler compiler) { |
183 if (element.isSetter()) return isSetter(); | 191 if (element.isSetter()) return isSetter(); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 414 |
407 if (!self.isInterface() && self.isSubclassOf(other)) { | 415 if (!self.isInterface() && self.isSubclassOf(other)) { |
408 // Resolve an invocation of [element.name] on [self]. If it | 416 // Resolve an invocation of [element.name] on [self]. If it |
409 // is found, this selector is a candidate. | 417 // is found, this selector is a candidate. |
410 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 418 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
411 } | 419 } |
412 | 420 |
413 return false; | 421 return false; |
414 } | 422 } |
415 } | 423 } |
OLD | NEW |