Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 167ea1ea98c23ff637ae53577500ee1c9c714eac..b2a722a1d85561d9560c7a5bedf99524e85d25cc 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -12886,7 +12886,8 @@ AstNode* Parser::ResolveIdent(TokenPosition ident_pos, |
if ((resolved == NULL) || (resolved_func_level < type_param_func_level)) { |
// The identifier is a function type parameter, possibly shadowing |
// 'resolved'. |
- if (type_param_func_level < FunctionLevel()) { |
+ if ((FunctionLevel() > 0) && |
+ (type_param_func_level < FunctionLevel())) { |
// Make sure that the function instantiator is captured. |
CaptureFunctionInstantiator(); |
} |
@@ -14360,7 +14361,8 @@ AstNode* Parser::ParsePrimary() { |
(primary_func_level < type_param_func_level)) { |
// The identifier is a function type parameter, possibly shadowing |
// already resolved 'primary'. |
- if (type_param_func_level < FunctionLevel()) { |
+ if ((FunctionLevel() > 0) && |
+ (type_param_func_level < FunctionLevel())) { |
// Make sure that the function instantiator is captured. |
CaptureFunctionInstantiator(); |
} |