| 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<SourceString> instantiatedClassInstanceFields; | 9 final Set<SourceString> instantiatedClassInstanceFields; |
| 10 final Set<FunctionElement> staticFunctionsNeedingGetter; | 10 final Set<FunctionElement> staticFunctionsNeedingGetter; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 Selector.getter(SourceString name, LibraryElement library) | 110 Selector.getter(SourceString name, LibraryElement library) |
| 111 : this(SelectorKind.GETTER, name, library, 0); | 111 : this(SelectorKind.GETTER, name, library, 0); |
| 112 | 112 |
| 113 Selector.getterFrom(Selector selector) | 113 Selector.getterFrom(Selector selector) |
| 114 : this(SelectorKind.GETTER, selector.name, selector.library, 0); | 114 : this(SelectorKind.GETTER, selector.name, selector.library, 0); |
| 115 | 115 |
| 116 Selector.setter(SourceString name, LibraryElement library) | 116 Selector.setter(SourceString name, LibraryElement library) |
| 117 : this(SelectorKind.SETTER, name, library, 1); | 117 : this(SelectorKind.SETTER, name, library, 1); |
| 118 | 118 |
| 119 Selector.unaryOperator(SourceString name) | 119 Selector.unaryOperator(SourceString name) |
| 120 : this(SelectorKind.OPERATOR, operatorName(name, true), null, 0); | 120 : this(SelectorKind.OPERATOR, |
| 121 Elements.constructOperatorName(name, true), |
| 122 null, 0); |
| 121 | 123 |
| 122 Selector.binaryOperator(SourceString name) | 124 Selector.binaryOperator(SourceString name) |
| 123 : this(SelectorKind.OPERATOR, operatorName(name, false), null, 1); | 125 : this(SelectorKind.OPERATOR, |
| 126 Elements.constructOperatorName(name, false), |
| 127 null, 1); |
| 124 | 128 |
| 125 Selector.index() | 129 Selector.index() |
| 126 : this(SelectorKind.INDEX, indexName(), null, 1); | 130 : this(SelectorKind.INDEX, |
| 131 Elements.constructOperatorName(const SourceString("[]"), false), |
| 132 null, 1); |
| 127 | 133 |
| 128 Selector.indexSet() | 134 Selector.indexSet() |
| 129 : this(SelectorKind.INDEX, indexSetName(), null, 2); | 135 : this(SelectorKind.INDEX, |
| 136 Elements.constructOperatorName(const SourceString("[]="), false), |
| 137 null, 2); |
| 130 | 138 |
| 131 Selector.call(SourceString name, | 139 Selector.call(SourceString name, |
| 132 LibraryElement library, | 140 LibraryElement library, |
| 133 int arity, | 141 int arity, |
| 134 [List<SourceString> named = const []]) | 142 [List<SourceString> named = const []]) |
| 135 : this(SelectorKind.CALL, name, library, arity, named); | 143 : this(SelectorKind.CALL, name, library, arity, named); |
| 136 | 144 |
| 137 Selector.callClosure(int arity, [List<SourceString> named = const []]) | 145 Selector.callClosure(int arity, [List<SourceString> named = const []]) |
| 138 : this(SelectorKind.CALL, Namer.CLOSURE_INVOCATION_NAME, null, | 146 : this(SelectorKind.CALL, Namer.CLOSURE_INVOCATION_NAME, null, |
| 139 arity, named); | 147 arity, named); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 150 bool isSetter() => kind === SelectorKind.SETTER; | 158 bool isSetter() => kind === SelectorKind.SETTER; |
| 151 bool isCall() => kind === SelectorKind.CALL; | 159 bool isCall() => kind === SelectorKind.CALL; |
| 152 | 160 |
| 153 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1; | 161 bool isIndex() => kind === SelectorKind.INDEX && argumentCount == 1; |
| 154 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2; | 162 bool isIndexSet() => kind === SelectorKind.INDEX && argumentCount == 2; |
| 155 | 163 |
| 156 bool isOperator() => kind === SelectorKind.OPERATOR; | 164 bool isOperator() => kind === SelectorKind.OPERATOR; |
| 157 bool isUnaryOperator() => isOperator() && argumentCount == 0; | 165 bool isUnaryOperator() => isOperator() && argumentCount == 0; |
| 158 bool isBinaryOperator() => isOperator() && argumentCount == 1; | 166 bool isBinaryOperator() => isOperator() && argumentCount == 1; |
| 159 | 167 |
| 160 static SourceString operatorName(SourceString name, bool isUnary) | |
| 161 => Elements.constructOperatorName( | |
| 162 const SourceString('operator'), name, isUnary); | |
| 163 | |
| 164 static SourceString indexName() | |
| 165 => operatorName(const SourceString('[]'), false); | |
| 166 | |
| 167 static SourceString indexSetName() | |
| 168 => operatorName(const SourceString('[]='), false); | |
| 169 | |
| 170 int hashCode() => argumentCount + 1000 * namedArguments.length; | 168 int hashCode() => argumentCount + 1000 * namedArguments.length; |
| 171 int get namedArgumentCount => namedArguments.length; | 169 int get namedArgumentCount => namedArguments.length; |
| 172 int get positionalArgumentCount => argumentCount - namedArgumentCount; | 170 int get positionalArgumentCount => argumentCount - namedArgumentCount; |
| 173 Type get receiverType => null; | 171 Type get receiverType => null; |
| 174 | 172 |
| 175 bool applies(Element element, Compiler compiler) | 173 bool applies(Element element, Compiler compiler) |
| 176 => appliesUntyped(element, compiler); | 174 => appliesUntyped(element, compiler); |
| 177 | 175 |
| 178 bool appliesUntyped(Element element, Compiler compiler) { | 176 bool appliesUntyped(Element element, Compiler compiler) { |
| 179 if (element.isSetter()) return isSetter(); | 177 if (element.isSetter()) return isSetter(); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 387 } |
| 390 | 388 |
| 391 return false; | 389 return false; |
| 392 } | 390 } |
| 393 | 391 |
| 394 toString() { | 392 toString() { |
| 395 return 'Selector($kind, "${name.slowToString()}", ' | 393 return 'Selector($kind, "${name.slowToString()}", ' |
| 396 '$argumentCount, type=$receiverType)'; | 394 '$argumentCount, type=$receiverType)'; |
| 397 } | 395 } |
| 398 } | 396 } |
| OLD | NEW |