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

Unified Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 2949493002: [kernel] Check type for list literals (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/language_kernel.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary_flowgraph.cc
diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc
index 37f596c4fa2535ec5c15ee3e6198bac1a1ef6388..ba593ffbffb4b0af87845998616f21526281408a 100644
--- a/runtime/vm/kernel_binary_flowgraph.cc
+++ b/runtime/vm/kernel_binary_flowgraph.cc
@@ -5696,15 +5696,18 @@ Fragment StreamingFlowGraphBuilder::BuildListLiteral(bool is_const,
instructions += Constant(Object::empty_array());
} else {
// The type arguments for CreateArray.
- instructions += Constant(TypeArguments::ZoneHandle(Z));
+ instructions += Constant(type_arguments);
instructions += IntConstant(length);
instructions += CreateArray();
+ AbstractType& list_type = AbstractType::Handle(type_arguments.TypeAt(0));
Kevin Millikin (Google) 2017/06/19 15:01:17 Pass the zone argument Z so we don't have to get i
jensj 2017/06/20 10:43:30 Done.
LocalVariable* array = MakeTemporary();
for (intptr_t i = 0; i < length; ++i) {
instructions += LoadLocal(array);
instructions += IntConstant(i);
instructions += BuildExpression(); // read ith expression.
+ instructions += CheckAssignableInCheckedMode(
+ list_type, Symbols::ListLiteralElement());
instructions += StoreIndexed(kArrayCid);
instructions += Drop();
}
« no previous file with comments | « no previous file | tests/language/language_kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698