OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
6 * Any abstract representation of a dart element. This includes | 6 * Any abstract representation of a dart element. This includes |
7 * [Library], [Type] and [Member]. | 7 * [Library], [Type] and [Member]. |
8 */ | 8 */ |
9 class Element implements Hashable { | 9 class Element implements Hashable { |
10 // TODO(jimhug): Make name final when we can do it for Library. | 10 // TODO(jimhug): Make name final when we can do it for Library. |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 /** Should this element be treated as native JS? */ | 30 /** Should this element be treated as native JS? */ |
31 bool get isNative() => false; | 31 bool get isNative() => false; |
32 | 32 |
33 int hashCode() => name.hashCode(); | 33 int hashCode() => name.hashCode(); |
34 | 34 |
35 /** Will return a safe name to refer to this element with in JS code. */ | 35 /** Will return a safe name to refer to this element with in JS code. */ |
36 String get jsname() => _jsname; | 36 String get jsname() => _jsname; |
37 | 37 |
38 /** The native name of this element if it has one. */ | 38 /** The native name of this element if it has one. */ |
39 String get nativeName() => null; | 39 String get nativeName() => _jsname; |
40 | 40 |
41 /** Avoid the native name if hidden native. */ | 41 /** Avoid the native name if hidden native. */ |
42 bool get avoidNativeName() => false; | 42 bool get avoidNativeName() => false; |
43 | 43 |
44 /** | 44 /** |
45 * [jsname] priority of this element, if two elements conflict. | 45 * [jsname] priority of this element, if two elements conflict. |
46 * Higher one gets the name. | 46 * Higher one gets the name. |
47 */ | 47 */ |
48 int get jsnamePriority() => isNative ? 2 : (library.isCore ? 1 : 0); | 48 int get jsnamePriority() => isNative ? 2 : (library.isCore ? 1 : 0); |
49 | 49 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 name = typeRef.func.name.name; | 125 name = typeRef.func.name.name; |
126 } | 126 } |
127 // Totally bogus! | 127 // Totally bogus! |
128 typeRef.type = library.getOrAddFunctionType(this, name, typeRef.func); | 128 typeRef.type = library.getOrAddFunctionType(this, name, typeRef.func); |
129 } else { | 129 } else { |
130 world.internalError('unknown type reference', node.span); | 130 world.internalError('unknown type reference', node.span); |
131 } | 131 } |
132 return node.type; | 132 return node.type; |
133 } | 133 } |
134 } | 134 } |
OLD | NEW |