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

Unified Diff: compiler/java/com/google/dart/compiler/DartCompiler.java

Issue 8348015: Improve location information for some warnings/errors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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/DartCompiler.java
===================================================================
--- compiler/java/com/google/dart/compiler/DartCompiler.java (revision 512)
+++ compiler/java/com/google/dart/compiler/DartCompiler.java (working copy)
@@ -417,7 +417,7 @@
}
}
}
-
+
if (filesHaveChanged) {
context.setFilesHaveChanged();
}
@@ -500,7 +500,7 @@
Tracer.end(logEvent);
}
}
-
+
private void validateLibraryDirectives() {
LibraryUnit appLibUnit = context.getAppLibraryUnit();
for (LibraryUnit lib : libraries.values()) {
@@ -576,7 +576,7 @@
private void setEntryPoint() {
LibraryUnit lib = context.getAppLibraryUnit();
lib.setEntryNode(new LibraryNode(MAIN_ENTRY_POINT_NAME));
- // this ensures that if we find it, it's a top-level static element
+ // this ensures that if we find it, it's a top-level static element
Element element = lib.getElement().lookupLocalElement(MAIN_ENTRY_POINT_NAME);
switch (ElementKind.of(element)) {
case NONE:
@@ -587,13 +587,13 @@
MethodElement methodElement = (MethodElement) element;
Modifiers modifiers = methodElement.getModifiers();
if (modifiers.isGetter()) {
- context.compilationError(new DartCompilationError(Location.NONE,
+ context.compilationError(new DartCompilationError(element.getNode(),
DartCompilerErrorCode.ENTRY_POINT_METHOD_MAY_NOT_BE_GETTER, MAIN_ENTRY_POINT_NAME));
} else if (modifiers.isSetter()) {
- context.compilationError(new DartCompilationError(Location.NONE,
+ context.compilationError(new DartCompilationError(element.getNode(),
DartCompilerErrorCode.ENTRY_POINT_METHOD_MAY_NOT_BE_SETTER, MAIN_ENTRY_POINT_NAME));
} else if (methodElement.getParameters().size() > 0) {
- context.compilationError(new DartCompilationError(Location.NONE,
+ context.compilationError(new DartCompilationError(element.getNode(),
DartCompilerErrorCode.ENTRY_POINT_METHOD_CANNOT_HAVE_PARAMETERS,
MAIN_ENTRY_POINT_NAME));
} else {
@@ -602,7 +602,7 @@
break;
default:
- context.compilationError(new DartCompilationError(Location.NONE,
+ context.compilationError(new DartCompilationError(element.getNode(),
DartCompilerErrorCode.NOT_A_STATIC_METHOD, MAIN_ENTRY_POINT_NAME));
break;
}
@@ -711,7 +711,8 @@
// when generating documentation.
if (context.getApplicationUnit().getEntryNode() == null && !collectComments) {
if (config.expectEntryPoint()) {
- context.compilationError(new DartCompilationError(Location.NONE,
+ context.compilationError(new DartCompilationError(
+ context.getApplicationUnit().getSource(), Location.NONE,
DartCompilerErrorCode.NO_ENTRY_POINT));
}
return;
@@ -1172,7 +1173,7 @@
}
return null;
}
-
+
public static LibraryUnit getCoreLib(LibraryUnit libraryUnit) {
return findLibrary(libraryUnit, "corelib.dart", new HashSet<LibraryElement>());
}

Powered by Google App Engine
This is Rietveld 408576698