| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart' show Identifiers; | 8 import '../common/names.dart' show Identifiers; |
| 9 import '../common/resolution.dart' show Resolution, ParsingContext; | 9 import '../common/resolution.dart' show Resolution, ParsingContext; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 static Token findNameToken( | 129 static Token findNameToken( |
| 130 Token token, bool isConstructor, String name, String enclosingClassName) { | 130 Token token, bool isConstructor, String name, String enclosingClassName) { |
| 131 // We search for the token that has the name of this element. | 131 // We search for the token that has the name of this element. |
| 132 // For constructors, that doesn't work because they may have | 132 // For constructors, that doesn't work because they may have |
| 133 // named formed out of multiple tokens (named constructors) so | 133 // named formed out of multiple tokens (named constructors) so |
| 134 // for those we search for the class name instead. | 134 // for those we search for the class name instead. |
| 135 String needle = isConstructor ? enclosingClassName : name; | 135 String needle = isConstructor ? enclosingClassName : name; |
| 136 // The unary '-' operator has a special element name (specified). | 136 // The unary '-' operator has a special element name (specified). |
| 137 if (needle == 'unary-') needle = '-'; | 137 if (needle == 'unary-') needle = '-'; |
| 138 for (Token t = token; Tokens.EOF_TOKEN != t.kind; t = t.next) { | 138 for (Token t = token; Tokens.EOF_TOKEN != t.kind; t = t.next) { |
| 139 if (t is! ErrorToken && needle == t.value) return t; | 139 if (t is! ErrorToken && needle == t.lexeme) return t; |
| 140 } | 140 } |
| 141 return token; | 141 return token; |
| 142 } | 142 } |
| 143 | 143 |
| 144 CompilationUnitElement get compilationUnit { | 144 CompilationUnitElement get compilationUnit { |
| 145 Element element = this; | 145 Element element = this; |
| 146 while (!element.isCompilationUnit) { | 146 while (!element.isCompilationUnit) { |
| 147 element = element.enclosingElement; | 147 element = element.enclosingElement; |
| 148 } | 148 } |
| 149 return element; | 149 return element; |
| (...skipping 3317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3467 body = node.asFunctionExpression().body; | 3467 body = node.asFunctionExpression().body; |
| 3468 } | 3468 } |
| 3469 return new ParsedResolvedAst( | 3469 return new ParsedResolvedAst( |
| 3470 declaration, | 3470 declaration, |
| 3471 node, | 3471 node, |
| 3472 body, | 3472 body, |
| 3473 definingElement.treeElements, | 3473 definingElement.treeElements, |
| 3474 definingElement.compilationUnit.script.resourceUri); | 3474 definingElement.compilationUnit.script.resourceUri); |
| 3475 } | 3475 } |
| 3476 } | 3476 } |
| OLD | NEW |