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

Unified Diff: pkg/kernel/lib/transformations/closure/mock.dart

Issue 2637083002: Use `List::filled` instead of `List::` in closure conversion (Closed)
Patch Set: Created 3 years, 11 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/kernel/testcases/closures/capture_closure.dart.expect » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/transformations/closure/mock.dart
diff --git a/pkg/kernel/lib/transformations/closure/mock.dart b/pkg/kernel/lib/transformations/closure/mock.dart
index be8847dd177fcb3b406a4c9cf07344af7ff74d43..6f13fca68a7ba6e3cb4d2b28f3a6b6bd32651445 100644
--- a/pkg/kernel/lib/transformations/closure/mock.dart
+++ b/pkg/kernel/lib/transformations/closure/mock.dart
@@ -24,6 +24,7 @@ import '../../ast.dart'
Library,
MethodInvocation,
Name,
+ NullLiteral,
Procedure,
ProcedureKind,
Program,
@@ -84,6 +85,11 @@ Class mockUpContext(CoreTypes coreTypes, Program program) {
/// Context(int i) : list = new List(i);
VariableDeclaration iParameter = new VariableDeclaration("i",
type: coreTypes.intClass.rawType, isFinal: true);
+
+ // TODO(karlklose): use the default factory when it is exposed again.
+ Procedure listConstructor = coreTypes.listClass.procedures.firstWhere(
+ (Procedure p) => p.name.name == 'filled');
+
Constructor constructor = new Constructor(
new FunctionNode(new EmptyStatement(),
positionalParameters: <VariableDeclaration>[iParameter]),
@@ -92,9 +98,10 @@ Class mockUpContext(CoreTypes coreTypes, Program program) {
new FieldInitializer(
listField,
new StaticInvocation(
- coreTypes.listClass.procedures.first,
+ listConstructor,
new Arguments(<Expression>[
- new VariableAccessor(iParameter).buildSimpleRead()
+ new VariableAccessor(iParameter).buildSimpleRead(),
+ new NullLiteral(),
], types: <DartType>[
const DynamicType()
])))
« no previous file with comments | « no previous file | pkg/kernel/testcases/closures/capture_closure.dart.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698