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

Unified Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 1331433003: Fix handling of shortcutting expressions and asserts in ExitDetector. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index ec4b9c0dd6b8dabcbd9d5b8563551baf7987d60b..9765af9ee937d9d5246ea0e3cc703c3b421ecc5e 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -7351,7 +7351,7 @@ class ExitDetectorTest extends ParserTestCase {
}
void test_assertStatement_throw() {
- _assertTrue("assert((throw 0));");
+ _assertFalse("assert((throw 0));");
}
void test_assignmentExpression() {
@@ -7383,15 +7383,31 @@ class ExitDetectorTest extends ParserTestCase {
}
void test_binaryExpression_and_rhs() {
- _assertTrue("a && (throw '');");
+ _assertFalse("a && (throw '');");
}
void test_binaryExpression_and_rhs2() {
- _assertTrue("false && (throw '');");
+ _assertFalse("false && (throw '');");
}
void test_binaryExpression_and_rhs3() {
- _assertFalse("true && (throw '');");
+ _assertTrue("true && (throw '');");
+ }
+
+ void test_binaryExpression_ifNull() {
+ _assertFalse("a ?? b;");
+ }
+
+ void test_binaryExpression_ifNull_lhs() {
+ _assertTrue("throw '' ?? b;");
+ }
+
+ void test_binaryExpression_ifNull_rhs() {
+ _assertFalse("a ?? (throw '');");
+ }
+
+ void test_binaryExpression_ifNull_rhs2() {
+ _assertFalse("null ?? (throw '');");
}
void test_binaryExpression_or() {
@@ -7403,15 +7419,15 @@ class ExitDetectorTest extends ParserTestCase {
}
void test_binaryExpression_or_rhs() {
- _assertTrue("a || (throw '');");
+ _assertFalse("a || (throw '');");
}
void test_binaryExpression_or_rhs2() {
- _assertTrue("true || (throw '');");
+ _assertFalse("true || (throw '');");
}
void test_binaryExpression_or_rhs3() {
- _assertFalse("false || (throw '');");
+ _assertTrue("false || (throw '');");
}
void test_block_empty() {
@@ -7462,6 +7478,62 @@ class ExitDetectorTest extends ParserTestCase {
_assertFalse("c ? throw '' : j;");
}
+ void test_conditionalAccess() {
+ _assertFalse("a?.b;");
+ }
+
+ void test_conditionalAccess_lhs() {
+ _assertTrue("(throw '')?.b;");
+ }
+
+ void test_conditionalAccessAssign() {
+ _assertFalse("a?.b = c;");
+ }
+
+ void test_conditionalAccessAssign_lhs() {
+ _assertTrue("(throw '')?.b = c;");
+ }
+
+ void test_conditionalAccessAssign_rhs() {
+ _assertFalse("a?.b = throw '';");
+ }
+
+ void test_conditionalAccessAssign_rhs2() {
+ _assertFalse("null?.b = throw '';");
+ }
+
+ void test_conditionalAccessIfNullAssign() {
+ _assertFalse("a?.b ??= c;");
+ }
+
+ void test_conditionalAccessIfNullAssign_lhs() {
+ _assertTrue("(throw '')?.b ??= c;");
+ }
+
+ void test_conditionalAccessIfNullAssign_rhs() {
+ _assertFalse("a?.b ??= throw '';");
+ }
+
+ void test_conditionalAccessIfNullAssign_rhs2() {
+ _assertFalse("null?.b ??= throw '';");
+ }
+
+ void test_conditionalCall() {
+ _assertFalse("a?.b(c);");
+ }
+
+ void test_conditionalCall_lhs() {
+ _assertTrue("(throw '')?.b(c);");
+ }
+
+ void test_conditionalCall_rhs() {
+ _assertFalse("a?.b(throw '');");
+ }
+
+ void test_conditionalCall_rhs2() {
+ _assertFalse("null?.b(throw '');");
+ }
+
void test_creation() {
expect(new ExitDetector(), isNotNull);
}
@@ -7618,6 +7690,14 @@ class ExitDetectorTest extends ParserTestCase {
_assertFalse("if (c) return 0; else j++;");
}
+ void test_ifNullAssign() {
+ _assertFalse("a ??= b;");
+ }
+
+ void test_ifNullAssign_rhs() {
+ _assertFalse("a ??= throw '';");
+ }
+
void test_indexExpression() {
_assertFalse("a[b];");
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698