Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: pkg/compiler/lib/src/io/position_information.dart

Issue 1902363002: Derive source information from ResolvedAst. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/io/source_information.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/io/position_information.dart
diff --git a/pkg/compiler/lib/src/io/position_information.dart b/pkg/compiler/lib/src/io/position_information.dart
index e64d1448e115ac232b3e3d489d4a78ee7dbe065f..38df2215a7153fff167a3b3e4e9c5f53920c5d50 100644
--- a/pkg/compiler/lib/src/io/position_information.dart
+++ b/pkg/compiler/lib/src/io/position_information.dart
@@ -8,7 +8,7 @@
library dart2js.source_information.position;
import '../common.dart';
-import '../elements/elements.dart' show AstElement, FieldElement;
+import '../elements/elements.dart' show AstElement, FieldElement, ResolvedAst, ResolvedAstKind;
import '../js/js.dart' as js;
import '../js/js_debug.dart';
import '../js/js_source_mapping.dart';
@@ -147,16 +147,17 @@ class PositionSourceInformationBuilder implements SourceInformationBuilder {
sourceFile = element.implementation.compilationUnit.script.file,
name = computeElementNameForSourceMaps(element);
- SourceInformation buildDeclaration(AstElement element) {
- if (element.isSynthesized) {
+ SourceInformation buildDeclaration(ResolvedAst resolvedAst) {
+ if (resolvedAst.kind != ResolvedAstKind.PARSED) {
+ SourceSpan span = resolvedAst.element.sourcePosition;
return new PositionSourceInformation(new OffsetSourceLocation(
- sourceFile, element.position.charOffset, name));
+ sourceFile, span.begin, name));
} else {
return new PositionSourceInformation(
new OffsetSourceLocation(sourceFile,
- element.resolvedAst.node.getBeginToken().charOffset, name),
+ resolvedAst.node.getBeginToken().charOffset, name),
new OffsetSourceLocation(sourceFile,
- element.resolvedAst.node.getEndToken().charOffset, name));
+ resolvedAst.node.getEndToken().charOffset, name));
}
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/io/source_information.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698