| OLD | NEW |
| 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 library analyzer.test.generated.analysis_context_factory; | 5 library analyzer.test.generated.analysis_context_factory; |
| 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/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 494 |
| 495 /** | 495 /** |
| 496 * Creates new [AnalysisContext] using [AnalysisContextFactory]. | 496 * Creates new [AnalysisContext] using [AnalysisContextFactory]. |
| 497 */ | 497 */ |
| 498 AnalysisContextHelper( | 498 AnalysisContextHelper( |
| 499 [AnalysisOptionsImpl options, ResourceProvider provider]) { | 499 [AnalysisOptionsImpl options, ResourceProvider provider]) { |
| 500 resourceProvider = provider ?? new MemoryResourceProvider(); | 500 resourceProvider = provider ?? new MemoryResourceProvider(); |
| 501 if (options == null) { | 501 if (options == null) { |
| 502 options = new AnalysisOptionsImpl(); | 502 options = new AnalysisOptionsImpl(); |
| 503 } | 503 } |
| 504 options.cacheSize = 256; | |
| 505 context = AnalysisContextFactory.contextWithCoreAndOptions(options, | 504 context = AnalysisContextFactory.contextWithCoreAndOptions(options, |
| 506 resourceProvider: resourceProvider); | 505 resourceProvider: resourceProvider); |
| 507 } | 506 } |
| 508 | 507 |
| 509 Source addSource(String path, String code) { | 508 Source addSource(String path, String code) { |
| 510 Source source = new FileSource(resourceProvider.getFile(path)); | 509 Source source = new FileSource(resourceProvider.getFile(path)); |
| 511 if (path.endsWith(".dart") || path.endsWith(".html")) { | 510 if (path.endsWith(".dart") || path.endsWith(".html")) { |
| 512 ChangeSet changeSet = new ChangeSet(); | 511 ChangeSet changeSet = new ChangeSet(); |
| 513 changeSet.addedSource(source); | 512 changeSet.addedSource(source); |
| 514 context.applyChanges(changeSet); | 513 context.applyChanges(changeSet); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 572 |
| 574 void _addLibrary(LibraryMap map, String uri, bool isInternal, String path) { | 573 void _addLibrary(LibraryMap map, String uri, bool isInternal, String path) { |
| 575 SdkLibraryImpl library = new SdkLibraryImpl(uri); | 574 SdkLibraryImpl library = new SdkLibraryImpl(uri); |
| 576 if (isInternal) { | 575 if (isInternal) { |
| 577 library.category = "Internal"; | 576 library.category = "Internal"; |
| 578 } | 577 } |
| 579 library.path = path; | 578 library.path = path; |
| 580 map.setLibrary(uri, library); | 579 map.setLibrary(uri, library); |
| 581 } | 580 } |
| 582 } | 581 } |
| OLD | NEW |