| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 if (USE_FASTA_PARSER) { | 357 if (USE_FASTA_PARSER) { |
| 358 try { | 358 try { |
| 359 fasta.ScannerResult scanResult = | 359 fasta.ScannerResult scanResult = |
| 360 fasta.scan(_contentBytes, includeComments: true); | 360 fasta.scan(_contentBytes, includeComments: true); |
| 361 | 361 |
| 362 var astBuilder = new fasta.AstBuilder( | 362 var astBuilder = new fasta.AstBuilder( |
| 363 new ErrorReporter(errorListener, source), | 363 new ErrorReporter(errorListener, source), |
| 364 null, | 364 null, |
| 365 null, | 365 null, |
| 366 new _FastaElementStoreProxy(), | 366 new _FastaElementStoreProxy(), |
| 367 new _FastaEmptyScope(), | 367 null, |
| 368 uri); | 368 uri); |
| 369 var parser = new fasta.Parser(astBuilder); | 369 var parser = new fasta.Parser(astBuilder); |
| 370 parser.parseUnit(scanResult.tokens); | 370 parser.parseUnit(scanResult.tokens); |
| 371 var unit = astBuilder.pop() as CompilationUnit; | 371 var unit = astBuilder.pop() as CompilationUnit; |
| 372 | 372 |
| 373 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); | 373 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); |
| 374 unit.lineInfo = lineInfo; | 374 unit.lineInfo = lineInfo; |
| 375 return unit; | 375 return unit; |
| 376 } catch (e, st) { | 376 } catch (e, st) { |
| 377 print(e); | 377 print(e); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 final _elements = <fasta.Builder, _FastaElementProxy>{}; | 794 final _elements = <fasta.Builder, _FastaElementProxy>{}; |
| 795 | 795 |
| 796 @override | 796 @override |
| 797 _FastaElementProxy operator [](fasta.Builder builder) => | 797 _FastaElementProxy operator [](fasta.Builder builder) => |
| 798 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); | 798 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); |
| 799 | 799 |
| 800 @override | 800 @override |
| 801 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 801 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 802 } | 802 } |
| 803 | 803 |
| 804 class _FastaEmptyScope extends fasta.Scope { | |
| 805 _FastaEmptyScope() : super({}, null); | |
| 806 } | |
| 807 | |
| 808 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { | 804 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { |
| 809 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 805 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 810 } | 806 } |
| OLD | NEW |