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

Side by Side Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 780403002: Fix for issue 3001 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library engine.parser_test; 5 library engine.parser_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/error.dart'; 9 import 'package:analyzer/src/generated/error.dart';
10 import 'package:analyzer/src/generated/incremental_scanner.dart'; 10 import 'package:analyzer/src/generated/incremental_scanner.dart';
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 void test_breakOutsideOfLoop_functionExpression_inALoop() { 833 void test_breakOutsideOfLoop_functionExpression_inALoop() {
834 ParserTestCase.parseStatement( 834 ParserTestCase.parseStatement(
835 "for(; x;) {() {break;};}", 835 "for(; x;) {() {break;};}",
836 [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]); 836 [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
837 } 837 }
838 838
839 void test_breakOutsideOfLoop_functionExpression_withALoop() { 839 void test_breakOutsideOfLoop_functionExpression_withALoop() {
840 ParserTestCase.parseStatement("() {for (; x;) {break;}};"); 840 ParserTestCase.parseStatement("() {for (; x;) {break;}};");
841 } 841 }
842 842
843 void test_classInClass_abstract() {
844 ParserTestCase.parseCompilationUnit(
845 "class C { abstract class B {} }",
846 [ParserErrorCode.CLASS_IN_CLASS]);
847 }
848
849 void test_classInClass_nonAbstract() {
850 ParserTestCase.parseCompilationUnit(
851 "class C { class B {} }",
852 [ParserErrorCode.CLASS_IN_CLASS]);
853 }
854
843 void test_classTypeAlias_abstractAfterEq() { 855 void test_classTypeAlias_abstractAfterEq() {
844 // This syntax has been removed from the language in favor of 856 // This syntax has been removed from the language in favor of
845 // "abstract class A = B with C;" (issue 18098). 857 // "abstract class A = B with C;" (issue 18098).
846 ParserTestCase.parse3( 858 ParserTestCase.parse3(
847 "parseCompilationUnitMember", 859 "parseCompilationUnitMember",
848 <Object>[emptyCommentAndMetadata()], 860 <Object>[emptyCommentAndMetadata()],
849 "class A = abstract B with C;", 861 "class A = abstract B with C;",
850 [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.EXPECTED_TOKEN]); 862 [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.EXPECTED_TOKEN]);
851 } 863 }
852 864
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 } 2345 }
2334 2346
2335 void test_topLevelOperator_withVoid() { 2347 void test_topLevelOperator_withVoid() {
2336 ParserTestCase.parse3( 2348 ParserTestCase.parse3(
2337 "parseCompilationUnitMember", 2349 "parseCompilationUnitMember",
2338 <Object>[emptyCommentAndMetadata()], 2350 <Object>[emptyCommentAndMetadata()],
2339 "void operator +(bool x, bool y) => x | y;", 2351 "void operator +(bool x, bool y) => x | y;",
2340 [ParserErrorCode.TOP_LEVEL_OPERATOR]); 2352 [ParserErrorCode.TOP_LEVEL_OPERATOR]);
2341 } 2353 }
2342 2354
2355 void test_typedefInClass_withoutReturnType() {
2356 ParserTestCase.parseCompilationUnit(
2357 "class C { typedef F(x); }",
2358 [ParserErrorCode.TYPEDEF_IN_CLASS]);
2359 }
2360
2361 void test_typedefInClass_withReturnType() {
2362 ParserTestCase.parseCompilationUnit(
2363 "class C { typedef int F(int x); }",
2364 [ParserErrorCode.TYPEDEF_IN_CLASS]);
2365 }
2366
2343 void test_unexpectedTerminatorForParameterGroup_named() { 2367 void test_unexpectedTerminatorForParameterGroup_named() {
2344 ParserTestCase.parse4( 2368 ParserTestCase.parse4(
2345 "parseFormalParameterList", 2369 "parseFormalParameterList",
2346 "(a, b})", 2370 "(a, b})",
2347 [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]); 2371 [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
2348 } 2372 }
2349 2373
2350 void test_unexpectedTerminatorForParameterGroup_optional() { 2374 void test_unexpectedTerminatorForParameterGroup_optional() {
2351 ParserTestCase.parse4( 2375 ParserTestCase.parse4(
2352 "parseFormalParameterList", 2376 "parseFormalParameterList",
(...skipping 8597 matching lines...) Expand 10 before | Expand all | Expand 10 after
10950 // Parse the source. 10974 // Parse the source.
10951 // 10975 //
10952 Parser parser = new Parser(null, listener); 10976 Parser parser = new Parser(null, listener);
10953 return invokeParserMethodImpl( 10977 return invokeParserMethodImpl(
10954 parser, 10978 parser,
10955 methodName, 10979 methodName,
10956 <Object>[tokenStream], 10980 <Object>[tokenStream],
10957 tokenStream) as Token; 10981 tokenStream) as Token;
10958 } 10982 }
10959 } 10983 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698