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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2899693003: Fix crash with generalized function types in type tests. (Closed)
Patch Set: Created 3 years, 7 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/front_end/testcases/function_type_is_check.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index aa89d12cfa89450018704f0655fc64df2e50de9a..48bd0e053685a86c4fbea8f3a7340298214509bd 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -1477,6 +1477,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
@override
void handleFunctionType(Token functionToken, Token endToken) {
+ debugEvent("FunctionType");
FormalParameters formals = pop();
ignore(Unhandled.TypeVariables);
DartType returnType = pop();
@@ -1590,9 +1591,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
}
}
variable ??= astFactory.variableDeclaration(
- name.name, name.token, functionNestingLevel,
+ name?.name, name?.token, functionNestingLevel,
type: type,
- initializer: name.initializer,
+ initializer: name?.initializer,
isFinal: isFinal,
isConst: isConst);
push(variable);
@@ -1657,7 +1658,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
optional,
beginToken.charOffset);
push(formals);
- if (inCatchClause || functionNestingLevel != 0) {
+ if ((inCatchClause || functionNestingLevel != 0) &&
+ kind != MemberKind.GeneralizedFunctionType) {
enterLocalScope(formals.computeFormalParameterScope(
scope, member ?? classBuilder ?? library));
}
« no previous file with comments | « no previous file | pkg/front_end/testcases/function_type_is_check.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698