OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.modelx; | 5 library elements.modelx; |
6 | 6 |
7 import '../compiler.dart' show | 7 import '../compiler.dart' show |
8 Compiler; | 8 Compiler; |
9 import '../constants/constant_constructors.dart'; | 9 import '../constants/constant_constructors.dart'; |
10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
(...skipping 19 matching lines...) Expand all Loading... |
30 Scope, | 30 Scope, |
31 TypeDeclarationScope; | 31 TypeDeclarationScope; |
32 import '../resolution/resolution.dart' show | 32 import '../resolution/resolution.dart' show |
33 AnalyzableElementX; | 33 AnalyzableElementX; |
34 import '../resolution/tree_elements.dart' show | 34 import '../resolution/tree_elements.dart' show |
35 TreeElements; | 35 TreeElements; |
36 import '../resolution/typedefs.dart' show | 36 import '../resolution/typedefs.dart' show |
37 TypedefCyclicVisitor; | 37 TypedefCyclicVisitor; |
38 import '../script.dart'; | 38 import '../script.dart'; |
39 import '../tokens/token.dart' show | 39 import '../tokens/token.dart' show |
40 EOF_TOKEN, | |
41 ErrorToken, | 40 ErrorToken, |
42 Token; | 41 Token; |
| 42 import '../tokens/token_constants.dart' as Tokens show |
| 43 EOF_TOKEN; |
43 import '../tree/tree.dart'; | 44 import '../tree/tree.dart'; |
44 import '../util/util.dart'; | 45 import '../util/util.dart'; |
45 | 46 |
46 import 'common.dart'; | 47 import 'common.dart'; |
47 import 'elements.dart'; | 48 import 'elements.dart'; |
48 import 'visitor.dart' show | 49 import 'visitor.dart' show |
49 ElementVisitor; | 50 ElementVisitor; |
50 | 51 |
51 abstract class DeclarationSite { | 52 abstract class DeclarationSite { |
52 } | 53 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 132 |
132 static Token findNameToken(Token token, bool isConstructor, String name, | 133 static Token findNameToken(Token token, bool isConstructor, String name, |
133 String enclosingClassName) { | 134 String enclosingClassName) { |
134 // We search for the token that has the name of this element. | 135 // We search for the token that has the name of this element. |
135 // For constructors, that doesn't work because they may have | 136 // For constructors, that doesn't work because they may have |
136 // named formed out of multiple tokens (named constructors) so | 137 // named formed out of multiple tokens (named constructors) so |
137 // for those we search for the class name instead. | 138 // for those we search for the class name instead. |
138 String needle = isConstructor ? enclosingClassName : name; | 139 String needle = isConstructor ? enclosingClassName : name; |
139 // The unary '-' operator has a special element name (specified). | 140 // The unary '-' operator has a special element name (specified). |
140 if (needle == 'unary-') needle = '-'; | 141 if (needle == 'unary-') needle = '-'; |
141 for (Token t = token; EOF_TOKEN != t.kind; t = t.next) { | 142 for (Token t = token; Tokens.EOF_TOKEN != t.kind; t = t.next) { |
142 if (t is !ErrorToken && needle == t.value) return t; | 143 if (t is !ErrorToken && needle == t.value) return t; |
143 } | 144 } |
144 return token; | 145 return token; |
145 } | 146 } |
146 | 147 |
147 CompilationUnitElement get compilationUnit { | 148 CompilationUnitElement get compilationUnit { |
148 Element element = this; | 149 Element element = this; |
149 while (!element.isCompilationUnit) { | 150 while (!element.isCompilationUnit) { |
150 element = element.enclosingElement; | 151 element = element.enclosingElement; |
151 } | 152 } |
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2913 AstElement get definingElement; | 2914 AstElement get definingElement; |
2914 | 2915 |
2915 bool get hasResolvedAst => definingElement.hasTreeElements; | 2916 bool get hasResolvedAst => definingElement.hasTreeElements; |
2916 | 2917 |
2917 ResolvedAst get resolvedAst { | 2918 ResolvedAst get resolvedAst { |
2918 return new ResolvedAst(declaration, | 2919 return new ResolvedAst(declaration, |
2919 definingElement.node, definingElement.treeElements); | 2920 definingElement.node, definingElement.treeElements); |
2920 } | 2921 } |
2921 | 2922 |
2922 } | 2923 } |
OLD | NEW |