| 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:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 | 374 |
| 375 /** | 375 /** |
| 376 * Return a new parsed unresolved [CompilationUnit]. | 376 * Return a new parsed unresolved [CompilationUnit]. |
| 377 */ | 377 */ |
| 378 CompilationUnit parse(AnalysisErrorListener errorListener) { | 378 CompilationUnit parse(AnalysisErrorListener errorListener) { |
| 379 AnalysisOptions analysisOptions = _fsState._analysisOptions; | 379 AnalysisOptions analysisOptions = _fsState._analysisOptions; |
| 380 | 380 |
| 381 if (USE_FASTA_PARSER) { | 381 if (USE_FASTA_PARSER) { |
| 382 try { | 382 try { |
| 383 fasta.ScannerResult scanResult = | 383 fasta.ScannerResult scanResult = fasta.scan(_contentBytes, |
| 384 fasta.scan(_contentBytes, includeComments: true); | 384 includeComments: true, |
| 385 scanGenericMethodComments: analysisOptions.strongMode); |
| 385 | 386 |
| 386 var astBuilder = new fasta.AstBuilder( | 387 var astBuilder = new fasta.AstBuilder( |
| 387 new ErrorReporter(errorListener, source), | 388 new ErrorReporter(errorListener, source), |
| 388 null, | 389 null, |
| 389 null, | 390 null, |
| 390 new _FastaElementStoreProxy(), | 391 new _FastaElementStoreProxy(), |
| 391 new fasta.Scope.top(isModifiable: true), | 392 new fasta.Scope.top(isModifiable: true), |
| 392 uri); | 393 uri); |
| 394 astBuilder.parseGenericMethodComments = analysisOptions.strongMode; |
| 395 |
| 393 var parser = new fasta.Parser(astBuilder); | 396 var parser = new fasta.Parser(astBuilder); |
| 394 astBuilder.parser = parser; | 397 astBuilder.parser = parser; |
| 395 parser.parseUnit(scanResult.tokens); | 398 parser.parseUnit(scanResult.tokens); |
| 396 var unit = astBuilder.pop() as CompilationUnit; | 399 var unit = astBuilder.pop() as CompilationUnit; |
| 397 | 400 |
| 398 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); | 401 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); |
| 399 unit.lineInfo = lineInfo; | 402 unit.lineInfo = lineInfo; |
| 400 return unit; | 403 return unit; |
| 401 } catch (e, st) { | 404 } catch (e, st) { |
| 402 print(e); | 405 print(e); |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 _FastaElementProxy operator [](fasta.Builder builder) => | 926 _FastaElementProxy operator [](fasta.Builder builder) => |
| 924 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); | 927 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); |
| 925 | 928 |
| 926 @override | 929 @override |
| 927 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 930 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 928 } | 931 } |
| 929 | 932 |
| 930 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { | 933 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { |
| 931 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 934 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 932 } | 935 } |
| OLD | NEW |