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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart

Issue 12211112: Start work on a non-complete type inferrer. Currently only analyzes return types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 part of dart_backend; 5 part of dart_backend;
6 6
7 // TODO(ahe): This class is simply wrong. This backend should use 7 // TODO(ahe): This class is simply wrong. This backend should use
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, 8 // elements when it can, not AST nodes. Perhaps a [Map<Element,
9 // TreeElements>] is what is needed. 9 // TreeElements>] is what is needed.
10 class ElementAst { 10 class ElementAst {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 if (element.isMember()) { 354 if (element.isMember()) {
355 ClassElement enclosingClass = element.getEnclosingClass(); 355 ClassElement enclosingClass = element.getEnclosingClass();
356 assert(enclosingClass.isClass()); 356 assert(enclosingClass.isClass());
357 assert(enclosingClass.isTopLevel()); 357 assert(enclosingClass.isTopLevel());
358 assert(shouldOutput(enclosingClass)); 358 assert(shouldOutput(enclosingClass));
359 addClass(enclosingClass); 359 addClass(enclosingClass);
360 classMembers[enclosingClass].add(element); 360 classMembers[enclosingClass].add(element);
361 processElement(element, elementAst); 361 processElement(element, elementAst);
362 } else { 362 } else {
363 if (!element.isTopLevel()) { 363 if (element.enclosingElement.isFunction()) {
364 // Closure, nothing to do.
365 } else if (!element.isTopLevel()) {
364 compiler.cancel('Cannot process $element', element: element); 366 compiler.cancel('Cannot process $element', element: element);
367 } else {
368 addTopLevel(element, elementAst);
365 } 369 }
366 addTopLevel(element, elementAst);
367 } 370 }
368 }); 371 });
369 372
370 // Add synthesized constructors to classes with no resolved constructors, 373 // Add synthesized constructors to classes with no resolved constructors,
371 // but which originally had any constructor. That should prevent 374 // but which originally had any constructor. That should prevent
372 // those classes from being instantiable with default constructor. 375 // those classes from being instantiable with default constructor.
373 Identifier synthesizedIdentifier = 376 Identifier synthesizedIdentifier =
374 new Identifier(new StringToken(IDENTIFIER_INFO, '', -1)); 377 new Identifier(new StringToken(IDENTIFIER_INFO, '', -1));
375 378
376 NextClassElement: 379 NextClassElement:
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 } 587 }
585 588
586 compareElements(e0, e1) { 589 compareElements(e0, e1) {
587 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); 590 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1);
588 if (result != 0) return result; 591 if (result != 0) return result;
589 return compareBy((e) => e.position().charOffset)(e0, e1); 592 return compareBy((e) => e.position().charOffset)(e0, e1);
590 } 593 }
591 594
592 List<Element> sortElements(Iterable<Element> elements) => 595 List<Element> sortElements(Iterable<Element> elements) =>
593 sorted(elements, compareElements); 596 sorted(elements, compareElements);
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/compiler.dart ('k') | sdk/lib/_internal/compiler/implementation/lib/js_number.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698