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

Side by Side Diff: lib/kernel_visitor.dart

Issue 2055213002: Fix crash on mandatory parameters with initializers. (Closed) Base URL: git@github.com:dart-lang/rasta.git@for_in
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/kernel/regression/mandatory_parameter_initializer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library rasta.kernel_visitor; 5 library rasta.kernel_visitor;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 8
9 import 'package:kernel/accessors.dart' show 9 import 'package:kernel/accessors.dart' show
10 Accessor, 10 Accessor,
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 requiredParameterCount = signature.requiredParameterCount; 2077 requiredParameterCount = signature.requiredParameterCount;
2078 signature.forEachParameter((ParameterElement parameter) { 2078 signature.forEachParameter((ParameterElement parameter) {
2079 ir.VariableDeclaration variable = getLocal(parameter); 2079 ir.VariableDeclaration variable = getLocal(parameter);
2080 if (parameter.isNamed) { 2080 if (parameter.isNamed) {
2081 namedParameters.add(variable); 2081 namedParameters.add(variable);
2082 } else { 2082 } else {
2083 positionalParameters.add(variable); 2083 positionalParameters.add(variable);
2084 } 2084 }
2085 }); 2085 });
2086 signature.forEachParameter((ParameterElement parameter) { 2086 signature.forEachParameter((ParameterElement parameter) {
2087 if (!parameter.isOptional) return;
2087 ir.Expression initializer = parameter.initializer?.accept(this); 2088 ir.Expression initializer = parameter.initializer?.accept(this);
2088 ir.VariableDeclaration variable = getLocal(parameter); 2089 ir.VariableDeclaration variable = getLocal(parameter);
2089 if (initializer != null) { 2090 if (initializer != null) {
2090 variable.initializer = initializer; 2091 variable.initializer = initializer;
2091 initializer.parent = variable; 2092 initializer.parent = variable;
2092 } 2093 }
2093 }); 2094 });
2094 returnType = typeToIrHack(signature.type.returnType); 2095 returnType = typeToIrHack(signature.type.returnType);
2095 } 2096 }
2096 ir.AsyncMarker asyncMarker = ir.AsyncMarker.Sync; 2097 ir.AsyncMarker asyncMarker = ir.AsyncMarker.Sync;
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 : this(null, true, node, initializers); 3036 : this(null, true, node, initializers);
3036 3037
3037 accept(ir.Visitor v) => throw "unsupported"; 3038 accept(ir.Visitor v) => throw "unsupported";
3038 3039
3039 visitChildren(ir.Visitor v) => throw "unsupported"; 3040 visitChildren(ir.Visitor v) => throw "unsupported";
3040 3041
3041 String toString() { 3042 String toString() {
3042 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 3043 return "IrFunction($kind, $isConstructor, $node, $initializers)";
3043 } 3044 }
3044 } 3045 }
OLDNEW
« no previous file with comments | « no previous file | test/kernel/regression/mandatory_parameter_initializer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698