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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java

Issue 17570003: Report ParserErrorCode.STATIC_FUNCTION_DECLARATION (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Check all modifiers Created 7 years, 6 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 | editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/ParserErrorCode.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
index 001de940344aa08579c56cd88a2d71f253c69358..ba3cd83792d81234a530eb0f86e1af975921b10e 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
@@ -3132,6 +3132,8 @@ public class Parser {
* @return the function declaration statement that was parsed
*/
private Statement parseFunctionDeclarationStatement() {
+ Modifiers modifiers = parseModifiers();
+ validateModifiersForFunctionDeclarationStatement(modifiers);
return parseFunctionDeclarationStatement(parseCommentAndMetadata(), parseOptionalReturnType());
}
@@ -6085,6 +6087,20 @@ public class Parser {
}
/**
+ * Validate that the given set of modifiers is appropriate for a local function.
+ *
+ * @param modifiers the modifiers being validated
+ */
+ private void validateModifiersForFunctionDeclarationStatement(Modifiers modifiers) {
+ if (modifiers.getAbstractKeyword() != null || modifiers.getConstKeyword() != null
+ || modifiers.getExternalKeyword() != null || modifiers.getFactoryKeyword() != null
+ || modifiers.getFinalKeyword() != null || modifiers.getStaticKeyword() != null
+ || modifiers.getVarKeyword() != null) {
+ reportError(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER);
+ }
+ }
+
+ /**
* Validate that the given set of modifiers is appropriate for a getter, setter, or method.
*
* @param modifiers the modifiers being validated
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/ParserErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698