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

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

Issue 10854216: Fix for class members cannot have the same name as the class in dart2js (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
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 TreeElements resolveMethodElement(FunctionElement element) { 112 TreeElements resolveMethodElement(FunctionElement element) {
113 return compiler.withCurrentElement(element, () { 113 return compiler.withCurrentElement(element, () {
114 bool isConstructor = element.kind === ElementKind.GENERATIVE_CONSTRUCTOR; 114 bool isConstructor = element.kind === ElementKind.GENERATIVE_CONSTRUCTOR;
115 if (constructorElements.containsKey(element)) { 115 if (constructorElements.containsKey(element)) {
116 assert(isConstructor); 116 assert(isConstructor);
117 TreeElements elements = constructorElements[element]; 117 TreeElements elements = constructorElements[element];
118 if (elements !== null) return elements; 118 if (elements !== null) return elements;
119 } 119 }
120 FunctionExpression tree = element.parseNode(compiler); 120 FunctionExpression tree = element.parseNode(compiler);
121 if (isConstructor) { 121 if (isConstructor) {
122 if (tree.returnType != null) {
123 error(tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE);
124 }
122 resolveConstructorImplementation(element, tree); 125 resolveConstructorImplementation(element, tree);
123 } 126 }
124 ResolverVisitor visitor = new ResolverVisitor(compiler, element); 127 ResolverVisitor visitor = new ResolverVisitor(compiler, element);
125 visitor.useElement(tree, element); 128 visitor.useElement(tree, element);
126 visitor.setupFunction(tree, element); 129 visitor.setupFunction(tree, element);
127 130
128 if (isConstructor) { 131 if (isConstructor) {
129 // Even if there is no initializer list we still have to do the 132 // Even if there is no initializer list we still have to do the
130 // resolution in case there is an implicit super constructor call. 133 // resolution in case there is an implicit super constructor call.
131 InitializerResolver resolver = new InitializerResolver(visitor); 134 InitializerResolver resolver = new InitializerResolver(visitor);
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 TopScope(LibraryElement library) : super(null, library); 2442 TopScope(LibraryElement library) : super(null, library);
2440 Element lookup(SourceString name) { 2443 Element lookup(SourceString name) {
2441 return library.find(name); 2444 return library.find(name);
2442 } 2445 }
2443 2446
2444 Element add(Element newElement) { 2447 Element add(Element newElement) {
2445 throw "Cannot add an element in the top scope"; 2448 throw "Cannot add an element in the top scope";
2446 } 2449 }
2447 String toString() => '$element'; 2450 String toString() => '$element';
2448 } 2451 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698