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

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

Issue 11140018: Ensure that ClassElement.lookupConstructor fails when looking up default constructor using Selector… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Replaced getConstructorName with getConstructorSelector. Created 8 years, 2 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 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed. 9 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed.
10 #import('../../compiler.dart', prefix: 'api_e'); 10 #import('../../compiler.dart', prefix: 'api_e');
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 return result; 1487 return result;
1488 } 1488 }
1489 1489
1490 // TODO(aprelev@gmail.com): Peter believes that it would be great to 1490 // TODO(aprelev@gmail.com): Peter believes that it would be great to
1491 // make noMatch a required argument. Peter's suspicion is that most 1491 // make noMatch a required argument. Peter's suspicion is that most
1492 // callers of this method would benefit from using the noMatch method. 1492 // callers of this method would benefit from using the noMatch method.
1493 Element lookupConstructor(Selector selector, [Element noMatch(Element)]) { 1493 Element lookupConstructor(Selector selector, [Element noMatch(Element)]) {
1494 SourceString normalizedName; 1494 SourceString normalizedName;
1495 SourceString className = this.name; 1495 SourceString className = this.name;
1496 SourceString constructorName = selector.name; 1496 SourceString constructorName = selector.name;
1497 if (constructorName !== const SourceString('') && 1497 if (constructorName != const SourceString('')) {
1498 ((className === null) ||
1499 (constructorName.slowToString() != className.slowToString()))) {
1500 normalizedName = Elements.constructConstructorName(className, 1498 normalizedName = Elements.constructConstructorName(className,
1501 constructorName); 1499 constructorName);
1502 } else { 1500 } else {
1503 normalizedName = className; 1501 normalizedName = className;
1504 } 1502 }
1505 Element result = localLookup(normalizedName); 1503 Element result = localLookup(normalizedName);
1506 return validateConstructorLookupResults(selector, result, noMatch); 1504 return validateConstructorLookupResults(selector, result, noMatch);
1507 } 1505 }
1508 1506
1509 Element lookupFactoryConstructor(Selector selector, 1507 Element lookupFactoryConstructor(Selector selector,
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1963 1961
1964 MetadataAnnotation ensureResolved(Compiler compiler) { 1962 MetadataAnnotation ensureResolved(Compiler compiler) {
1965 if (resolutionState == STATE_NOT_STARTED) { 1963 if (resolutionState == STATE_NOT_STARTED) {
1966 compiler.resolver.resolveMetadataAnnotation(this); 1964 compiler.resolver.resolveMetadataAnnotation(this);
1967 } 1965 }
1968 return this; 1966 return this;
1969 } 1967 }
1970 1968
1971 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 1969 String toString() => 'MetadataAnnotation($value, $resolutionState)';
1972 } 1970 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | lib/compiler/implementation/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698