| 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 dart2js.mirrors; | 5 library dart2js.mirrors; |
| 6 | 6 |
| 7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView; | 7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView; |
| 8 | 8 |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 return getBeginToken(); | 186 return getBeginToken(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 Script getScript() => _element.compilationUnit.script; | 189 Script getScript() => _element.compilationUnit.script; |
| 190 | 190 |
| 191 SourceLocation get location { | 191 SourceLocation get location { |
| 192 Token beginToken = getFirstToken(); | 192 Token beginToken = getFirstToken(); |
| 193 Script script = getScript(); | 193 Script script = getScript(); |
| 194 SourceSpan span; | 194 SourceSpan span; |
| 195 if (beginToken == null) { | 195 if (beginToken == null) { |
| 196 span = new SourceSpan(script.readableUri, 0, 0); | 196 span = new SourceSpan(script.resourceUri, 0, 0); |
| 197 } else { | 197 } else { |
| 198 Token endToken = getEndToken(); | 198 Token endToken = getEndToken(); |
| 199 span = mirrorSystem.compiler.spanFromTokens( | 199 span = mirrorSystem.compiler.spanFromTokens( |
| 200 beginToken, endToken, script.readableUri); | 200 beginToken, endToken, script.resourceUri); |
| 201 } | 201 } |
| 202 return new Dart2JsSourceLocation(script, span); | 202 return new Dart2JsSourceLocation(script, span); |
| 203 } | 203 } |
| 204 | 204 |
| 205 String toString() => _element.toString(); | 205 String toString() => _element.toString(); |
| 206 | 206 |
| 207 void _appendCommentTokens(Token commentToken) { | 207 void _appendCommentTokens(Token commentToken) { |
| 208 while (commentToken != null && commentToken.kind == COMMENT_TOKEN) { | 208 while (commentToken != null && commentToken.kind == COMMENT_TOKEN) { |
| 209 _metadata.add(new Dart2JsCommentInstanceMirror( | 209 _metadata.add(new Dart2JsCommentInstanceMirror( |
| 210 mirrorSystem, commentToken.value)); | 210 mirrorSystem, commentToken.value)); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 if (!parameter.hasDefaultValue) return null; | 474 if (!parameter.hasDefaultValue) return null; |
| 475 ParameterElement parameterElement = parameter._element; | 475 ParameterElement parameterElement = parameter._element; |
| 476 Compiler compiler = parameter.mirrorSystem.compiler; | 476 Compiler compiler = parameter.mirrorSystem.compiler; |
| 477 return compiler.constants.getConstantForVariable(parameterElement); | 477 return compiler.constants.getConstantForVariable(parameterElement); |
| 478 } | 478 } |
| 479 | 479 |
| 480 static Mirror getMirrorFromElement(Dart2JsMirror mirror, Element element) { | 480 static Mirror getMirrorFromElement(Dart2JsMirror mirror, Element element) { |
| 481 return _convertElementToDeclarationMirror(mirror.mirrorSystem, element); | 481 return _convertElementToDeclarationMirror(mirror.mirrorSystem, element); |
| 482 } | 482 } |
| 483 } | 483 } |
| OLD | NEW |