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

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

Issue 10947024: Made dart2js constructor lookup logic "private"-aware, fixed 4740 bug. (Closed) Base URL: https://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 #library('elements'); 5 #library('elements');
6 6
7 #import('dart:uri'); 7 #import('dart:uri');
8 8
9 #import('../tree/tree.dart'); 9 #import('../tree/tree.dart');
10 #import('../scanner/scannerlib.dart'); 10 #import('../scanner/scannerlib.dart');
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 } 1268 }
1269 SourceString fieldName = fieldMember.name; 1269 SourceString fieldName = fieldMember.name;
1270 while (true) { 1270 while (true) {
1271 Element foundMember = lookupClass.lookupMember(fieldName); 1271 Element foundMember = lookupClass.lookupMember(fieldName);
1272 if (foundMember == fieldMember) return false; 1272 if (foundMember == fieldMember) return false;
1273 if (foundMember.isField()) return true; 1273 if (foundMember.isField()) return true;
1274 lookupClass = foundMember.getEnclosingClass().superclass; 1274 lookupClass = foundMember.getEnclosingClass().superclass;
1275 } 1275 }
1276 } 1276 }
1277 1277
1278 Element lookupConstructor(SourceString className, 1278 Element lookupConstructor(LibraryElement fromLibrary,
kasperl 2012/09/19 05:59:17 In general, I think we should start using selector
1279 SourceString className,
1279 [SourceString constructorName = 1280 [SourceString constructorName =
1280 const SourceString(''), 1281 const SourceString(''),
1281 Element noMatch(Element)]) { 1282 Element noMatch(Element)]) {
1282 // TODO(karlklose): have a map from class names to a map of constructors 1283 // TODO(karlklose): have a map from class names to a map of constructors
1283 // instead of creating the name here? 1284 // instead of creating the name here?
1284 SourceString normalizedName; 1285 SourceString normalizedName;
1285 if (constructorName !== const SourceString('')) { 1286 if (constructorName !== const SourceString('')) {
1286 normalizedName = Elements.constructConstructorName(className, 1287 normalizedName = Elements.constructConstructorName(className,
1287 constructorName); 1288 constructorName);
1288 } else { 1289 } else {
1289 normalizedName = className; 1290 normalizedName = className;
1290 } 1291 }
1291 Element result = localLookup(normalizedName); 1292 Element result = localLookup(normalizedName);
1292 if (result === null || !result.isConstructor()) { 1293 if (result === null
1294 || !result.isConstructor()
1295 || (constructorName.isPrivate()
1296 && result.getLibrary() != fromLibrary)) {
1293 result = noMatch !== null ? noMatch(result) : null; 1297 result = noMatch !== null ? noMatch(result) : null;
1294 } 1298 }
1295 return result; 1299 return result;
1296 } 1300 }
1297 1301
1298 bool get hasConstructor { 1302 bool get hasConstructor {
1299 // Search in scope to be sure we search patched constructors. 1303 // Search in scope to be sure we search patched constructors.
1300 for (var element in localScope.getValues()) { 1304 for (var element in localScope.getValues()) {
1301 if (element.isConstructor()) return true; 1305 if (element.isConstructor()) return true;
1302 } 1306 }
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 1695
1692 MetadataAnnotation ensureResolved(Compiler compiler) { 1696 MetadataAnnotation ensureResolved(Compiler compiler) {
1693 if (resolutionState == STATE_NOT_STARTED) { 1697 if (resolutionState == STATE_NOT_STARTED) {
1694 compiler.resolver.resolveMetadataAnnotation(this); 1698 compiler.resolver.resolveMetadataAnnotation(this);
1695 } 1699 }
1696 return this; 1700 return this;
1697 } 1701 }
1698 1702
1699 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 1703 String toString() => 'MetadataAnnotation($value, $resolutionState)';
1700 } 1704 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698