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

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 2140673004: Generalize the first argument in an assert to be an expression (issue 26865) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/error.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index ab3b05e0f98e02ddc4bb3dbf527a9c6c91003a10..6e45c8e1441a3cd3455a5f15f362506ea7e214c5 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -4357,25 +4357,12 @@ class Parser {
* This method assumes that the current token matches `Keyword.ASSERT`.
*
* assertStatement ::=
- * 'assert' '(' conditionalExpression ')' ';'
+ * 'assert' '(' expression [',' expression] ')' ';'
*/
AssertStatement _parseAssertStatement() {
Token keyword = getAndAdvance();
Token leftParen = _expect(TokenType.OPEN_PAREN);
Expression expression = parseExpression2();
- if (expression is AssignmentExpression) {
- _reportErrorForNode(
- ParserErrorCode.ASSERT_DOES_NOT_TAKE_ASSIGNMENT, expression);
- } else if (expression is CascadeExpression) {
- _reportErrorForNode(
- ParserErrorCode.ASSERT_DOES_NOT_TAKE_CASCADE, expression);
- } else if (expression is ThrowExpression) {
- _reportErrorForNode(
- ParserErrorCode.ASSERT_DOES_NOT_TAKE_THROW, expression);
- } else if (expression is RethrowExpression) {
- _reportErrorForNode(
- ParserErrorCode.ASSERT_DOES_NOT_TAKE_RETHROW, expression);
- }
Token comma;
Expression message;
if (_matches(TokenType.COMMA)) {
@@ -9896,22 +9883,6 @@ class ParserErrorCode extends ErrorCode {
const ParserErrorCode('ANNOTATION_ON_ENUM_CONSTANT',
"Enum constants cannot have annotations");
- static const ParserErrorCode ASSERT_DOES_NOT_TAKE_ASSIGNMENT =
- const ParserErrorCode('ASSERT_DOES_NOT_TAKE_ASSIGNMENT',
- "Assert cannot be called on an assignment");
-
- static const ParserErrorCode ASSERT_DOES_NOT_TAKE_CASCADE =
- const ParserErrorCode(
- 'ASSERT_DOES_NOT_TAKE_CASCADE', "Assert cannot be called on cascade");
-
- static const ParserErrorCode ASSERT_DOES_NOT_TAKE_THROW =
- const ParserErrorCode(
- 'ASSERT_DOES_NOT_TAKE_THROW', "Assert cannot be called on throws");
-
- static const ParserErrorCode ASSERT_DOES_NOT_TAKE_RETHROW =
- const ParserErrorCode('ASSERT_DOES_NOT_TAKE_RETHROW',
- "Assert cannot be called on rethrows");
-
/**
* 16.32 Identifier Reference: It is a compile-time error if any of the
* identifiers async, await, or yield is used as an identifier in a function
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698