Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: lib/compiler/implementation/universe.dart

Issue 10363003: Compute function types together with the parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move computation of function type. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/ssa/optimize.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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<SourceString> instantiatedClassInstanceFields; 9 final Set<SourceString> instantiatedClassInstanceFields;
10 final Set<FunctionElement> staticFunctionsNeedingGetter; 10 final Set<FunctionElement> staticFunctionsNeedingGetter;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return kind === SelectorKind.GETTER || kind === SelectorKind.INVOCATION; 132 return kind === SelectorKind.GETTER || kind === SelectorKind.INVOCATION;
133 } 133 }
134 if (element.isField()) { 134 if (element.isField()) {
135 return kind === SelectorKind.GETTER 135 return kind === SelectorKind.GETTER
136 || kind === SelectorKind.INVOCATION 136 || kind === SelectorKind.INVOCATION
137 || kind === SelectorKind.SETTER; 137 || kind === SelectorKind.SETTER;
138 } 138 }
139 if (kind === SelectorKind.GETTER) return true; 139 if (kind === SelectorKind.GETTER) return true;
140 140
141 FunctionElement function = element; 141 FunctionElement function = element;
142 FunctionParameters parameters = function.computeParameters(compiler); 142 FunctionSignature parameters = function.computeSignature(compiler);
143 if (argumentCount > parameters.parameterCount) return false; 143 if (argumentCount > parameters.parameterCount) return false;
144 int requiredParameterCount = parameters.requiredParameterCount; 144 int requiredParameterCount = parameters.requiredParameterCount;
145 int optionalParameterCount = parameters.optionalParameterCount; 145 int optionalParameterCount = parameters.optionalParameterCount;
146 if (positionalArgumentCount < requiredParameterCount) return false; 146 if (positionalArgumentCount < requiredParameterCount) return false;
147 147
148 bool hasOptionalParameters = !parameters.optionalParameters.isEmpty(); 148 bool hasOptionalParameters = !parameters.optionalParameters.isEmpty();
149 if (namedArguments.isEmpty()) { 149 if (namedArguments.isEmpty()) {
150 if (!hasOptionalParameters) { 150 if (!hasOptionalParameters) {
151 return requiredParameterCount == argumentCount; 151 return requiredParameterCount == argumentCount;
152 } else { 152 } else {
(...skipping 30 matching lines...) Expand all
183 bool addArgumentsToList(Link<Node> arguments, 183 bool addArgumentsToList(Link<Node> arguments,
184 List list, 184 List list,
185 FunctionElement element, 185 FunctionElement element,
186 compileArgument(Node argument), 186 compileArgument(Node argument),
187 compileConstant(Element element), 187 compileConstant(Element element),
188 Compiler compiler) { 188 Compiler compiler) {
189 if (!this.applies(element, compiler)) return false; 189 if (!this.applies(element, compiler)) return false;
190 190
191 void addMatchingArgumentsToList(Link<Node> link) {} 191 void addMatchingArgumentsToList(Link<Node> link) {}
192 192
193 FunctionParameters parameters = element.computeParameters(compiler); 193 FunctionSignature parameters = element.computeSignature(compiler);
194 if (this.positionalArgumentCount == parameters.parameterCount) { 194 if (this.positionalArgumentCount == parameters.parameterCount) {
195 for (Link<Node> link = arguments; !link.isEmpty(); link = link.tail) { 195 for (Link<Node> link = arguments; !link.isEmpty(); link = link.tail) {
196 list.add(compileArgument(link.head)); 196 list.add(compileArgument(link.head));
197 } 197 }
198 return true; 198 return true;
199 } 199 }
200 200
201 // If there are named arguments, provide them in the order 201 // If there are named arguments, provide them in the order
202 // expected by the called function, which is the source order. 202 // expected by the called function, which is the source order.
203 203
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 return false; 338 return false;
339 } 339 }
340 340
341 bool operator ==(other) { 341 bool operator ==(other) {
342 if (other is !TypedSelector) return false; 342 if (other is !TypedSelector) return false;
343 if (other.receiverType !== receiverType) return false; 343 if (other.receiverType !== receiverType) return false;
344 return super == other; 344 return super == other;
345 } 345 }
346 } 346 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/optimize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698