| 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. |
| 11 /** The user-visible name of this [Element]. */ | 11 /** The user-visible name of this [Element]. */ |
| 12 String name; | 12 String name; |
| 13 | 13 |
| 14 /** A safe name to use for this [Element] in generated JS code. */ | 14 /** A safe name to use for this [Element] in generated JS code. */ |
| 15 String _jsname; | 15 String _jsname; |
| 16 | 16 |
| 17 /** The lexically/logically enclosing [Element] for lookups. */ | 17 /** The lexically/logically enclosing [Element] for lookups. */ |
| 18 Element _enclosingElement; | 18 Element _enclosingElement; |
| 19 | 19 |
| 20 Element(this.name, this._enclosingElement) { | 20 Element(this.name, this._enclosingElement) { |
| 21 _jsname = name; | 21 _jsname = world.toJsIdentifier(name); |
| 22 } | 22 } |
| 23 | 23 |
| 24 // TODO - walk tree | 24 // TODO - walk tree |
| 25 Library get library() => null; | 25 Library get library() => null; |
| 26 | 26 |
| 27 /** A source location for messages to the user about this [Element]. */ | 27 /** A source location for messages to the user about this [Element]. */ |
| 28 SourceSpan get span() => null; | 28 SourceSpan get span() => null; |
| 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; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 name = typeRef.func.name.name; | 120 name = typeRef.func.name.name; |
| 121 } | 121 } |
| 122 // Totally bogus! | 122 // Totally bogus! |
| 123 typeRef.type = library.getOrAddFunctionType(this, name, typeRef.func); | 123 typeRef.type = library.getOrAddFunctionType(this, name, typeRef.func); |
| 124 } else { | 124 } else { |
| 125 world.internalError('unknown type reference', node.span); | 125 world.internalError('unknown type reference', node.span); |
| 126 } | 126 } |
| 127 return node.type; | 127 return node.type; |
| 128 } | 128 } |
| 129 } | 129 } |
| OLD | NEW |