| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:convert'; | 5 import 'dart:convert'; |
| 6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
| 7 | 7 |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
| 10 import 'package:analyzer/error/listener.dart'; | 10 import 'package:analyzer/error/listener.dart'; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 /** | 352 /** |
| 353 * Return a new parsed unresolved [CompilationUnit]. | 353 * Return a new parsed unresolved [CompilationUnit]. |
| 354 */ | 354 */ |
| 355 CompilationUnit parse(AnalysisErrorListener errorListener) { | 355 CompilationUnit parse(AnalysisErrorListener errorListener) { |
| 356 AnalysisOptions analysisOptions = _fsState._analysisOptions; | 356 AnalysisOptions analysisOptions = _fsState._analysisOptions; |
| 357 | 357 |
| 358 if (USE_FASTA_PARSER) { | 358 if (USE_FASTA_PARSER) { |
| 359 try { | 359 try { |
| 360 fasta.ScannerResult scanResult = fasta.scan(_contentBytes); | 360 fasta.ScannerResult scanResult = fasta.scan(_contentBytes); |
| 361 | 361 |
| 362 var listener = new fasta.AstBuilder(null, null, | 362 var astBuilder = new fasta.AstBuilder( |
| 363 new _FastaElementStoreProxy(), new _FastaEmptyScope(), uri); | 363 new ErrorReporter(errorListener, source), |
| 364 var parser = new fasta.Parser(listener); | 364 null, |
| 365 null, |
| 366 new _FastaElementStoreProxy(), |
| 367 new _FastaEmptyScope(), |
| 368 uri); |
| 369 var parser = new fasta.Parser(astBuilder); |
| 365 parser.parseUnit(scanResult.tokens); | 370 parser.parseUnit(scanResult.tokens); |
| 366 var unit = listener.pop() as CompilationUnit; | 371 var unit = astBuilder.pop() as CompilationUnit; |
| 367 | 372 |
| 368 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); | 373 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); |
| 369 unit.lineInfo = lineInfo; | 374 unit.lineInfo = lineInfo; |
| 370 return unit; | 375 return unit; |
| 371 } catch (e, st) { | 376 } catch (e, st) { |
| 372 print(e); | 377 print(e); |
| 373 print(st); | 378 print(st); |
| 374 rethrow; | 379 rethrow; |
| 375 } | 380 } |
| 376 } else { | 381 } else { |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 801 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 797 } | 802 } |
| 798 | 803 |
| 799 class _FastaEmptyScope extends fasta.Scope { | 804 class _FastaEmptyScope extends fasta.Scope { |
| 800 _FastaEmptyScope() : super({}, null); | 805 _FastaEmptyScope() : super({}, null); |
| 801 } | 806 } |
| 802 | 807 |
| 803 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { | 808 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { |
| 804 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 809 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 805 } | 810 } |
| OLD | NEW |