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

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

Issue 10970006: Correctly handle const constructors with type parameters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 abstract class TreeElements { 5 abstract class TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 DartType getType(TypeAnnotation annotation); 8 DartType getType(TypeAnnotation annotation);
9 bool isParameterChecked(Element element); 9 bool isParameterChecked(Element element);
10 } 10 }
(...skipping 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 if (result === null) { 2608 if (result === null) {
2609 String fullConstructorName = cls.name.slowToString(); 2609 String fullConstructorName = cls.name.slowToString();
2610 if (constructorName !== const SourceString('')) { 2610 if (constructorName !== const SourceString('')) {
2611 fullConstructorName = '$fullConstructorName' 2611 fullConstructorName = '$fullConstructorName'
2612 '.${constructorName.slowToString()}'; 2612 '.${constructorName.slowToString()}';
2613 } 2613 }
2614 return failOrReturnErroneousElement(cls, diagnosticNode, 2614 return failOrReturnErroneousElement(cls, diagnosticNode,
2615 new SourceString(fullConstructorName), 2615 new SourceString(fullConstructorName),
2616 MessageKind.CANNOT_FIND_CONSTRUCTOR, 2616 MessageKind.CANNOT_FIND_CONSTRUCTOR,
2617 [fullConstructorName]); 2617 [fullConstructorName]);
2618 } else if (inConstContext &&
ahe 2012/09/21 11:52:21 This isn't right.
ngeoffray 2012/09/21 12:27:30 Added a couple of TODOs.
2619 (result.modifiers == null || !result.modifiers.isConst())) {
2620 error(diagnosticNode, MessageKind.CONSTRUCTOR_IS_NOT_CONST);
2618 } 2621 }
2619 return result; 2622 return result;
2620 } 2623 }
2621 2624
2622 visitNewExpression(NewExpression node) { 2625 visitNewExpression(NewExpression node) {
2623 Node selector = node.send.selector; 2626 Node selector = node.send.selector;
2624 Element e = visit(selector); 2627 Element e = visit(selector);
2625 if (!Elements.isUnresolved(e) && e.kind === ElementKind.CLASS) { 2628 if (!Elements.isUnresolved(e) && e.kind === ElementKind.CLASS) {
2626 ClassElement cls = e; 2629 ClassElement cls = e;
2627 cls.ensureResolved(compiler); 2630 cls.ensureResolved(compiler);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
2825 2828
2826 Element localLookup(SourceString name) => library.find(name); 2829 Element localLookup(SourceString name) => library.find(name);
2827 Element lookup(SourceString name) => localLookup(name); 2830 Element lookup(SourceString name) => localLookup(name);
2828 Element lexicalLookup(SourceString name) => localLookup(name); 2831 Element lexicalLookup(SourceString name) => localLookup(name);
2829 2832
2830 Element add(Element newElement) { 2833 Element add(Element newElement) {
2831 throw "Cannot add an element in the top scope"; 2834 throw "Cannot add an element in the top scope";
2832 } 2835 }
2833 String toString() => '$element'; 2836 String toString() => '$element';
2834 } 2837 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/scanner/listener.dart » ('j') | tests/co19/co19-dart2dart.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698