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

Unified Diff: lib/src/js/nodes.dart

Issue 965033002: add source maps support, fixes #50 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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
Index: lib/src/js/nodes.dart
diff --git a/lib/src/js/nodes.dart b/lib/src/js/nodes.dart
index bac9b1a7132bb413ff347c818ff8c19732cf2fb8..6b574039a77dcffb1589a2f557fb18cb054ec280 100644
--- a/lib/src/js/nodes.dart
+++ b/lib/src/js/nodes.dart
@@ -203,14 +203,10 @@ class BaseVisitor<T> implements NodeVisitor<T> {
T visitDartYield(DartYield node) => visitStatement(node);
}
-/// This tag interface has no behaviour but must be implemented by any class
-/// that is to be stored on a [Node] as source information.
-abstract class JavaScriptNodeSourceInformation {}
-
abstract class Node {
- JavaScriptNodeSourceInformation get sourceInformation => _sourceInformation;
-
- JavaScriptNodeSourceInformation _sourceInformation;
+ /// Sets the source location of this node. For performance reasons, we allow
+ /// setting this after construction.
+ Object sourceInformation;
accept(NodeVisitor visitor);
void visitChildren(NodeVisitor visitor);
@@ -221,15 +217,14 @@ abstract class Node {
// Returns a node equivalent to [this], but with new source position and end
// source position.
- Node withSourceInformation(
- JavaScriptNodeSourceInformation sourceInformation) {
- if (sourceInformation == _sourceInformation) {
+ Node withSourceInformation(sourceInformation) {
+ if (sourceInformation == this.sourceInformation) {
return this;
}
Node clone = _clone();
// TODO(sra): Should existing data be 'sticky' if we try to overwrite with
// `null`?
- clone._sourceInformation = sourceInformation;
+ clone.sourceInformation = sourceInformation;
return clone;
}

Powered by Google App Engine
This is Rietveld 408576698