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

Unified Diff: pkg/kernel/lib/analyzer/loader.dart

Issue 2587673004: Include source in kernel. (Closed)
Patch Set: Updated kernels binary.md too. Created 4 years 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
Index: pkg/kernel/lib/analyzer/loader.dart
diff --git a/pkg/kernel/lib/analyzer/loader.dart b/pkg/kernel/lib/analyzer/loader.dart
index 4fb962ee485781f16b56395112489e0870b018f0..e8cd54899a36848773562d8afc16716939660a2e 100644
--- a/pkg/kernel/lib/analyzer/loader.dart
+++ b/pkg/kernel/lib/analyzer/loader.dart
@@ -332,7 +332,8 @@ class DartLoader implements ReferenceLevelLoader {
isAbstract: true,
typeParameters: freshParameters.freshTypeParameters,
supertype: freshParameters.substituteSuper(supertype),
- mixedInType: freshParameters.substituteSuper(mixinType));
+ mixedInType: freshParameters.substituteSuper(mixinType),
+ fileUri: "file://${element.source.fullName}");
Kevin Millikin (Google) 2016/12/20 12:03:33 fileUri: classNode.fileUri
jensj 2016/12/20 13:30:22 Done.
mixinClass.level = ast.ClassLevel.Type;
supertype = new ast.Supertype(mixinClass,
classNode.typeParameters.map(makeTypeParameterType).toList());
@@ -586,7 +587,7 @@ class DartLoader implements ReferenceLevelLoader {
typeParameters: fresh.freshTypeParameters,
supertype: new ast.Supertype(superclass, superArgs),
mixedInType: new ast.Supertype(mixedInClass, mixinArgs),
- fileUri: mixedInClass.fileUri);
+ fileUri: library.fileUri);
result.level = ast.ClassLevel.Type;
library.addClass(result);
return result;
@@ -694,9 +695,16 @@ class DartLoader implements ReferenceLevelLoader {
in libraryElement.units) {
var source = compilationUnitElement.source;
LineInfo lineInfo = context.computeLineInfo(source);
- program.uriToLineStarts["file://${source.fullName}"] =
- new List<int>.generate(lineInfo.lineCount, lineInfo.getOffsetOfLine,
- growable: false);
+ String sourceCode = "";
+ try {
+ sourceCode = source.contents.data;
Kevin Millikin (Google) 2016/12/20 12:03:33 I think context.getContents(source) will use the a
jensj 2016/12/20 13:30:22 Done.
+ } catch (e) {
+ // if we cannot read the source code there's nothing to do about that.
Kevin Millikin (Google) 2016/12/20 12:03:33 The comment should be a complete sentence (start w
jensj 2016/12/20 13:30:22 Done.
+ }
+ program.uriToLineStartsAndSource["file://${source.fullName}"] =
Kevin Millikin (Google) 2016/12/20 12:03:33 We should probably use source.uri instead of sourc
jensj 2016/12/20 13:30:22 Done.
+ new ast.LineStartsAndSource(
+ new List<int>.from(lineInfo.lineStarts, growable: false),
Kevin Millikin (Google) 2016/12/20 12:03:33 lineInfo.lineStarts is already a List<int>, isn't
jensj 2016/12/20 13:30:22 Yes.
+ sourceCode);
}
}
return program;
« no previous file with comments | « pkg/kernel/binary.md ('k') | pkg/kernel/lib/ast.dart » ('j') | pkg/kernel/lib/ast.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698