OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.src.task.dart; | 5 library analyzer.src.task.dart; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
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/dart/ast/visitor.dart'; | 11 import 'package:analyzer/dart/ast/visitor.dart'; |
12 import 'package:analyzer/dart/element/element.dart'; | 12 import 'package:analyzer/dart/element/element.dart'; |
13 import 'package:analyzer/dart/element/type.dart'; | 13 import 'package:analyzer/dart/element/type.dart'; |
14 import 'package:analyzer/error/error.dart'; | 14 import 'package:analyzer/error/error.dart'; |
15 import 'package:analyzer/error/listener.dart'; | 15 import 'package:analyzer/error/listener.dart'; |
16 import 'package:analyzer/exception/exception.dart'; | 16 import 'package:analyzer/exception/exception.dart'; |
17 import 'package:analyzer/src/context/cache.dart'; | 17 import 'package:analyzer/src/context/cache.dart'; |
18 import 'package:analyzer/src/dart/ast/ast.dart' | 18 import 'package:analyzer/src/dart/ast/ast.dart' |
19 show NamespaceDirectiveImpl, UriBasedDirectiveImpl; | 19 show NamespaceDirectiveImpl, UriBasedDirectiveImpl; |
20 import 'package:analyzer/src/dart/ast/utilities.dart'; | 20 import 'package:analyzer/src/dart/ast/utilities.dart'; |
21 import 'package:analyzer/src/dart/element/builder.dart'; | 21 import 'package:analyzer/src/dart/element/builder.dart'; |
22 import 'package:analyzer/src/dart/element/element.dart'; | 22 import 'package:analyzer/src/dart/element/element.dart'; |
23 import 'package:analyzer/src/dart/resolver/inheritance_manager.dart'; | 23 import 'package:analyzer/src/dart/resolver/inheritance_manager.dart'; |
24 import 'package:analyzer/src/dart/scanner/reader.dart'; | 24 import 'package:analyzer/src/dart/scanner/reader.dart'; |
25 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 25 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
| 26 import 'package:analyzer/src/dart/sdk/patch.dart'; |
26 import 'package:analyzer/src/error/codes.dart'; | 27 import 'package:analyzer/src/error/codes.dart'; |
27 import 'package:analyzer/src/error/pending_error.dart'; | 28 import 'package:analyzer/src/error/pending_error.dart'; |
28 import 'package:analyzer/src/generated/constant.dart'; | 29 import 'package:analyzer/src/generated/constant.dart'; |
29 import 'package:analyzer/src/generated/declaration_resolver.dart'; | 30 import 'package:analyzer/src/generated/declaration_resolver.dart'; |
30 import 'package:analyzer/src/generated/engine.dart'; | 31 import 'package:analyzer/src/generated/engine.dart'; |
31 import 'package:analyzer/src/generated/error_verifier.dart'; | 32 import 'package:analyzer/src/generated/error_verifier.dart'; |
32 import 'package:analyzer/src/generated/incremental_resolver.dart'; | 33 import 'package:analyzer/src/generated/incremental_resolver.dart'; |
33 import 'package:analyzer/src/generated/parser.dart'; | 34 import 'package:analyzer/src/generated/parser.dart'; |
34 import 'package:analyzer/src/generated/resolver.dart'; | 35 import 'package:analyzer/src/generated/resolver.dart'; |
35 import 'package:analyzer/src/generated/sdk.dart'; | 36 import 'package:analyzer/src/generated/sdk.dart'; |
(...skipping 3981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4017 Parser parser = new Parser(_source, errorListener); | 4018 Parser parser = new Parser(_source, errorListener); |
4018 AnalysisOptions options = context.analysisOptions; | 4019 AnalysisOptions options = context.analysisOptions; |
4019 parser.enableAssertInitializer = options.enableAssertInitializer; | 4020 parser.enableAssertInitializer = options.enableAssertInitializer; |
4020 parser.parseFunctionBodies = | 4021 parser.parseFunctionBodies = |
4021 options.analyzeFunctionBodiesPredicate(_source); | 4022 options.analyzeFunctionBodiesPredicate(_source); |
4022 parser.parseGenericMethods = options.enableGenericMethods; | 4023 parser.parseGenericMethods = options.enableGenericMethods; |
4023 parser.parseGenericMethodComments = options.strongMode; | 4024 parser.parseGenericMethodComments = options.strongMode; |
4024 CompilationUnit unit = parser.parseCompilationUnit(tokenStream); | 4025 CompilationUnit unit = parser.parseCompilationUnit(tokenStream); |
4025 unit.lineInfo = lineInfo; | 4026 unit.lineInfo = lineInfo; |
4026 | 4027 |
| 4028 if (options.patchPlatform != 0 && _source.uri.scheme == 'dart') { |
| 4029 new SdkPatcher().patch(context.sourceFactory.dartSdk, |
| 4030 options.patchPlatform, errorListener, _source, unit); |
| 4031 } |
| 4032 |
4027 bool hasNonPartOfDirective = false; | 4033 bool hasNonPartOfDirective = false; |
4028 bool hasPartOfDirective = false; | 4034 bool hasPartOfDirective = false; |
4029 HashSet<Source> explicitlyImportedSourceSet = new HashSet<Source>(); | 4035 HashSet<Source> explicitlyImportedSourceSet = new HashSet<Source>(); |
4030 HashSet<Source> exportedSourceSet = new HashSet<Source>(); | 4036 HashSet<Source> exportedSourceSet = new HashSet<Source>(); |
4031 HashSet<Source> includedSourceSet = new HashSet<Source>(); | 4037 HashSet<Source> includedSourceSet = new HashSet<Source>(); |
4032 NodeList<Directive> directives = unit.directives; | 4038 NodeList<Directive> directives = unit.directives; |
4033 int length = directives.length; | 4039 int length = directives.length; |
4034 for (int i = 0; i < length; i++) { | 4040 for (int i = 0; i < length; i++) { |
4035 Directive directive = directives[i]; | 4041 Directive directive = directives[i]; |
4036 if (directive is PartOfDirective) { | 4042 if (directive is PartOfDirective) { |
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6444 | 6450 |
6445 @override | 6451 @override |
6446 bool moveNext() { | 6452 bool moveNext() { |
6447 if (_newSources.isEmpty) { | 6453 if (_newSources.isEmpty) { |
6448 return false; | 6454 return false; |
6449 } | 6455 } |
6450 currentTarget = _newSources.removeLast(); | 6456 currentTarget = _newSources.removeLast(); |
6451 return true; | 6457 return true; |
6452 } | 6458 } |
6453 } | 6459 } |
OLD | NEW |