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

Unified Diff: pkg/compiler/lib/src/serialization/modelz.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 | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/serialization/modelz.dart
diff --git a/pkg/compiler/lib/src/serialization/modelz.dart b/pkg/compiler/lib/src/serialization/modelz.dart
index 9c346d935b83634ea20b720211b4d32fdf090881..5122259100326e649db3b1641d2f2b4057c7bfba 100644
--- a/pkg/compiler/lib/src/serialization/modelz.dart
+++ b/pkg/compiler/lib/src/serialization/modelz.dart
@@ -83,7 +83,7 @@ abstract class ElementZ extends Element with ElementCommon {
bool get isClassMember => false;
@override
- bool get isClosure => _unsupported('isClosure');
+ bool get isClosure => false;
@override
bool get isConst => _unsupported('isConst');
@@ -476,6 +476,7 @@ class LibraryElementZ extends DeserializedElementZ
class ScriptZ implements Script {
final Uri resourceUri;
+ SourceFile _file;
ScriptZ(this.resourceUri);
@@ -485,13 +486,27 @@ class ScriptZ implements Script {
}
@override
- SourceFile get file => throw new UnsupportedError('ScriptZ.file');
+ SourceFile get file {
+ if (_file == null) {
+ throw new UnsupportedError('ScriptZ.file');
+ }
+ return _file;
+ }
+
+ void set file(SourceFile value) {
+ _file = value;
+ }
@override
bool get isSynthesized => throw new UnsupportedError('ScriptZ.isSynthesized');
@override
- String get name => resourceUri.toString();
+ String get name {
+ if (_file != null) {
+ return _file.filename;
+ }
+ return resourceUri.toString();
+ }
// TODO(johnniwinther): Support the distinction between [readableUri] and
// [resourceUri]; needed for platform libraries.
@@ -499,7 +514,12 @@ class ScriptZ implements Script {
Uri get readableUri => resourceUri;
@override
- String get text => throw new UnsupportedError('ScriptZ.text');
+ String get text {
+ if (_file != null) {
+ return _file.slowText();
+ }
+ throw new UnsupportedError('ScriptZ.text');
+ }
}
class CompilationUnitElementZ extends DeserializedElementZ
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698