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

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

Issue 2708703002: Capture const/final/var keyword in AstBuilder.endTopLevelFields. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 34aef35b90f5c2ec04c33ada6e15053229cccb52..2f5de26193e54f52d6862463cc807bc4c686263b 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -13391,6 +13391,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
TopLevelVariableDeclaration declaration = member;
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
+ expect(declaration.variables.keyword.lexeme, 'const');
}
void test_parseCompilationUnitMember_expressionFunctionBody_tokens() {
@@ -13410,6 +13411,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
TopLevelVariableDeclaration declaration = member;
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
+ expect(declaration.variables.keyword.lexeme, 'final');
}
void test_parseCompilationUnitMember_function_external_noType() {
@@ -13689,6 +13691,19 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
expect(typeAlias.parameters.parameters, hasLength(0));
}
+ void test_parseCompilationUnitMember_typedVariable() {
+ createParser('int x = 0;');
+ CompilationUnitMember member = parseFullCompilationUnitMember();
+ expect(member, isNotNull);
+ assertNoErrors();
+ expect(member, new isInstanceOf<TopLevelVariableDeclaration>());
+ TopLevelVariableDeclaration declaration = member;
+ expect(declaration.semicolon, isNotNull);
+ expect(declaration.variables, isNotNull);
+ expect(declaration.variables.type, isNotNull);
+ expect(declaration.variables.keyword, isNull);
+ }
+
void test_parseCompilationUnitMember_variable() {
createParser('var x = 0;');
CompilationUnitMember member = parseFullCompilationUnitMember();
@@ -13698,6 +13713,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase {
TopLevelVariableDeclaration declaration = member;
expect(declaration.semicolon, isNotNull);
expect(declaration.variables, isNotNull);
+ expect(declaration.variables.keyword.lexeme, 'var');
}
void test_parseCompilationUnitMember_variableGet() {
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698