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.source.embedder; | 5 library analyzer.source.embedder; |
6 | 6 |
7 import 'dart:collection' show HashMap; | 7 import 'dart:collection' show HashMap; |
8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
9 | 9 |
10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 22 matching lines...) Expand all Loading... |
33 /// The [AnalysisContext] which is used for all of the sources in this sdk. | 33 /// The [AnalysisContext] which is used for all of the sources in this sdk. |
34 InternalAnalysisContext _analysisContext; | 34 InternalAnalysisContext _analysisContext; |
35 | 35 |
36 /// The library map that is populated by visiting the AST structure parsed fro
m | 36 /// The library map that is populated by visiting the AST structure parsed fro
m |
37 /// the contents of the libraries file. | 37 /// the contents of the libraries file. |
38 final LibraryMap _librariesMap = new LibraryMap(); | 38 final LibraryMap _librariesMap = new LibraryMap(); |
39 | 39 |
40 @override | 40 @override |
41 AnalysisContext get context { | 41 AnalysisContext get context { |
42 if (_analysisContext == null) { | 42 if (_analysisContext == null) { |
43 _analysisContext = new SdkAnalysisContext(); | 43 _analysisContext = new SdkAnalysisContext(null); |
44 SourceFactory factory = new SourceFactory([_resolver]); | 44 SourceFactory factory = new SourceFactory([_resolver]); |
45 _analysisContext.sourceFactory = factory; | 45 _analysisContext.sourceFactory = factory; |
46 List<String> uris = this.uris; | 46 List<String> uris = this.uris; |
47 ChangeSet changeSet = new ChangeSet(); | 47 ChangeSet changeSet = new ChangeSet(); |
48 for (String uri in uris) { | 48 for (String uri in uris) { |
49 changeSet.addedSource(factory.forUri(uri)); | 49 changeSet.addedSource(factory.forUri(uri)); |
50 } | 50 } |
51 _analysisContext.applyChanges(changeSet); | 51 _analysisContext.applyChanges(changeSet); |
52 } | 52 } |
53 return _analysisContext; | 53 return _analysisContext; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 String _readEmbedderYaml(Folder libDir) { | 289 String _readEmbedderYaml(Folder libDir) { |
290 File file = libDir.getChild(EMBEDDER_FILE_NAME); | 290 File file = libDir.getChild(EMBEDDER_FILE_NAME); |
291 try { | 291 try { |
292 return file.readAsStringSync(); | 292 return file.readAsStringSync(); |
293 } on FileSystemException { | 293 } on FileSystemException { |
294 // File can't be read. | 294 // File can't be read. |
295 return null; | 295 return null; |
296 } | 296 } |
297 } | 297 } |
298 } | 298 } |
OLD | NEW |