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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1526623004: cps_ir: Add JS checks, use argument nullability (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index e4fb1fd06211267ee7b437aee5839902d545bc49..7020dba1941453f6f195f3c1bb63f0b32652a0de 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -43,7 +43,8 @@ import '../constants/values.dart' show
import 'cps_ir_nodes.dart' as ir;
import 'cps_ir_builder.dart';
import '../native/native.dart' show
- NativeBehavior;
+ NativeBehavior,
+ HasCapturedPlaceholders;
// TODO(karlklose): remove.
import '../js/js.dart' as js show js, Template, Expression, Name;
@@ -3489,6 +3490,20 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
// using [NativeBehavior]. We can ignore these arguments in the backend.
List<ir.Primitive> arguments =
argumentNodes.skip(2).mapToList(visit, growable: false);
+ if (behavior.codeTemplate.positionalArgumentCount != arguments.length) {
+ reporter.reportErrorMessage(
+ node, MessageKind.GENERIC,
+ {'text':
+ 'Mismatch between number of placeholders'
+ ' and number of arguments.'});
+ return irBuilder.buildNullConstant();
+ }
+
+ if (HasCapturedPlaceholders.check(behavior.codeTemplate.ast)) {
+ reporter.reportErrorMessage(node, MessageKind.JS_PLACEHOLDER_CAPTURE);
+ return irBuilder.buildNullConstant();
+ }
+
return irBuilder.buildForeignCode(behavior.codeTemplate, arguments,
behavior);
« no previous file with comments | « no previous file | pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698