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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2654663005: Add DeclaredVariables to AnalysisDriver. (Closed)
Patch Set: Created 3 years, 10 months 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
OLDNEW
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:collection'; 6 import 'dart:collection';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import 'package:analyzer/context/declared_variables.dart';
9 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement; 11 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement;
11 import 'package:analyzer/error/error.dart'; 12 import 'package:analyzer/error/error.dart';
12 import 'package:analyzer/error/listener.dart'; 13 import 'package:analyzer/error/listener.dart';
13 import 'package:analyzer/exception/exception.dart'; 14 import 'package:analyzer/exception/exception.dart';
14 import 'package:analyzer/file_system/file_system.dart'; 15 import 'package:analyzer/file_system/file_system.dart';
15 import 'package:analyzer/src/context/context.dart'; 16 import 'package:analyzer/src/context/context.dart';
16 import 'package:analyzer/src/dart/analysis/byte_store.dart'; 17 import 'package:analyzer/src/dart/analysis/byte_store.dart';
17 import 'package:analyzer/src/dart/analysis/file_state.dart'; 18 import 'package:analyzer/src/dart/analysis/file_state.dart';
18 import 'package:analyzer/src/dart/analysis/index.dart'; 19 import 'package:analyzer/src/dart/analysis/index.dart';
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 */ 115 */
115 AnalysisOptions _analysisOptions; 116 AnalysisOptions _analysisOptions;
116 117
117 /** 118 /**
118 * The [SourceFactory] is used to resolve URIs to paths and restore URIs 119 * The [SourceFactory] is used to resolve URIs to paths and restore URIs
119 * from file paths. 120 * from file paths.
120 */ 121 */
121 SourceFactory _sourceFactory; 122 SourceFactory _sourceFactory;
122 123
123 /** 124 /**
125 * The declared environment variables.
126 */
127 final DeclaredVariables declaredVariables = new DeclaredVariables();
128
129 /**
124 * The salt to mix into all hashes used as keys for serialized data. 130 * The salt to mix into all hashes used as keys for serialized data.
125 */ 131 */
126 final Uint32List _salt = new Uint32List(1 + AnalysisOptions.signatureLength); 132 final Uint32List _salt = new Uint32List(1 + AnalysisOptions.signatureLength);
127 133
128 /** 134 /**
129 * The current file system state. 135 * The current file system state.
130 */ 136 */
131 FileSystemState _fsState; 137 FileSystemState _fsState;
132 138
133 /** 139 /**
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 } finally { 758 } finally {
753 analysisContext.dispose(); 759 analysisContext.dispose();
754 } 760 }
755 } 761 }
756 762
757 AnalysisContext _createAnalysisContext(_LibraryContext libraryContext) { 763 AnalysisContext _createAnalysisContext(_LibraryContext libraryContext) {
758 AnalysisContextImpl analysisContext = 764 AnalysisContextImpl analysisContext =
759 AnalysisEngine.instance.createAnalysisContext(); 765 AnalysisEngine.instance.createAnalysisContext();
760 analysisContext.useSdkCachePartition = false; 766 analysisContext.useSdkCachePartition = false;
761 analysisContext.analysisOptions = _analysisOptions; 767 analysisContext.analysisOptions = _analysisOptions;
768 analysisContext.declaredVariables.addAll(declaredVariables);
762 analysisContext.sourceFactory = _sourceFactory.clone(); 769 analysisContext.sourceFactory = _sourceFactory.clone();
763 analysisContext.contentCache = new _ContentCacheWrapper(_fsState); 770 analysisContext.contentCache = new _ContentCacheWrapper(_fsState);
764 analysisContext.resultProvider = 771 analysisContext.resultProvider =
765 new InputPackagesResultProvider(analysisContext, libraryContext.store); 772 new InputPackagesResultProvider(analysisContext, libraryContext.store);
766 return analysisContext; 773 return analysisContext;
767 } 774 }
768 775
769 /** 776 /**
770 * Return the context in which the [library] should be analyzed it. 777 * Return the context in which the [library] should be analyzed it.
771 */ 778 */
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 libraryDeclarations.add(new TopLevelDeclarationInSource( 1697 libraryDeclarations.add(new TopLevelDeclarationInSource(
1691 file.source, declaration, isExported)); 1698 file.source, declaration, isExported));
1692 } 1699 }
1693 } 1700 }
1694 } 1701 }
1695 1702
1696 // We're not done yet. 1703 // We're not done yet.
1697 return false; 1704 return false;
1698 } 1705 }
1699 } 1706 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/context/declared_variables.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698