| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.sdk.io; | 5 library engine.sdk.io; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/context/context.dart' as newContext; | 9 import 'package:analyzer/src/context/context.dart'; |
| 10 import 'package:analyzer/src/generated/java_engine.dart'; | 10 import 'package:analyzer/src/generated/java_engine.dart'; |
| 11 | 11 |
| 12 import 'ast.dart'; | 12 import 'ast.dart'; |
| 13 import 'engine.dart'; | 13 import 'engine.dart'; |
| 14 import 'error.dart'; | 14 import 'error.dart'; |
| 15 import 'java_core.dart'; | 15 import 'java_core.dart'; |
| 16 import 'java_engine_io.dart'; | 16 import 'java_engine_io.dart'; |
| 17 import 'java_io.dart'; | 17 import 'java_io.dart'; |
| 18 import 'parser.dart'; | 18 import 'parser.dart'; |
| 19 import 'scanner.dart'; | 19 import 'scanner.dart'; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 * should be used when it is available | 235 * should be used when it is available |
| 236 */ | 236 */ |
| 237 DirectoryBasedDartSdk(JavaFile sdkDirectory, [bool useDart2jsPaths = false]) { | 237 DirectoryBasedDartSdk(JavaFile sdkDirectory, [bool useDart2jsPaths = false]) { |
| 238 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); | 238 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); |
| 239 _libraryMap = initialLibraryMap(useDart2jsPaths); | 239 _libraryMap = initialLibraryMap(useDart2jsPaths); |
| 240 } | 240 } |
| 241 | 241 |
| 242 @override | 242 @override |
| 243 AnalysisContext get context { | 243 AnalysisContext get context { |
| 244 if (_analysisContext == null) { | 244 if (_analysisContext == null) { |
| 245 if (AnalysisEngine.instance.useTaskModel) { | 245 _analysisContext = new SdkAnalysisContext(); |
| 246 _analysisContext = new newContext.SdkAnalysisContext(); | |
| 247 } else { | |
| 248 _analysisContext = new SdkAnalysisContext(); | |
| 249 } | |
| 250 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); | 246 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); |
| 251 _analysisContext.sourceFactory = factory; | 247 _analysisContext.sourceFactory = factory; |
| 252 List<String> uris = this.uris; | 248 List<String> uris = this.uris; |
| 253 ChangeSet changeSet = new ChangeSet(); | 249 ChangeSet changeSet = new ChangeSet(); |
| 254 for (String uri in uris) { | 250 for (String uri in uris) { |
| 255 changeSet.addedSource(factory.forUri(uri)); | 251 changeSet.addedSource(factory.forUri(uri)); |
| 256 } | 252 } |
| 257 _analysisContext.applyChanges(changeSet); | 253 _analysisContext.applyChanges(changeSet); |
| 258 } | 254 } |
| 259 return _analysisContext; | 255 return _analysisContext; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 597 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
| 602 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 598 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
| 603 // If any syntactic errors were found then don't try to visit the AST | 599 // If any syntactic errors were found then don't try to visit the AST |
| 604 // structure. | 600 // structure. |
| 605 if (!errorListener.errorReported) { | 601 if (!errorListener.errorReported) { |
| 606 unit.accept(libraryBuilder); | 602 unit.accept(libraryBuilder); |
| 607 } | 603 } |
| 608 return libraryBuilder.librariesMap; | 604 return libraryBuilder.librariesMap; |
| 609 } | 605 } |
| 610 } | 606 } |
| OLD | NEW |