Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import 'dart:collection' show LinkedHashMap; | 7 import 'dart:collection' show LinkedHashMap; |
| 8 | 8 |
| 9 import 'elements.dart'; | 9 import 'elements.dart'; |
| 10 import '../../compiler.dart' as api; | 10 import '../../compiler.dart' as api; |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1402 /// constructor in a mixin application. | 1402 /// constructor in a mixin application. |
| 1403 final FunctionElement target; | 1403 final FunctionElement target; |
| 1404 | 1404 |
| 1405 SynthesizedConstructorElementX(Element enclosing) | 1405 SynthesizedConstructorElementX(Element enclosing) |
| 1406 : super(enclosing.name, ElementKind.GENERATIVE_CONSTRUCTOR, | 1406 : super(enclosing.name, ElementKind.GENERATIVE_CONSTRUCTOR, |
| 1407 Modifiers.EMPTY, enclosing), | 1407 Modifiers.EMPTY, enclosing), |
| 1408 target = null; | 1408 target = null; |
| 1409 | 1409 |
| 1410 SynthesizedConstructorElementX.forDefault(Element enclosing, | 1410 SynthesizedConstructorElementX.forDefault(Element enclosing, |
| 1411 Compiler compiler) | 1411 Compiler compiler) |
| 1412 : super(enclosing.name, ElementKind.GENERATIVE_CONSTRUCTOR, | 1412 : super(const SourceString(''), ElementKind.GENERATIVE_CONSTRUCTOR, |
| 1413 Modifiers.EMPTY, enclosing), | 1413 Modifiers.EMPTY, enclosing), |
| 1414 target = null { | 1414 target = null { |
| 1415 // TODO(karlklose): get rid of the fake AST. | 1415 // TODO(karlklose): get rid of the fake AST. |
| 1416 type = new FunctionType(this, | 1416 type = new FunctionType(this, |
| 1417 compiler.types.voidType, | 1417 compiler.types.voidType, |
| 1418 const Link<DartType>(), | 1418 const Link<DartType>(), |
| 1419 const Link<DartType>(), | 1419 const Link<DartType>(), |
| 1420 const Link<SourceString>(), | 1420 const Link<SourceString>(), |
| 1421 const Link<DartType>()); | 1421 const Link<DartType>()); |
| 1422 cachedNode = new FunctionExpression( | 1422 cachedNode = new FunctionExpression( |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1791 && result.getLibrary() != selector.library)) { | 1791 && result.getLibrary() != selector.library)) { |
| 1792 result = noMatch != null ? noMatch(result) : null; | 1792 result = noMatch != null ? noMatch(result) : null; |
| 1793 } | 1793 } |
| 1794 return result; | 1794 return result; |
| 1795 } | 1795 } |
| 1796 | 1796 |
| 1797 // TODO(aprelev@gmail.com): Peter believes that it would be great to | 1797 // TODO(aprelev@gmail.com): Peter believes that it would be great to |
| 1798 // make noMatch a required argument. Peter's suspicion is that most | 1798 // make noMatch a required argument. Peter's suspicion is that most |
| 1799 // callers of this method would benefit from using the noMatch method. | 1799 // callers of this method would benefit from using the noMatch method. |
| 1800 Element lookupConstructor(Selector selector, [Element noMatch(Element)]) { | 1800 Element lookupConstructor(Selector selector, [Element noMatch(Element)]) { |
| 1801 SourceString normalizedName; | 1801 Element result = localLookup(selector.name); |
|
ahe
2013/07/11 10:09:42
Awesome!!!
| |
| 1802 SourceString className = this.name; | |
| 1803 SourceString constructorName = selector.name; | |
| 1804 if (constructorName != const SourceString('')) { | |
| 1805 normalizedName = Elements.constructConstructorName(className, | |
| 1806 constructorName); | |
| 1807 } else { | |
| 1808 normalizedName = className; | |
| 1809 } | |
| 1810 Element result = localLookup(normalizedName); | |
| 1811 return validateConstructorLookupResults(selector, result, noMatch); | 1802 return validateConstructorLookupResults(selector, result, noMatch); |
| 1812 } | 1803 } |
| 1813 | 1804 |
| 1814 Element lookupFactoryConstructor(Selector selector, | 1805 Element lookupFactoryConstructor(Selector selector, |
| 1815 [Element noMatch(Element)]) { | 1806 [Element noMatch(Element)]) { |
| 1816 SourceString constructorName = selector.name; | 1807 SourceString constructorName = selector.name; |
| 1817 Element result = localLookup(constructorName); | 1808 Element result = localLookup(constructorName); |
| 1818 return validateConstructorLookupResults(selector, result, noMatch); | 1809 return validateConstructorLookupResults(selector, result, noMatch); |
| 1819 } | 1810 } |
| 1820 | 1811 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2216 | 2207 |
| 2217 MetadataAnnotation ensureResolved(Compiler compiler) { | 2208 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2218 if (resolutionState == STATE_NOT_STARTED) { | 2209 if (resolutionState == STATE_NOT_STARTED) { |
| 2219 compiler.resolver.resolveMetadataAnnotation(this); | 2210 compiler.resolver.resolveMetadataAnnotation(this); |
| 2220 } | 2211 } |
| 2221 return this; | 2212 return this; |
| 2222 } | 2213 } |
| 2223 | 2214 |
| 2224 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2215 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2225 } | 2216 } |
| OLD | NEW |