| Index: compiler/java/com/google/dart/compiler/parser/DartScanner.java
|
| ===================================================================
|
| --- compiler/java/com/google/dart/compiler/parser/DartScanner.java (revision 4065)
|
| +++ compiler/java/com/google/dart/compiler/parser/DartScanner.java (working copy)
|
| @@ -21,7 +21,7 @@
|
| * Represents a position in a source file, including absolute character position,
|
| * line, and column.
|
| */
|
| - public static class Position implements Cloneable {
|
| + public static class Position {
|
| private int pos;
|
| private int line;
|
| private int col;
|
| @@ -32,13 +32,8 @@
|
| this.col = col;
|
| }
|
|
|
| - @Override
|
| - public Position clone() {
|
| - try {
|
| - return (Position) super.clone();
|
| - } catch (CloneNotSupportedException e) {
|
| - throw new AssertionError(e);
|
| - }
|
| + public Position copy() {
|
| + return new Position(pos, line, col);
|
| }
|
|
|
| public int getPos() {
|
| @@ -80,7 +75,7 @@
|
| /**
|
| * Represents a span of characters in a source file.
|
| */
|
| - public static class Location implements Cloneable {
|
| + public static class Location {
|
| public static final Location NONE = null;
|
| private Position begin, end;
|
|
|
| @@ -93,18 +88,6 @@
|
| this.begin = this.end = begin;
|
| }
|
|
|
| - @Override
|
| - public Location clone() {
|
| - try {
|
| - Location clone = (Location) super.clone();
|
| - clone.begin = begin.clone();
|
| - clone.end = end.clone();
|
| - return clone;
|
| - } catch (CloneNotSupportedException e) {
|
| - throw new AssertionError(e);
|
| - }
|
| - }
|
| -
|
| public Position getBegin() {
|
| return begin;
|
| }
|
| @@ -414,23 +397,12 @@
|
| }
|
| }
|
|
|
| - private static class TokenData implements Cloneable {
|
| + private static class TokenData {
|
| Token token;
|
| Location location;
|
| String value;
|
|
|
| @Override
|
| - protected TokenData clone() {
|
| - try {
|
| - TokenData clone = (TokenData) super.clone();
|
| - clone.location = location == null ? null : location.clone();
|
| - return clone;
|
| - } catch (CloneNotSupportedException e) {
|
| - throw new AssertionError(e);
|
| - }
|
| - }
|
| -
|
| - @Override
|
| public String toString() {
|
| String str = token.toString();
|
| return (value != null) ? str + "(" + value + ")" : str;
|
| @@ -684,12 +656,12 @@
|
| private void advance() {
|
| for (int i = 0; i < NUM_LOOKAHEAD - 1; ++i) {
|
| internalState.lookahead[i] = internalState.lookahead[i + 1];
|
| - internalState.lookaheadPos[i] = internalState.lookaheadPos[i + 1].clone();
|
| + internalState.lookaheadPos[i] = internalState.lookaheadPos[i + 1].copy();
|
| }
|
| if (internalState.nextLookaheadPos.pos < source.length()) {
|
| int ch = source.codePointAt(internalState.nextLookaheadPos.pos);
|
| internalState.lookahead[NUM_LOOKAHEAD - 1] = ch;
|
| - internalState.lookaheadPos[NUM_LOOKAHEAD - 1] = internalState.nextLookaheadPos.clone();
|
| + internalState.lookaheadPos[NUM_LOOKAHEAD - 1] = internalState.nextLookaheadPos.copy();
|
| internalState.nextLookaheadPos.advance(ch == '\n');
|
| } else {
|
| // Let the last look-ahead position be past the source. This makes
|
|
|