| 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, String> generatedCode; | 6 Map<Element, String> generatedCode; |
| 7 Map<Element, String> generatedBailoutCode; | 7 Map<Element, String> 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 static final Selector BINARY_OPERATOR = | 60 static final Selector BINARY_OPERATOR = |
| 61 const Selector(SelectorKind.OPERATOR, 1); | 61 const Selector(SelectorKind.OPERATOR, 1); |
| 62 static final Selector INDEX = const Selector(SelectorKind.INDEX, 1); | 62 static final Selector INDEX = const Selector(SelectorKind.INDEX, 1); |
| 63 static final Selector INDEX_SET = const Selector(SelectorKind.INDEX, 2); | 63 static final Selector INDEX_SET = const Selector(SelectorKind.INDEX, 2); |
| 64 static final Selector INDEX_AND_INDEX_SET = | 64 static final Selector INDEX_AND_INDEX_SET = |
| 65 const Selector(SelectorKind.INDEX, 2); | 65 const Selector(SelectorKind.INDEX, 2); |
| 66 static final Selector GETTER_AND_SETTER = | 66 static final Selector GETTER_AND_SETTER = |
| 67 const Selector(SelectorKind.SETTER, 1); | 67 const Selector(SelectorKind.SETTER, 1); |
| 68 static final Selector INVOCATION_0 = | 68 static final Selector INVOCATION_0 = |
| 69 const Selector(SelectorKind.INVOCATION, 0); | 69 const Selector(SelectorKind.INVOCATION, 0); |
| 70 static final Selector INVOCATION_1 = |
| 71 const Selector(SelectorKind.INVOCATION, 1); |
| 70 | 72 |
| 71 bool applies(Compiler compiler, FunctionElement element) { | 73 bool applies(Compiler compiler, FunctionElement element) { |
| 72 FunctionParameters parameters = element.computeParameters(compiler); | 74 FunctionParameters parameters = element.computeParameters(compiler); |
| 73 if (argumentCount > parameters.parameterCount) return false; | 75 if (argumentCount > parameters.parameterCount) return false; |
| 74 int requiredParameterCount = parameters.requiredParameterCount; | 76 int requiredParameterCount = parameters.requiredParameterCount; |
| 75 int optionalParameterCount = parameters.optionalParameterCount; | 77 int optionalParameterCount = parameters.optionalParameterCount; |
| 76 | 78 |
| 77 bool hasOptionalParameters = !parameters.optionalParameters.isEmpty(); | 79 bool hasOptionalParameters = !parameters.optionalParameters.isEmpty(); |
| 78 if (namedArguments.isEmpty()) { | 80 if (namedArguments.isEmpty()) { |
| 79 if (!hasOptionalParameters) { | 81 if (!hasOptionalParameters) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (!orderedNamedArguments.isEmpty()) return orderedNamedArguments; | 143 if (!orderedNamedArguments.isEmpty()) return orderedNamedArguments; |
| 142 | 144 |
| 143 List<SourceString> list = new List<SourceString>.from(namedArguments); | 145 List<SourceString> list = new List<SourceString>.from(namedArguments); |
| 144 list.sort((SourceString first, SourceString second) { | 146 list.sort((SourceString first, SourceString second) { |
| 145 return first.stringValue.compareTo(second.stringValue); | 147 return first.stringValue.compareTo(second.stringValue); |
| 146 }); | 148 }); |
| 147 orderedNamedArguments = list; | 149 orderedNamedArguments = list; |
| 148 return orderedNamedArguments; | 150 return orderedNamedArguments; |
| 149 } | 151 } |
| 150 } | 152 } |
| OLD | NEW |