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

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

Issue 1281793004: fix sorting of compilation unit members - related to #23947 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 4 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.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/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3331 NodeList<VariableDeclaration> vars = 3331 NodeList<VariableDeclaration> vars =
3332 (fieldDecl as FieldDeclaration).fields.variables; 3332 (fieldDecl as FieldDeclaration).fields.variables;
3333 expect(vars, hasLength(1)); 3333 expect(vars, hasLength(1));
3334 expect(vars[0].name.name, "v"); 3334 expect(vars[0].name.name, "v");
3335 } 3335 }
3336 3336
3337 void test_functionExpression_named() { 3337 void test_functionExpression_named() {
3338 parseExpression("m(f() => 0);", [ParserErrorCode.EXPECTED_TOKEN]); 3338 parseExpression("m(f() => 0);", [ParserErrorCode.EXPECTED_TOKEN]);
3339 } 3339 }
3340 3340
3341 void test_declarationBeforeDirective() {
3342 CompilationUnit unit = ParserTestCase.parseCompilationUnit(
3343 "class foo { } import 'bar.dart';",
3344 [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
3345 expect(unit.directives, hasLength(1));
3346 expect(unit.declarations, hasLength(1));
3347 ClassDeclaration classDecl = unit.childEntities.first;
3348 expect(classDecl, isNotNull);
3349 expect(classDecl.name.name, 'foo');
3350 }
3351
3341 void test_importDirectivePartial_as() { 3352 void test_importDirectivePartial_as() {
3342 CompilationUnit unit = ParserTestCase.parseCompilationUnit( 3353 CompilationUnit unit = ParserTestCase.parseCompilationUnit(
3343 "import 'b.dart' d as b;", [ParserErrorCode.UNEXPECTED_TOKEN]); 3354 "import 'b.dart' d as b;", [ParserErrorCode.UNEXPECTED_TOKEN]);
3344 ImportDirective importDirective = unit.childEntities.first; 3355 ImportDirective importDirective = unit.childEntities.first;
3345 expect(importDirective.asKeyword, isNotNull); 3356 expect(importDirective.asKeyword, isNotNull);
3346 expect(unit.directives, hasLength(1)); 3357 expect(unit.directives, hasLength(1));
3347 expect(unit.declarations, hasLength(0)); 3358 expect(unit.declarations, hasLength(0));
3348 } 3359 }
3349 3360
3350 void test_importDirectivePartial_hide() { 3361 void test_importDirectivePartial_hide() {
(...skipping 7323 matching lines...) Expand 10 before | Expand all | Expand 10 after
10674 new Scanner(null, new CharSequenceReader(source), listener); 10685 new Scanner(null, new CharSequenceReader(source), listener);
10675 Token tokenStream = scanner.tokenize(); 10686 Token tokenStream = scanner.tokenize();
10676 // 10687 //
10677 // Parse the source. 10688 // Parse the source.
10678 // 10689 //
10679 Parser parser = new Parser(null, listener); 10690 Parser parser = new Parser(null, listener);
10680 return invokeParserMethodImpl( 10691 return invokeParserMethodImpl(
10681 parser, methodName, <Object>[tokenStream], tokenStream) as Token; 10692 parser, methodName, <Object>[tokenStream], tokenStream) as Token;
10682 } 10693 }
10683 } 10694 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698