| 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('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 static final ElementKind VARIABLE_LIST = const ElementKind('variable_list'); | 25 static final ElementKind VARIABLE_LIST = const ElementKind('variable_list'); |
| 26 static final ElementKind FIELD_LIST = const ElementKind('field_list'); | 26 static final ElementKind FIELD_LIST = const ElementKind('field_list'); |
| 27 static final ElementKind GENERATIVE_CONSTRUCTOR_BODY = | 27 static final ElementKind GENERATIVE_CONSTRUCTOR_BODY = |
| 28 const ElementKind('generative_constructor_body'); | 28 const ElementKind('generative_constructor_body'); |
| 29 static final ElementKind COMPILATION_UNIT = | 29 static final ElementKind COMPILATION_UNIT = |
| 30 const ElementKind('compilation_unit'); | 30 const ElementKind('compilation_unit'); |
| 31 static final ElementKind GETTER = const ElementKind('getter'); | 31 static final ElementKind GETTER = const ElementKind('getter'); |
| 32 static final ElementKind SETTER = const ElementKind('setter'); | 32 static final ElementKind SETTER = const ElementKind('setter'); |
| 33 static final ElementKind ABSTRACT_FIELD = const ElementKind('abstract_field'); | 33 static final ElementKind ABSTRACT_FIELD = const ElementKind('abstract_field'); |
| 34 static final ElementKind LIBRARY = const ElementKind('library'); | 34 static final ElementKind LIBRARY = const ElementKind('library'); |
| 35 static final ElementKind PREFIX = const ElementKind('prefix'); |
| 35 | 36 |
| 36 toString() => id; | 37 toString() => id; |
| 37 } | 38 } |
| 38 | 39 |
| 39 class Element implements Hashable { | 40 class Element implements Hashable { |
| 40 final SourceString name; | 41 final SourceString name; |
| 41 final ElementKind kind; | 42 final ElementKind kind; |
| 42 final Element enclosingElement; | 43 final Element enclosingElement; |
| 43 Modifiers get modifiers() => null; | 44 Modifiers get modifiers() => null; |
| 44 | 45 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return elements[name]; | 171 return elements[name]; |
| 171 } | 172 } |
| 172 | 173 |
| 173 Element lookupLocalMember(SourceString name) { | 174 Element lookupLocalMember(SourceString name) { |
| 174 Element element = find(name); | 175 Element element = find(name); |
| 175 if (element === null) return null; | 176 if (element === null) return null; |
| 176 return (this === element.getLibrary()) ? element : null; | 177 return (this === element.getLibrary()) ? element : null; |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 | 180 |
| 181 class PrefixElement extends Element { |
| 182 final LiteralString prefix; |
| 183 final LibraryElement library; |
| 184 |
| 185 PrefixElement(LiteralString prefix, |
| 186 LibraryElement this.library, |
| 187 Element enclosing) |
| 188 : this.prefix = prefix, |
| 189 super(prefix.dartString.source, ElementKind.PREFIX, enclosing); |
| 190 } |
| 191 |
| 180 class VariableElement extends Element { | 192 class VariableElement extends Element { |
| 181 final VariableListElement variables; | 193 final VariableListElement variables; |
| 182 Expression cachedNode; // The send or the identifier in the variables list. | 194 Expression cachedNode; // The send or the identifier in the variables list. |
| 183 | 195 |
| 184 Modifiers get modifiers() => variables.modifiers; | 196 Modifiers get modifiers() => variables.modifiers; |
| 185 | 197 |
| 186 VariableElement(SourceString name, | 198 VariableElement(SourceString name, |
| 187 VariableListElement this.variables, | 199 VariableListElement this.variables, |
| 188 ElementKind kind, | 200 ElementKind kind, |
| 189 Element enclosing, | 201 Element enclosing, |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 else if (str === '>=') str = 'ge'; | 664 else if (str === '>=') str = 'ge'; |
| 653 else if (str === '>') str = 'gt'; | 665 else if (str === '>') str = 'gt'; |
| 654 else if (str === '<=') str = 'le'; | 666 else if (str === '<=') str = 'le'; |
| 655 else if (str === '<') str = 'lt'; | 667 else if (str === '<') str = 'lt'; |
| 656 else if (str === '&' || str === '&=') str = 'and'; | 668 else if (str === '&' || str === '&=') str = 'and'; |
| 657 else if (str === '^' || str === '^=') str = 'xor'; | 669 else if (str === '^' || str === '^=') str = 'xor'; |
| 658 else if (str === '|' || str === '|=') str = 'or'; | 670 else if (str === '|' || str === '|=') str = 'or'; |
| 659 return new SourceString('$receiver\$$str'); | 671 return new SourceString('$receiver\$$str'); |
| 660 } | 672 } |
| 661 } | 673 } |
| OLD | NEW |