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

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

Issue 10855220: Fix issue 4562 by giving a proper error message rather than crashing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « no previous file | tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | 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 interface TreeElements { 5 interface TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 Type getType(TypeAnnotation annotation); 8 Type getType(TypeAnnotation annotation);
9 } 9 }
10 10
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 error(diagnosticNode, MessageKind.SUPER_INITIALIZER_IN_OBJECT); 502 error(diagnosticNode, MessageKind.SUPER_INITIALIZER_IN_OBJECT);
503 } else { 503 } else {
504 lookupTarget = lookupTarget.supertype.element; 504 lookupTarget = lookupTarget.supertype.element;
505 } 505 }
506 } 506 }
507 507
508 // Lookup constructor and try to match it to the selector. 508 // Lookup constructor and try to match it to the selector.
509 ResolverTask resolver = visitor.compiler.resolver; 509 ResolverTask resolver = visitor.compiler.resolver;
510 final SourceString className = lookupTarget.name; 510 final SourceString className = lookupTarget.name;
511 result = lookupTarget.lookupConstructor(className, constructorName); 511 result = lookupTarget.lookupConstructor(className, constructorName);
512 if (result === null) { 512 if (result === null || !result.isGenerativeConstructor()) {
513 String classNameString = className.slowToString(); 513 String classNameString = className.slowToString();
514 String constructorNameString = constructorName.slowToString(); 514 String constructorNameString = constructorName.slowToString();
515 String name = (constructorName === const SourceString('')) 515 String name = (constructorName === const SourceString(''))
516 ? classNameString 516 ? classNameString
517 : "$classNameString.$constructorNameString"; 517 : "$classNameString.$constructorNameString";
518 MessageKind kind = isImplicitSuperCall 518 MessageKind kind = isImplicitSuperCall
519 ? MessageKind.CANNOT_RESOLVE_CONSTRUCTOR_FOR_IMPLICIT 519 ? MessageKind.CANNOT_RESOLVE_CONSTRUCTOR_FOR_IMPLICIT
520 : MessageKind.CANNOT_RESOLVE_CONSTRUCTOR; 520 : MessageKind.CANNOT_RESOLVE_CONSTRUCTOR;
521 error(diagnosticNode, kind, [name]); 521 error(diagnosticNode, kind, [name]);
522 } else { 522 } else {
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 TopScope(LibraryElement library) : super(null, library); 2431 TopScope(LibraryElement library) : super(null, library);
2432 Element lookup(SourceString name) { 2432 Element lookup(SourceString name) {
2433 return library.find(name); 2433 return library.find(name);
2434 } 2434 }
2435 2435
2436 Element add(Element newElement) { 2436 Element add(Element newElement) {
2437 throw "Cannot add an element in the top scope"; 2437 throw "Cannot add an element in the top scope";
2438 } 2438 }
2439 String toString() => '$element'; 2439 String toString() => '$element';
2440 } 2440 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698