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

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

Issue 893963005: Refactor handling of source map information. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. 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
« no previous file with comments | « pkg/compiler/lib/src/js/js.dart ('k') | pkg/compiler/lib/src/js/printer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js/nodes.dart
diff --git a/pkg/compiler/lib/src/js/nodes.dart b/pkg/compiler/lib/src/js/nodes.dart
index e5b57f6351593fa734602e297c1558ad28d9ecd0..3a4eb9777c3542a2d5834615307d3d97621b6908 100644
--- a/pkg/compiler/lib/src/js/nodes.dart
+++ b/pkg/compiler/lib/src/js/nodes.dart
@@ -172,11 +172,9 @@ class BaseVisitor<T> implements NodeVisitor<T> {
}
abstract class Node {
- get sourcePosition => _sourcePosition;
- get endSourcePosition => _endSourcePosition;
+ SourceInformation get sourceInformation => _sourceInformation;
- var _sourcePosition;
- var _endSourcePosition;
+ SourceInformation _sourceInformation;
accept(NodeVisitor visitor);
void visitChildren(NodeVisitor visitor);
@@ -187,24 +185,17 @@ abstract class Node {
// Returns a node equivalent to [this], but with new source position and end
// source position.
- Node withPosition(var sourcePosition, var endSourcePosition) {
- if (sourcePosition == _sourcePosition &&
- endSourcePosition == _endSourcePosition) {
+ Node withSourceInformation(SourceInformation sourceInformation) {
+ if (sourceInformation == _sourceInformation) {
return this;
}
Node clone = _clone();
// TODO(sra): Should existing data be 'sticky' if we try to overwrite with
// `null`?
- clone._sourcePosition = sourcePosition;
- clone._endSourcePosition = endSourcePosition;
+ clone._sourceInformation = sourceInformation;
return clone;
}
- // Returns a node equivalent to [this], but with new [this.sourcePositions],
- // keeping the existing [endPosition]
- Node withLocation(var sourcePosition) =>
- withPosition(sourcePosition, this.endSourcePosition);
-
VariableUse asVariableUse() => null;
bool get isCommaOperator => false;
@@ -227,9 +218,6 @@ class Program extends Node {
abstract class Statement extends Node {
Statement toStatement() => this;
-
- Statement withPosition(var sourcePosition, var endSourcePosition) =>
- super.withPosition(sourcePosition, endSourcePosition);
}
class Block extends Statement {
@@ -536,9 +524,6 @@ abstract class Expression extends Node {
int get precedenceLevel;
Statement toStatement() => new ExpressionStatement(this);
-
- Expression withPosition(var sourcePosition, var endSourcePosition) =>
- super.withPosition(sourcePosition, endSourcePosition);
}
/// Wrap a CodeBuffer as an expression.
« no previous file with comments | « pkg/compiler/lib/src/js/js.dart ('k') | pkg/compiler/lib/src/js/printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698