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

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

Issue 300043012: Communicate defined variables to the context (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missed type Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_impl; 5 library analyzer_impl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'dart:io'; 9 import 'dart:io';
10 10
11 import 'package:path/path.dart' as pathos; 11 import 'package:path/path.dart' as pathos;
12 12
13 import 'generated/constant.dart';
13 import 'generated/engine.dart'; 14 import 'generated/engine.dart';
14 import 'generated/element.dart'; 15 import 'generated/element.dart';
15 import 'generated/error.dart'; 16 import 'generated/error.dart';
16 import 'generated/java_io.dart'; 17 import 'generated/java_io.dart';
17 import 'generated/sdk.dart'; 18 import 'generated/sdk.dart';
18 import 'generated/sdk_io.dart'; 19 import 'generated/sdk_io.dart';
19 import 'generated/source_io.dart'; 20 import 'generated/source_io.dart';
20 import '../options.dart'; 21 import '../options.dart';
21 22
22 import 'dart:collection'; 23 import 'dart:collection';
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } else { 245 } else {
245 packageDirectory = getPackageDirectoryFor(sourceFile); 246 packageDirectory = getPackageDirectoryFor(sourceFile);
246 } 247 }
247 if (packageDirectory != null) { 248 if (packageDirectory != null) {
248 resolvers.add(new PackageUriResolver([packageDirectory])); 249 resolvers.add(new PackageUriResolver([packageDirectory]));
249 } 250 }
250 } 251 }
251 sourceFactory = new SourceFactory(resolvers); 252 sourceFactory = new SourceFactory(resolvers);
252 context = AnalysisEngine.instance.createAnalysisContext(); 253 context = AnalysisEngine.instance.createAnalysisContext();
253 context.sourceFactory = sourceFactory; 254 context.sourceFactory = sourceFactory;
255 Map<String, String> definedVariables = options.definedVariables;
256 if (!definedVariables.isEmpty) {
257 DeclaredVariables declaredVariables = context.declaredVariables;
258 definedVariables.forEach((String variableName, String value) {
259 declaredVariables.define(variableName, value);
260 });
261 }
254 // Uncomment the following to have errors reported on stdout and stderr 262 // Uncomment the following to have errors reported on stdout and stderr
255 AnalysisEngine.instance.logger = new StdLogger(options.log); 263 AnalysisEngine.instance.logger = new StdLogger(options.log);
256 264
257 // set options for context 265 // set options for context
258 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); 266 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl();
259 contextOptions.cacheSize = _MAX_CACHE_SIZE; 267 contextOptions.cacheSize = _MAX_CACHE_SIZE;
260 contextOptions.hint = !options.disableHints; 268 contextOptions.hint = !options.disableHints;
261 context.analysisOptions = contextOptions; 269 context.analysisOptions = contextOptions;
262 270
263 // Create and add a ChangeSet 271 // Create and add a ChangeSet
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 396 }
389 } 397 }
390 398
391 @override 399 @override
392 void logInformation2(String message, Exception exception) { 400 void logInformation2(String message, Exception exception) {
393 if (log) { 401 if (log) {
394 stdout.writeln(message); 402 stdout.writeln(message);
395 } 403 }
396 } 404 }
397 } 405 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698