OLD | NEW |
---|---|
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' as api_e; | 10 import '../../compiler.dart' as api_e; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 if (enclosingElement != null && !isTopLevel()) { | 348 if (enclosingElement != null && !isTopLevel()) { |
349 String holderName = enclosingElement.name != null | 349 String holderName = enclosingElement.name != null |
350 ? enclosingElement.name.slowToString() | 350 ? enclosingElement.name.slowToString() |
351 : '${enclosingElement.kind}?'; | 351 : '${enclosingElement.kind}?'; |
352 return '$kind($holderName#${nameText})'; | 352 return '$kind($holderName#${nameText})'; |
353 } else { | 353 } else { |
354 return '$kind(${nameText})'; | 354 return '$kind(${nameText})'; |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 bool _isNative = false; | 358 String _nativeName = null; |
ahe
2012/11/29 09:19:26
Please follow this layout of class definitions:
f
sra1
2012/12/04 01:31:31
Sure, but (1) I was following existing style (2) w
| |
359 void setNative() { _isNative = true; } | 359 bool isNative() => _nativeName != null; |
360 bool isNative() => _isNative; | 360 String nativeName() => _nativeName; |
361 /// Marks this element as a native element. | |
362 void setNative(String name) { _nativeName = name; } | |
361 | 363 |
362 FunctionElement asFunctionElement() => null; | 364 FunctionElement asFunctionElement() => null; |
363 | 365 |
364 static bool isInvalid(Element e) => e == null || e.isErroneous(); | 366 static bool isInvalid(Element e) => e == null || e.isErroneous(); |
365 | 367 |
366 bool isAbstract(Compiler compiler) => modifiers.isAbstract(); | 368 bool isAbstract(Compiler compiler) => modifiers.isAbstract(); |
367 } | 369 } |
368 | 370 |
369 /** | 371 /** |
370 * Represents an unresolvable or duplicated element. | 372 * Represents an unresolvable or duplicated element. |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1432 * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using | 1434 * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using |
1433 * this distinction, we can print the raw type with type arguments only when | 1435 * this distinction, we can print the raw type with type arguments only when |
1434 * the input source has used explicit type arguments. | 1436 * the input source has used explicit type arguments. |
1435 * | 1437 * |
1436 * This type is computed together with [thisType] in [computeType]. | 1438 * This type is computed together with [thisType] in [computeType]. |
1437 */ | 1439 */ |
1438 InterfaceType rawType; | 1440 InterfaceType rawType; |
1439 DartType supertype; | 1441 DartType supertype; |
1440 DartType defaultClass; | 1442 DartType defaultClass; |
1441 Link<DartType> interfaces; | 1443 Link<DartType> interfaces; |
1442 SourceString nativeName; | 1444 SourceString nativeTagInfo; |
1443 int supertypeLoadState; | 1445 int supertypeLoadState; |
1444 int resolutionState; | 1446 int resolutionState; |
1445 | 1447 |
1446 // backendMembers are members that have been added by the backend to simplify | 1448 // backendMembers are members that have been added by the backend to simplify |
1447 // compilation. They don't have any user-side counter-part. | 1449 // compilation. They don't have any user-side counter-part. |
1448 Link<Element> backendMembers = const Link<Element>(); | 1450 Link<Element> backendMembers = const Link<Element>(); |
1449 | 1451 |
1450 Link<DartType> allSupertypes; | 1452 Link<DartType> allSupertypes; |
1451 | 1453 |
1452 // Lazily applied patch of class members. | 1454 // Lazily applied patch of class members. |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1780 * account. | 1782 * account. |
1781 */ | 1783 */ |
1782 bool isSubclassOf(ClassElement cls) { | 1784 bool isSubclassOf(ClassElement cls) { |
1783 for (ClassElement s = this; s != null; s = s.superclass) { | 1785 for (ClassElement s = this; s != null; s = s.superclass) { |
1784 if (identical(s, cls)) return true; | 1786 if (identical(s, cls)) return true; |
1785 } | 1787 } |
1786 return false; | 1788 return false; |
1787 } | 1789 } |
1788 | 1790 |
1789 bool isInterface() => false; | 1791 bool isInterface() => false; |
1790 bool isNative() => nativeName != null; | 1792 bool isNative() => nativeTagInfo != null; |
1791 int get hashCode => id; | 1793 int get hashCode => id; |
1792 | 1794 |
1793 Scope buildScope() => new ClassScope(enclosingElement.buildScope(), this); | 1795 Scope buildScope() => new ClassScope(enclosingElement.buildScope(), this); |
1794 | 1796 |
1795 String toString() { | 1797 String toString() { |
1796 if (origin != null) { | 1798 if (origin != null) { |
1797 return 'patch ${super.toString()}'; | 1799 return 'patch ${super.toString()}'; |
1798 } else if (patch != null) { | 1800 } else if (patch != null) { |
1799 return 'origin ${super.toString()}'; | 1801 return 'origin ${super.toString()}'; |
1800 } else { | 1802 } else { |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2134 | 2136 |
2135 MetadataAnnotation ensureResolved(Compiler compiler) { | 2137 MetadataAnnotation ensureResolved(Compiler compiler) { |
2136 if (resolutionState == STATE_NOT_STARTED) { | 2138 if (resolutionState == STATE_NOT_STARTED) { |
2137 compiler.resolver.resolveMetadataAnnotation(this); | 2139 compiler.resolver.resolveMetadataAnnotation(this); |
2138 } | 2140 } |
2139 return this; | 2141 return this; |
2140 } | 2142 } |
2141 | 2143 |
2142 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2144 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
2143 } | 2145 } |
OLD | NEW |