File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
sdk/lib/_internal/compiler/implementation/ssa Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ class SsaSimplifyInterceptors extends HBaseVisitor
264264 // they have side effects.
265265 HInstruction instruction;
266266 if (selector.isGetter ()) {
267- instruction= new HInvokeDynamicGetter (
267+ instruction = new HInvokeDynamicGetter (
268268 selector,
269269 node.element,
270270 < HInstruction > [constant, node.inputs[1 ]],
Original file line number Diff line number Diff line change @@ -299,13 +299,17 @@ class SsaInstructionSimplifier extends HBaseVisitor
299299 }
300300 } else if (input.isString (compiler)) {
301301 if (selector.applies (backend.jsStringSplit, compiler)) {
302- if (node.inputs[2 ].isString (compiler)) {
302+ HInstruction argument = node.inputs[2 ];
303+ if (argument.isString (compiler) && ! argument.canBeNull ()) {
303304 target = backend.jsStringSplit;
304305 }
305306 } else if (selector.applies (backend.jsStringOperatorAdd, compiler)) {
306307 // `operator+` is turned into a JavaScript '+' so we need to
307- // make sure the receiver is not null.
308- if (node.inputs[2 ].isString (compiler) && ! input.canBeNull ()) {
308+ // make sure the receiver and the argument are not null.
309+ HInstruction argument = node.inputs[2 ];
310+ if (argument.isString (compiler)
311+ && ! argument.canBeNull ()
312+ && ! input.canBeNull ()) {
309313 target = backend.jsStringOperatorAdd;
310314 }
311315 } else if (selector.applies (backend.jsStringToString, compiler)
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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 file.
4+
5+ import "package:expect/expect.dart" ;
6+ import "../language/compiler_annotations.dart" ;
7+
8+ @DontInline ()
9+ returnStringOrNull () {
10+ () => 42 ;
11+ return new DateTime .now ().millisecondsSinceEpoch == 0 ? 'foo' : null ;
12+ }
13+
14+ main () {
15+ Expect .throws (() => 'foo' + returnStringOrNull (),
16+ (e) => e is ArgumentError );
17+ Expect .throws (() => 'foo' .split (returnStringOrNull ()),
18+ (e) => e is ArgumentError || e is NoSuchMethodError );
19+ }
You can’t perform that action at this time.
0 commit comments