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

Unified Diff: runtime/vm/parser.cc

Issue 2973153002: [VM Parser] Fix parsing of new function type syntax. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | tests/language/regress_30092_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 0ab4794097cc27b1c13f368ede8b8f774cffaa8e..bd6eec9734317bf05ff31c53df9acc3f6d5f20bc 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -2151,7 +2151,7 @@ void Parser::ParseFormalParameter(bool allow_explicit_default_value,
// of ParseFormalParameter.
parameter.type = &Object::void_type();
}
- if (parameter.type == NULL) {
+ if ((parameter.type == NULL) || IsFunctionTypeSymbol()) {
// At this point, we must see an identifier for the type or the
// function parameter. The identifier may be 'Function'.
if (!IsIdentifier()) {
@@ -2176,8 +2176,14 @@ void Parser::ParseFormalParameter(bool allow_explicit_default_value,
parameter.has_explicit_type = true;
// It is too early to resolve the type here, since it can be a result
// type referring to a not yet declared function type parameter.
- parameter.type = &AbstractType::ZoneHandle(
- Z, ParseTypeOrFunctionType(true, ClassFinalizer::kDoNotResolve));
+ if (parameter.type == NULL) {
+ parameter.type = &AbstractType::ZoneHandle(
+ Z, ParseTypeOrFunctionType(true, ClassFinalizer::kDoNotResolve));
+ } else {
+ parameter.type = &AbstractType::ZoneHandle(
+ Z,
+ ParseFunctionType(*parameter.type, ClassFinalizer::kDoNotResolve));
+ }
} else {
// If this is an initializing formal, its type will be set to the type
// of the respective field when the constructor is fully parsed.
« no previous file with comments | « no previous file | tests/language/regress_30092_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698