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

Unified Diff: pkg/compiler/lib/src/io/start_end_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/io/source_information.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/io/start_end_information.dart
diff --git a/pkg/compiler/lib/src/io/start_end_information.dart b/pkg/compiler/lib/src/io/start_end_information.dart
index ccc4d6b4bfb3866dc0aaa10d77e7d9d1342db881..1734aa929489f03a4cf4ddf37fadfdcbcd6e2e3c 100644
--- a/pkg/compiler/lib/src/io/start_end_information.dart
+++ b/pkg/compiler/lib/src/io/start_end_information.dart
@@ -63,16 +63,13 @@ class StartEndSourceInformation extends SourceInformation {
static StartEndSourceInformation _computeSourceInformation(
ResolvedAst resolvedAst) {
String name = computeElementNameForSourceMaps(resolvedAst.element);
- SourceFile sourceFile;
+ SourceFile sourceFile = computeSourceFile(resolvedAst);
int begin;
int end;
if (resolvedAst.kind != ResolvedAstKind.PARSED) {
// Synthesized node. Use the enclosing element for the location.
- sourceFile = resolvedAst.element.compilationUnit.script.file;
begin = end = resolvedAst.element.sourcePosition.begin;
} else {
- AstElement implementation = resolvedAst.element.implementation;
- sourceFile = implementation.compilationUnit.script.file;
Node node = resolvedAst.node;
begin = node.getBeginToken().charOffset;
end = node.getEndToken().charOffset;
@@ -116,8 +113,8 @@ class StartEndSourceInformationStrategy
const StartEndSourceInformationStrategy();
@override
- SourceInformationBuilder createBuilderForContext(AstElement element) {
- return new StartEndSourceInformationBuilder(element);
+ SourceInformationBuilder createBuilderForContext(ResolvedAst resolvedAst) {
+ return new StartEndSourceInformationBuilder(resolvedAst);
}
@override
@@ -158,9 +155,9 @@ class StartEndSourceInformationBuilder extends SourceInformationBuilder {
final SourceFile sourceFile;
final String name;
- StartEndSourceInformationBuilder(AstElement element)
- : sourceFile = element.compilationUnit.script.file,
- name = computeElementNameForSourceMaps(element);
+ StartEndSourceInformationBuilder(ResolvedAst resolvedAst)
+ : sourceFile = computeSourceFile(resolvedAst),
+ name = computeElementNameForSourceMaps(resolvedAst.element);
SourceInformation buildDeclaration(ResolvedAst resolvedAst) {
return StartEndSourceInformation._computeSourceInformation(resolvedAst);
@@ -219,8 +216,8 @@ class StartEndSourceInformationBuilder extends SourceInformationBuilder {
SourceInformation buildIf(Node node) => buildGeneric(node);
@override
- SourceInformationBuilder forContext(AstElement element,
+ SourceInformationBuilder forContext(ResolvedAst resolvedAst,
{SourceInformation sourceInformation}) {
- return new StartEndSourceInformationBuilder(element);
+ return new StartEndSourceInformationBuilder(resolvedAst);
}
}
« no previous file with comments | « pkg/compiler/lib/src/io/source_information.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698