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

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

Issue 829133007: Enable enum and deferred import support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
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 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 parseFunctionBodies = true; 3016 parseFunctionBodies = true;
3017 } 3017 }
3018 3018
3019 /** 3019 /**
3020 * Create a parser. 3020 * Create a parser.
3021 * 3021 *
3022 * @param listener the listener to be passed to the parser 3022 * @param listener the listener to be passed to the parser
3023 * @return the parser that was created 3023 * @return the parser that was created
3024 */ 3024 */
3025 static Parser createParser(GatheringErrorListener listener) { 3025 static Parser createParser(GatheringErrorListener listener) {
3026 Parser parser = new Parser(null, listener); 3026 return new Parser(null, listener);
3027 parser.parseDeferredLibraries = true;
3028 parser.parseEnum = true;
3029 return parser;
3030 } 3027 }
3031 3028
3032 /** 3029 /**
3033 * Invoke a method in [Parser]. The method is assumed to have the given number and type of 3030 * Invoke a method in [Parser]. The method is assumed to have the given number and type of
3034 * parameters and will be invoked with the given arguments. 3031 * parameters and will be invoked with the given arguments.
3035 * 3032 *
3036 * The given source is scanned and the parser is initialized to start with the first token in the 3033 * The given source is scanned and the parser is initialized to start with the first token in the
3037 * source before the method is invoked. 3034 * source before the method is invoked.
3038 * 3035 *
3039 * @param methodName the name of the method that should be invoked 3036 * @param methodName the name of the method that should be invoked
(...skipping 12 matching lines...) Expand all
3052 // 3049 //
3053 Scanner scanner = 3050 Scanner scanner =
3054 new Scanner(null, new CharSequenceReader(source), listener); 3051 new Scanner(null, new CharSequenceReader(source), listener);
3055 Token tokenStream = scanner.tokenize(); 3052 Token tokenStream = scanner.tokenize();
3056 listener.setLineInfo(new TestSource(), scanner.lineStarts); 3053 listener.setLineInfo(new TestSource(), scanner.lineStarts);
3057 // 3054 //
3058 // Parse the source. 3055 // Parse the source.
3059 // 3056 //
3060 Parser parser = createParser(listener); 3057 Parser parser = createParser(listener);
3061 parser.parseFunctionBodies = parseFunctionBodies; 3058 parser.parseFunctionBodies = parseFunctionBodies;
3062 parser.parseDeferredLibraries = true;
3063 Object result = 3059 Object result =
3064 invokeParserMethodImpl(parser, methodName, objects, tokenStream); 3060 invokeParserMethodImpl(parser, methodName, objects, tokenStream);
3065 // 3061 //
3066 // Partially test the results. 3062 // Partially test the results.
3067 // 3063 //
3068 if (!listener.hasErrors) { 3064 if (!listener.hasErrors) {
3069 expect(result, isNotNull); 3065 expect(result, isNotNull);
3070 } 3066 }
3071 return result; 3067 return result;
3072 } 3068 }
(...skipping 7912 matching lines...) Expand 10 before | Expand all | Expand 10 after
10985 // Parse the source. 10981 // Parse the source.
10986 // 10982 //
10987 Parser parser = new Parser(null, listener); 10983 Parser parser = new Parser(null, listener);
10988 return invokeParserMethodImpl( 10984 return invokeParserMethodImpl(
10989 parser, 10985 parser,
10990 methodName, 10986 methodName,
10991 <Object>[tokenStream], 10987 <Object>[tokenStream],
10992 tokenStream) as Token; 10988 tokenStream) as Token;
10993 } 10989 }
10994 } 10990 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/non_error_resolver_test.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698