Index: pkg/analyzer/lib/analyzer.dart |
diff --git a/pkg/analyzer/lib/analyzer.dart b/pkg/analyzer/lib/analyzer.dart |
index d0fdc6578136485d15fee683fd4008d5ae6d1e1e..78de42e172f1c2c8514e935be5d943b1cb8741b1 100644 |
--- a/pkg/analyzer/lib/analyzer.dart |
+++ b/pkg/analyzer/lib/analyzer.dart |
@@ -6,8 +6,8 @@ library analyzer; |
import 'dart:io'; |
+import 'package:analyzer/dart/ast/ast.dart'; |
import 'package:analyzer/src/error.dart'; |
-import 'package:analyzer/src/generated/ast.dart'; |
import 'package:analyzer/src/generated/error.dart'; |
import 'package:analyzer/src/generated/parser.dart'; |
import 'package:analyzer/src/generated/scanner.dart'; |
@@ -15,8 +15,10 @@ import 'package:analyzer/src/generated/source_io.dart'; |
import 'package:analyzer/src/string_source.dart'; |
import 'package:path/path.dart' as pathos; |
+export 'package:analyzer/dart/ast/ast.dart'; |
+export 'package:analyzer/dart/ast/visitor.dart'; |
+export 'package:analyzer/src/dart/ast/utilities.dart'; |
export 'package:analyzer/src/error.dart'; |
-export 'package:analyzer/src/generated/ast.dart'; |
export 'package:analyzer/src/generated/error.dart'; |
export 'package:analyzer/src/generated/utilities_dart.dart'; |
@@ -63,22 +65,6 @@ CompilationUnit parseDartFile(String path, |
suppressErrors: suppressErrors, parseFunctionBodies: parseFunctionBodies); |
} |
-CompilationUnit _parseSource(String contents, Source source, |
- {bool suppressErrors: false, bool parseFunctionBodies: true}) { |
- var reader = new CharSequenceReader(contents); |
- var errorCollector = new _ErrorCollector(); |
- var scanner = new Scanner(source, reader, errorCollector); |
- var token = scanner.tokenize(); |
- var parser = new Parser(source, errorCollector) |
- ..parseFunctionBodies = parseFunctionBodies; |
- var unit = parser.parseCompilationUnit(token) |
- ..lineInfo = new LineInfo(scanner.lineStarts); |
- |
- if (errorCollector.hasErrors && !suppressErrors) throw errorCollector.group; |
- |
- return unit; |
-} |
- |
/// Parses the script tag and directives in a string of Dart code into an AST. |
/// |
/// Stops parsing when the first non-directive is encountered. The rest of the |
@@ -111,6 +97,22 @@ String stringLiteralToString(StringLiteral literal) { |
return literal.stringValue; |
} |
+CompilationUnit _parseSource(String contents, Source source, |
+ {bool suppressErrors: false, bool parseFunctionBodies: true}) { |
+ var reader = new CharSequenceReader(contents); |
+ var errorCollector = new _ErrorCollector(); |
+ var scanner = new Scanner(source, reader, errorCollector); |
+ var token = scanner.tokenize(); |
+ var parser = new Parser(source, errorCollector) |
+ ..parseFunctionBodies = parseFunctionBodies; |
+ var unit = parser.parseCompilationUnit(token) |
+ ..lineInfo = new LineInfo(scanner.lineStarts); |
+ |
+ if (errorCollector.hasErrors && !suppressErrors) throw errorCollector.group; |
+ |
+ return unit; |
+} |
+ |
/// A simple error listener that collects errors into an [AnalysisErrorGroup]. |
class _ErrorCollector extends AnalysisErrorListener { |
final _errors = <AnalysisError>[]; |