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

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

Issue 11416257: Revert "Add @JSName annotation for native fields and methods." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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' as api_e; 10 import '../../compiler.dart' as api_e;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 String _nativeName = null; 358 bool _isNative = false;
359 bool isNative() => _nativeName != null; 359 void setNative() { _isNative = true; }
360 String nativeName() => _nativeName; 360 bool isNative() => _isNative;
361 /// Marks this element as a native element.
362 void setNative(String name) { _nativeName = name; }
363 361
364 FunctionElement asFunctionElement() => null; 362 FunctionElement asFunctionElement() => null;
365 363
366 static bool isInvalid(Element e) => e == null || e.isErroneous(); 364 static bool isInvalid(Element e) => e == null || e.isErroneous();
367 365
368 bool isAbstract(Compiler compiler) => modifiers.isAbstract(); 366 bool isAbstract(Compiler compiler) => modifiers.isAbstract();
369 } 367 }
370 368
371 /** 369 /**
372 * Represents an unresolvable or duplicated element. 370 * Represents an unresolvable or duplicated element.
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using 1432 * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using
1435 * this distinction, we can print the raw type with type arguments only when 1433 * this distinction, we can print the raw type with type arguments only when
1436 * the input source has used explicit type arguments. 1434 * the input source has used explicit type arguments.
1437 * 1435 *
1438 * This type is computed together with [thisType] in [computeType]. 1436 * This type is computed together with [thisType] in [computeType].
1439 */ 1437 */
1440 InterfaceType rawType; 1438 InterfaceType rawType;
1441 DartType supertype; 1439 DartType supertype;
1442 DartType defaultClass; 1440 DartType defaultClass;
1443 Link<DartType> interfaces; 1441 Link<DartType> interfaces;
1444 SourceString nativeTagInfo; 1442 SourceString nativeName;
1445 int supertypeLoadState; 1443 int supertypeLoadState;
1446 int resolutionState; 1444 int resolutionState;
1447 1445
1448 // backendMembers are members that have been added by the backend to simplify 1446 // backendMembers are members that have been added by the backend to simplify
1449 // compilation. They don't have any user-side counter-part. 1447 // compilation. They don't have any user-side counter-part.
1450 Link<Element> backendMembers = const Link<Element>(); 1448 Link<Element> backendMembers = const Link<Element>();
1451 1449
1452 Link<DartType> allSupertypes; 1450 Link<DartType> allSupertypes;
1453 1451
1454 // Lazily applied patch of class members. 1452 // Lazily applied patch of class members.
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 * account. 1780 * account.
1783 */ 1781 */
1784 bool isSubclassOf(ClassElement cls) { 1782 bool isSubclassOf(ClassElement cls) {
1785 for (ClassElement s = this; s != null; s = s.superclass) { 1783 for (ClassElement s = this; s != null; s = s.superclass) {
1786 if (identical(s, cls)) return true; 1784 if (identical(s, cls)) return true;
1787 } 1785 }
1788 return false; 1786 return false;
1789 } 1787 }
1790 1788
1791 bool isInterface() => false; 1789 bool isInterface() => false;
1792 bool isNative() => nativeTagInfo != null; 1790 bool isNative() => nativeName != null;
1793 int get hashCode => id; 1791 int get hashCode => id;
1794 1792
1795 Scope buildScope() => new ClassScope(enclosingElement.buildScope(), this); 1793 Scope buildScope() => new ClassScope(enclosingElement.buildScope(), this);
1796 1794
1797 String toString() { 1795 String toString() {
1798 if (origin != null) { 1796 if (origin != null) {
1799 return 'patch ${super.toString()}'; 1797 return 'patch ${super.toString()}';
1800 } else if (patch != null) { 1798 } else if (patch != null) {
1801 return 'origin ${super.toString()}'; 1799 return 'origin ${super.toString()}';
1802 } else { 1800 } else {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 2134
2137 MetadataAnnotation ensureResolved(Compiler compiler) { 2135 MetadataAnnotation ensureResolved(Compiler compiler) {
2138 if (resolutionState == STATE_NOT_STARTED) { 2136 if (resolutionState == STATE_NOT_STARTED) {
2139 compiler.resolver.resolveMetadataAnnotation(this); 2137 compiler.resolver.resolveMetadataAnnotation(this);
2140 } 2138 }
2141 return this; 2139 return this;
2142 } 2140 }
2143 2141
2144 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2142 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2145 } 2143 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/dart2js.dart ('k') | sdk/lib/_internal/compiler/implementation/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698