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

Unified Diff: compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java

Issue 10704180: Use 'int' instead of Position. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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: compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java
diff --git a/compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java b/compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java
index b2e64489620006f16a564278a0e8b1123ae3a24c..da19d551e4459792ebc191f74e9abda278c2616c 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartScannerParserContext.java
@@ -26,7 +26,7 @@ import java.util.Stack;
class DartScannerParserContext implements ParserContext {
private DartScanner scanner;
private Deque<DartScanner.State> stateStack = new ArrayDeque<DartScanner.State>();
- private Deque<DartScanner.Position> positionStack = new ArrayDeque<DartScanner.Position>();
+ private Deque<Integer> positionStack = new ArrayDeque<Integer>();
private Source source;
private DartCompilerListener listener;
private final CompilerMetrics compilerMetrics;
@@ -50,14 +50,14 @@ class DartScannerParserContext implements ParserContext {
positionStack.push(getBeginLocation(0));
}
- private DartScanner.Position getBeginLocation(int n) {
+ private int getBeginLocation(int n) {
DartScanner.Location tokenLocation = scanner.peekTokenLocation(n);
- return tokenLocation != null ? tokenLocation.getBegin() : new DartScanner.Position(0, 1, 1);
+ return tokenLocation != null ? tokenLocation.getBegin() : 0;
}
- private DartScanner.Position getEndLocation() {
+ private int getEndLocation() {
DartScanner.Location tokenLocation = scanner.getTokenLocation();
- return tokenLocation != null ? tokenLocation.getEnd() : new DartScanner.Position(0, 1, 1);
+ return tokenLocation != null ? tokenLocation.getEnd() : 0;
}
@Override
@@ -80,7 +80,7 @@ class DartScannerParserContext implements ParserContext {
if (result instanceof DartUnit) {
if (compilerMetrics != null) {
compilerMetrics.unitParsed(scanner.getCharCount(), scanner.getNonCommentCharCount(),
- scanner.getLineCount(), scanner.getNonCommentLineCount());
+ 0, 0);
}
}
@@ -95,11 +95,11 @@ class DartScannerParserContext implements ParserContext {
* @param result
* @param startPos
*/
- private <T> void setSourcePosition(T result, DartScanner.Position startPos) {
+ private <T> void setSourcePosition(T result, int startPos) {
if (result instanceof HasSourceInfoSetter) {
HasSourceInfoSetter hasSourceInfoSetter = (HasSourceInfoSetter) result;
- int start = startPos.getPos();
- int end = getEndLocation().getPos();
+ int start = startPos;
+ int end = getEndLocation();
if (start != -1 && end < start) {
// handle 0-length tokens, including where there is trailing whitespace
end = start;

Powered by Google App Engine
This is Rietveld 408576698