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

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 2435013003: Teach analyzer parser to handle native const factories/const constructors. (Closed)
Patch Set: add a test Created 4 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index 7e913103634855449dd58c091f34a7a6a2990b6f..b12d26f888fc2c56a0fffacfc3ca62cc08bd5c93 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -6252,7 +6252,8 @@ class Parser {
parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, false);
if (constKeyword != null &&
factoryKeyword != null &&
- externalKeyword == null) {
+ externalKeyword == null &&
+ body is! NativeFunctionBody) {
_reportErrorForToken(ParserErrorCode.CONST_FACTORY, factoryKeyword);
} else if (body is EmptyFunctionBody) {
if (factoryKeyword != null &&
@@ -6262,7 +6263,7 @@ class Parser {
ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword);
}
} else {
- if (constKeyword != null) {
+ if (constKeyword != null && body is! NativeFunctionBody) {
_reportErrorForNode(
ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body);
} else if (externalKeyword != null) {
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698