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

Side by Side Diff: tests/compiler/dart2js/logical_expression_test.dart

Issue 175403002: GenerateNot was not respecting "generateAtUseSite". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Nicolas' comments. (reupload:500) Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 // Test that logical or-expressions don't introduce unnecessary nots.
6
7 import "package:async_helper/async_helper.dart";
8 import 'compiler_helper.dart';
9
10 const String TEST_ONE = r"""
11 foo(bar, gee) {
12 bool cond1 = bar();
13 if (cond1 || gee()) gee();
14 if (cond1 || gee()) gee();
15 }
16 """;
17
18 const String TEST_TWO = r"""
19 void foo(list, bar) {
20 if (list == null) bar();
21 if (list == null || bar()) bar();
22 if (list == null || bar()) bar();
23 }
24 """;
25
26 main() {
27 // We want something like:
28 // var t1 = bar.call$0() === true;
29 // if (t1 || gee.call$0() === true) gee.call$0();
30 // if (t1 || gee.call$0() === true) gee.call$0();
31 compileAndDoNotMatchFuzzy(TEST_ONE, 'foo',
32 r"""var x = [a-zA-Z0-9$.]+\(\) == true;
33 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;
34 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;""");
35
36
37 // We want something like:
38 // var t1 = list == null;
39 // if (t1) bar.call$0();
40 // if (t1 || bar.call$0() === true) bar.call$0();
41 // if (t1 || bar.call$0() === true) bar.call$0();
42 compileAndMatchFuzzy(TEST_TWO, 'foo',
43 r"""var x = x == null;
44 if \(x\) [^;]+;
45 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;
46 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;""");
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698