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

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

Issue 9949016: Adds fixes for the 'super' keyword used by itself in certain situations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed ResolverErrorCode Created 8 years, 8 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 | « no previous file | compiler/java/com/google/dart/compiler/parser/DartParser.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/parser/AbstractParser.java
diff --git a/compiler/java/com/google/dart/compiler/parser/AbstractParser.java b/compiler/java/com/google/dart/compiler/parser/AbstractParser.java
index 8889e15367dbeb82bcb8373f55e343d92c5310cf..759b19bb5b79b1fcfc2d2b2418a12eddedac43bb 100644
--- a/compiler/java/com/google/dart/compiler/parser/AbstractParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/AbstractParser.java
@@ -6,6 +6,7 @@ package com.google.dart.compiler.parser;
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.ErrorCode;
+import com.google.dart.compiler.parser.DartScanner.Location;
/**
* Abstract base class for sharing common utility methods between implementation
@@ -108,6 +109,23 @@ abstract class AbstractParser {
lastErrorPosition = position.getPos();
ctx.error(dartError);
}
+
+ /**
+ * Even though you pass a 'Position' to {@link #reportError} above, it only uses that to
+ * prevent logging more than one error at that position. This method actually uses the passed
+ * position to create the error event.
+ */
+ protected void reportErrorAtPosition(DartScanner.Position startPosition,
+ DartScanner.Position endPosition,
+ ErrorCode errorCode, Object... arguments) {
+ DartScanner.Location location = ctx.getTokenLocation();
+ if (location.getBegin().getPos() <= lastErrorPosition) {
+ return;
+ }
+ DartCompilationError dartError = new DartCompilationError(ctx.getSource(),
+ new Location(startPosition, endPosition), errorCode, arguments);
+ ctx.error(dartError);
+ }
protected void reportUnexpectedToken(DartScanner.Position position, Token expected,
Token actual) {
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/parser/DartParser.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698