| Index: compiler/java/com/google/dart/compiler/common/AbstractNode.java
|
| diff --git a/compiler/java/com/google/dart/compiler/common/AbstractNode.java b/compiler/java/com/google/dart/compiler/common/AbstractNode.java
|
| index b423232774740c04c709da55b5964014da05c913..16d1c8b6da5f4f05b4609b817c06d93cb9ea7c14 100644
|
| --- a/compiler/java/com/google/dart/compiler/common/AbstractNode.java
|
| +++ b/compiler/java/com/google/dart/compiler/common/AbstractNode.java
|
| @@ -4,79 +4,20 @@
|
|
|
| package com.google.dart.compiler.common;
|
|
|
| -import com.google.common.base.Preconditions;
|
| -import com.google.dart.compiler.Source;
|
| -
|
| /**
|
| * Abstract base class for nodes that carry source information.
|
| */
|
| -public class AbstractNode implements SourceInfo, HasSourceInfo {
|
| -
|
| - // TODO(johnlenz): All this source location data is wasteful.
|
| - // Move it into a common object, that can be shared between the ASTs
|
| - // or something.
|
| - protected Source source = null;
|
| - protected int sourceLine = -1;
|
| - protected int sourceColumn = -1;
|
| - protected int sourceStart = -1;
|
| - protected int sourceLength = -1;
|
| -
|
| - @Override
|
| - public Source getSource() {
|
| - return source;
|
| - }
|
| -
|
| - @Override
|
| - public int getSourceLine() {
|
| - return sourceLine;
|
| - }
|
| -
|
| - @Override
|
| - public int getSourceColumn() {
|
| - return sourceColumn;
|
| - }
|
| +public class AbstractNode implements HasSourceInfo {
|
|
|
| - @Override
|
| - public int getSourceStart() {
|
| - return sourceStart;
|
| - }
|
| -
|
| - @Override
|
| - public int getSourceLength() {
|
| - return sourceLength;
|
| - }
|
| + private SourceInfo sourceInfo = SourceInfo.UNKNOWN;
|
|
|
| @Override
|
| public SourceInfo getSourceInfo() {
|
| - return this;
|
| + return sourceInfo;
|
| }
|
|
|
| @Override
|
| public void setSourceInfo(SourceInfo info) {
|
| - source = info.getSource();
|
| - sourceStart = info.getSourceStart();
|
| - sourceLength = info.getSourceLength();
|
| - sourceLine = info.getSourceLine();
|
| - sourceColumn = info.getSourceColumn();
|
| + sourceInfo = info;
|
| }
|
| -
|
| - @Override
|
| - public final void setSourceLocation(
|
| - Source source, int line, int column, int startPosition, int length) {
|
| - Preconditions.checkArgument(startPosition != -1 && length >= 0
|
| - || startPosition == -1 && length == 0);
|
| - this.source = source;
|
| - this.sourceLine = line;
|
| - this.sourceColumn = column;
|
| - this.sourceStart = startPosition;
|
| - this.sourceLength = length;
|
| - }
|
| -
|
| - public final void setSourceRange(int startPosition, int length) {
|
| - Preconditions.checkArgument(startPosition != -1 && length >= 0
|
| - || startPosition == -1 && length == 0);
|
| - this.sourceStart = startPosition;
|
| - this.sourceLength = length;
|
| - }
|
| -
|
| }
|
|
|