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'; |
11 import 'package:analyzer/error/listener.dart'; | 11 import 'package:analyzer/error/listener.dart'; |
12 import 'package:analyzer/file_system/file_system.dart'; | 12 import 'package:analyzer/file_system/file_system.dart'; |
13 import 'package:analyzer/src/dart/analysis/defined_names.dart'; | 13 import 'package:analyzer/src/dart/analysis/defined_names.dart'; |
14 import 'package:analyzer/src/dart/analysis/referenced_names.dart'; | 14 import 'package:analyzer/src/dart/analysis/referenced_names.dart'; |
15 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart'; | 15 import 'package:analyzer/src/dart/analysis/top_level_declaration.dart'; |
16 import 'package:analyzer/src/dart/scanner/reader.dart'; | 16 import 'package:analyzer/src/dart/scanner/reader.dart'; |
17 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 17 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
18 import 'package:analyzer/src/fasta/ast_builder.dart' as fasta; | 18 import 'package:analyzer/src/fasta/ast_builder.dart' as fasta; |
19 import 'package:analyzer/src/fasta/element_store.dart' as fasta; | |
20 import 'package:analyzer/src/fasta/mock_element.dart' as fasta; | 19 import 'package:analyzer/src/fasta/mock_element.dart' as fasta; |
21 import 'package:analyzer/src/generated/engine.dart'; | 20 import 'package:analyzer/src/generated/engine.dart'; |
22 import 'package:analyzer/src/generated/parser.dart'; | 21 import 'package:analyzer/src/generated/parser.dart'; |
23 import 'package:analyzer/src/generated/source.dart'; | 22 import 'package:analyzer/src/generated/source.dart'; |
24 import 'package:analyzer/src/generated/utilities_dart.dart'; | 23 import 'package:analyzer/src/generated/utilities_dart.dart'; |
25 import 'package:analyzer/src/source/source_resource.dart'; | 24 import 'package:analyzer/src/source/source_resource.dart'; |
26 import 'package:analyzer/src/summary/format.dart'; | 25 import 'package:analyzer/src/summary/format.dart'; |
27 import 'package:analyzer/src/summary/idl.dart'; | 26 import 'package:analyzer/src/summary/idl.dart'; |
28 import 'package:analyzer/src/summary/name_filter.dart'; | 27 import 'package:analyzer/src/summary/name_filter.dart'; |
29 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 28 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 _contentBytes, | 577 _contentBytes, |
579 includeComments: true, | 578 includeComments: true, |
580 scanGenericMethodComments: analysisOptions.strongMode, | 579 scanGenericMethodComments: analysisOptions.strongMode, |
581 ); | 580 ); |
582 }); | 581 }); |
583 | 582 |
584 var astBuilder = new fasta.AstBuilder( | 583 var astBuilder = new fasta.AstBuilder( |
585 new ErrorReporter(errorListener, source), | 584 new ErrorReporter(errorListener, source), |
586 null, | 585 null, |
587 null, | 586 null, |
588 new _FastaElementStoreProxy(), | |
589 new fasta.Scope.top(isModifiable: true), | 587 new fasta.Scope.top(isModifiable: true), |
590 true, | 588 true, |
591 false, | |
592 uri); | 589 uri); |
593 astBuilder.parseGenericMethodComments = analysisOptions.strongMode; | 590 astBuilder.parseGenericMethodComments = analysisOptions.strongMode; |
594 | 591 |
595 var parser = new fasta.Parser(astBuilder); | 592 var parser = new fasta.Parser(astBuilder); |
596 astBuilder.parser = parser; | 593 astBuilder.parser = parser; |
597 parser.parseUnit(scanResult.tokens); | 594 parser.parseUnit(scanResult.tokens); |
598 var unit = astBuilder.pop() as CompilationUnit; | 595 var unit = astBuilder.pop() as CompilationUnit; |
599 | 596 |
600 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); | 597 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); |
601 unit.lineInfo = lineInfo; | 598 unit.lineInfo = lineInfo; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 | 931 |
935 /** | 932 /** |
936 * Information about changes to the known file set. | 933 * Information about changes to the known file set. |
937 */ | 934 */ |
938 class KnownFilesSetChange { | 935 class KnownFilesSetChange { |
939 final Set<String> added; | 936 final Set<String> added; |
940 final Set<String> removed; | 937 final Set<String> removed; |
941 | 938 |
942 KnownFilesSetChange(this.added, this.removed); | 939 KnownFilesSetChange(this.added, this.removed); |
943 } | 940 } |
944 | |
945 class _FastaElementProxy implements fasta.KernelClassElement { | |
946 @override | |
947 final fasta.KernelInterfaceType rawType = new _FastaInterfaceTypeProxy(); | |
948 | |
949 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | |
950 } | |
951 | |
952 class _FastaElementStoreProxy implements fasta.ElementStore { | |
953 final _elements = <fasta.Builder, _FastaElementProxy>{}; | |
954 | |
955 @override | |
956 _FastaElementProxy operator [](fasta.Builder builder) => | |
957 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); | |
958 | |
959 @override | |
960 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | |
961 } | |
962 | |
963 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { | |
964 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | |
965 } | |
OLD | NEW |