| 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 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |