Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 2560323002: Simplify how patch files are specified to analyzer. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
11 import 'package:analyzer/dart/ast/token.dart'; 11 import 'package:analyzer/dart/ast/token.dart';
12 import 'package:analyzer/dart/ast/visitor.dart'; 12 import 'package:analyzer/dart/ast/visitor.dart';
13 import 'package:analyzer/dart/element/element.dart'; 13 import 'package:analyzer/dart/element/element.dart';
14 import 'package:analyzer/dart/element/type.dart'; 14 import 'package:analyzer/dart/element/type.dart';
15 import 'package:analyzer/error/error.dart'; 15 import 'package:analyzer/error/error.dart';
16 import 'package:analyzer/error/listener.dart'; 16 import 'package:analyzer/error/listener.dart';
17 import 'package:analyzer/exception/exception.dart'; 17 import 'package:analyzer/exception/exception.dart';
18 import 'package:analyzer/src/context/cache.dart'; 18 import 'package:analyzer/src/context/cache.dart';
19 import 'package:analyzer/src/dart/ast/ast.dart' 19 import 'package:analyzer/src/dart/ast/ast.dart'
20 show NamespaceDirectiveImpl, UriBasedDirectiveImpl, UriValidationCode; 20 show NamespaceDirectiveImpl, UriBasedDirectiveImpl, UriValidationCode;
21 import 'package:analyzer/src/dart/ast/utilities.dart'; 21 import 'package:analyzer/src/dart/ast/utilities.dart';
22 import 'package:analyzer/src/dart/element/builder.dart'; 22 import 'package:analyzer/src/dart/element/builder.dart';
23 import 'package:analyzer/src/dart/element/element.dart'; 23 import 'package:analyzer/src/dart/element/element.dart';
24 import 'package:analyzer/src/dart/resolver/inheritance_manager.dart'; 24 import 'package:analyzer/src/dart/resolver/inheritance_manager.dart';
25 import 'package:analyzer/src/dart/scanner/reader.dart'; 25 import 'package:analyzer/src/dart/scanner/reader.dart';
26 import 'package:analyzer/src/dart/scanner/scanner.dart'; 26 import 'package:analyzer/src/dart/scanner/scanner.dart';
27 import 'package:analyzer/src/dart/sdk/patch.dart'; 27 import 'package:analyzer/src/dart/sdk/patch.dart';
28 import 'package:analyzer/src/dart/sdk/sdk.dart';
28 import 'package:analyzer/src/error/codes.dart'; 29 import 'package:analyzer/src/error/codes.dart';
29 import 'package:analyzer/src/error/pending_error.dart'; 30 import 'package:analyzer/src/error/pending_error.dart';
30 import 'package:analyzer/src/generated/constant.dart'; 31 import 'package:analyzer/src/generated/constant.dart';
31 import 'package:analyzer/src/generated/declaration_resolver.dart'; 32 import 'package:analyzer/src/generated/declaration_resolver.dart';
32 import 'package:analyzer/src/generated/engine.dart'; 33 import 'package:analyzer/src/generated/engine.dart';
33 import 'package:analyzer/src/generated/error_verifier.dart'; 34 import 'package:analyzer/src/generated/error_verifier.dart';
34 import 'package:analyzer/src/generated/incremental_resolver.dart'; 35 import 'package:analyzer/src/generated/incremental_resolver.dart';
35 import 'package:analyzer/src/generated/parser.dart'; 36 import 'package:analyzer/src/generated/parser.dart';
36 import 'package:analyzer/src/generated/resolver.dart'; 37 import 'package:analyzer/src/generated/resolver.dart';
37 import 'package:analyzer/src/generated/sdk.dart'; 38 import 'package:analyzer/src/generated/sdk.dart';
(...skipping 4016 matching lines...) Expand 10 before | Expand all | Expand 10 after
4054 Parser parser = new Parser(_source, errorListener); 4055 Parser parser = new Parser(_source, errorListener);
4055 AnalysisOptions options = context.analysisOptions; 4056 AnalysisOptions options = context.analysisOptions;
4056 parser.enableAssertInitializer = options.enableAssertInitializer; 4057 parser.enableAssertInitializer = options.enableAssertInitializer;
4057 parser.parseFunctionBodies = 4058 parser.parseFunctionBodies =
4058 options.analyzeFunctionBodiesPredicate(_source); 4059 options.analyzeFunctionBodiesPredicate(_source);
4059 parser.parseGenericMethodComments = options.strongMode; 4060 parser.parseGenericMethodComments = options.strongMode;
4060 parser.enableUriInPartOf = options.enableUriInPartOf; 4061 parser.enableUriInPartOf = options.enableUriInPartOf;
4061 CompilationUnit unit = parser.parseCompilationUnit(tokenStream); 4062 CompilationUnit unit = parser.parseCompilationUnit(tokenStream);
4062 unit.lineInfo = lineInfo; 4063 unit.lineInfo = lineInfo;
4063 4064
4064 if (options.patchPlatform != 0 && _source.uri.scheme == 'dart') { 4065 if (options.patchPaths.isNotEmpty && _source.uri.scheme == 'dart') {
4065 new SdkPatcher().patch(context.sourceFactory.dartSdk, 4066 var resourceProvider =
4066 options.patchPlatform, errorListener, _source, unit); 4067 (context.sourceFactory.dartSdk as FolderBasedDartSdk)
scheglov 2016/12/09 22:54:06 Will this work for MockSdk(s)?
Paul Berry 2016/12/09 23:00:30 Probably not, but I think that's ok. We only use
4068 .resourceProvider;
4069 new SdkPatcher().patch(
4070 resourceProvider,
4071 context.analysisOptions.strongMode,
4072 context.analysisOptions.patchPaths,
4073 errorListener,
4074 _source,
4075 unit);
4067 } 4076 }
4068 4077
4069 bool hasNonPartOfDirective = false; 4078 bool hasNonPartOfDirective = false;
4070 bool hasPartOfDirective = false; 4079 bool hasPartOfDirective = false;
4071 HashSet<Source> explicitlyImportedSourceSet = new HashSet<Source>(); 4080 HashSet<Source> explicitlyImportedSourceSet = new HashSet<Source>();
4072 HashSet<Source> exportedSourceSet = new HashSet<Source>(); 4081 HashSet<Source> exportedSourceSet = new HashSet<Source>();
4073 HashSet<Source> includedSourceSet = new HashSet<Source>(); 4082 HashSet<Source> includedSourceSet = new HashSet<Source>();
4074 NodeList<Directive> directives = unit.directives; 4083 NodeList<Directive> directives = unit.directives;
4075 int length = directives.length; 4084 int length = directives.length;
4076 for (int i = 0; i < length; i++) { 4085 for (int i = 0; i < length; i++) {
(...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after
6497 6506
6498 @override 6507 @override
6499 bool moveNext() { 6508 bool moveNext() {
6500 if (_newSources.isEmpty) { 6509 if (_newSources.isEmpty) {
6501 return false; 6510 return false;
6502 } 6511 }
6503 currentTarget = _newSources.removeLast(); 6512 currentTarget = _newSources.removeLast();
6504 return true; 6513 return true;
6505 } 6514 }
6506 } 6515 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698