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

Side by Side Diff: lib/compiler/implementation/compiler.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
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 WorkItem { 5 class WorkItem {
6 final Element element; 6 final Element element;
7 TreeElements resolutionTree; 7 TreeElements resolutionTree;
8 Function run; 8 Function run;
9 bool allowSpeculativeOptimization = true; 9 bool allowSpeculativeOptimization = true;
10 List<HTypeGuard> guards = const <HTypeGuard>[]; 10 List<HTypeGuard> guards = const <HTypeGuard>[];
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 mainApp = scanner.loadLibrary(uri, null); 285 mainApp = scanner.loadLibrary(uri, null);
286 final Element main = mainApp.find(MAIN); 286 final Element main = mainApp.find(MAIN);
287 if (main === null) { 287 if (main === null) {
288 withCurrentElement(mainApp, () => cancel('Could not find $MAIN')); 288 withCurrentElement(mainApp, () => cancel('Could not find $MAIN'));
289 } else { 289 } else {
290 withCurrentElement(main, () { 290 withCurrentElement(main, () {
291 if (!main.isFunction()) { 291 if (!main.isFunction()) {
292 cancel('main is not a function', element: main); 292 cancel('main is not a function', element: main);
293 } 293 }
294 FunctionElement mainMethod = main; 294 FunctionElement mainMethod = main;
295 FunctionParameters parameters = mainMethod.computeParameters(this); 295 FunctionSignature parameters = mainMethod.computeSignature(this);
296 if (parameters.parameterCount > 0) { 296 if (parameters.parameterCount > 0) {
297 cancel('main cannot have parameters', element: mainMethod); 297 cancel('main cannot have parameters', element: mainMethod);
298 } 298 }
299 }); 299 });
300 } 300 }
301 native.processNativeClasses(this, universe.libraries.getValues()); 301 native.processNativeClasses(this, universe.libraries.getValues());
302 enqueue(new WorkItem.toCompile(main)); 302 enqueue(new WorkItem.toCompile(main));
303 codegenProgress.reset(); 303 codegenProgress.reset();
304 while (!worklist.isEmpty()) { 304 while (!worklist.isEmpty()) {
305 WorkItem work = worklist.removeLast(); 305 WorkItem work = worklist.removeLast();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 414
415 void resolveClass(ClassElement element) { 415 void resolveClass(ClassElement element) {
416 withCurrentElement(element, () => resolver.resolveClass(element)); 416 withCurrentElement(element, () => resolver.resolveClass(element));
417 } 417 }
418 418
419 Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) { 419 Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) {
420 return resolver.resolveTypeAnnotation(element, annotation); 420 return resolver.resolveTypeAnnotation(element, annotation);
421 } 421 }
422 422
423 FunctionParameters resolveSignature(FunctionElement element) { 423 FunctionSignature resolveSignature(FunctionElement element) {
424 return withCurrentElement(element, 424 return withCurrentElement(element,
425 () => resolver.resolveSignature(element)); 425 () => resolver.resolveSignature(element));
426 } 426 }
427 427
428 Constant compileVariable(VariableElement element) { 428 Constant compileVariable(VariableElement element) {
429 return withCurrentElement(element, () { 429 return withCurrentElement(element, () {
430 return constantHandler.compileVariable(element); 430 return constantHandler.compileVariable(element);
431 }); 431 });
432 } 432 }
433 433
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 567 }
568 } 568 }
569 569
570 class SourceSpan { 570 class SourceSpan {
571 final Uri uri; 571 final Uri uri;
572 final int begin; 572 final int begin;
573 final int end; 573 final int end;
574 574
575 const SourceSpan(this.uri, this.begin, this.end); 575 const SourceSpan(this.uri, this.begin, this.end);
576 } 576 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | lib/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698