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

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

Issue 1935933002: Fix source information positions for deserialized patched elements. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes 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 | « pkg/compiler/lib/src/elements/modelx.dart ('k') | 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 3b01a6fe4140bc01e220ed593568894081b664b3..321943fd95426f92aca46a66a2abc7c2e7ddc37c 100644
--- a/pkg/compiler/lib/src/io/position_information.dart
+++ b/pkg/compiler/lib/src/io/position_information.dart
@@ -101,8 +101,8 @@ class PositionSourceInformationStrategy
const PositionSourceInformationStrategy();
@override
- SourceInformationBuilder createBuilderForContext(AstElement element) {
- return new PositionSourceInformationBuilder(element);
+ SourceInformationBuilder createBuilderForContext(ResolvedAst resolvedAst) {
+ return new PositionSourceInformationBuilder(resolvedAst);
}
@override
@@ -141,12 +141,12 @@ class SourceMappedMarker extends SourceInformation {
class PositionSourceInformationBuilder implements SourceInformationBuilder {
final SourceFile sourceFile;
final String name;
- final AstElement element;
+ final ResolvedAst resolvedAst;
- PositionSourceInformationBuilder(AstElement element)
- : this.element = element,
- sourceFile = element.implementation.compilationUnit.script.file,
- name = computeElementNameForSourceMaps(element);
+ PositionSourceInformationBuilder(ResolvedAst resolvedAst)
+ : this.resolvedAst = resolvedAst,
+ sourceFile = computeSourceFile(resolvedAst),
+ name = computeElementNameForSourceMaps(resolvedAst.element);
SourceInformation buildDeclaration(ResolvedAst resolvedAst) {
if (resolvedAst.kind != ResolvedAstKind.PARSED) {
@@ -238,15 +238,10 @@ class PositionSourceInformationBuilder implements SourceInformationBuilder {
@override
SourceInformation buildVariableDeclaration() {
- if (element.hasNode) {
- Node node = element.node;
- if (node is FunctionExpression) {
- return buildBegin(node.body);
- } else if (element.isField) {
- FieldElement field = element;
- if (field.initializer != null) {
- return buildBegin(field.initializer);
- }
+ if (resolvedAst.kind == ResolvedAstKind.PARSED) {
+ Node body = resolvedAst.body;
+ if (body != null) {
+ return buildBegin(body);
}
// TODO(johnniwinther): Are there other cases?
}
@@ -254,8 +249,8 @@ class PositionSourceInformationBuilder implements SourceInformationBuilder {
}
@override
- SourceInformationBuilder forContext(AstElement element) {
- return new PositionSourceInformationBuilder(element);
+ SourceInformationBuilder forContext(ResolvedAst resolvedAst) {
+ return new PositionSourceInformationBuilder(resolvedAst);
}
@override
« no previous file with comments | « pkg/compiler/lib/src/elements/modelx.dart ('k') | pkg/compiler/lib/src/io/source_information.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698