| 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 analyzer.test.src.context.context_test; | 5 library analyzer.test.src.context.context_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 | 2531 |
| 2532 void test_resolveCompilationUnit_source() { | 2532 void test_resolveCompilationUnit_source() { |
| 2533 Source source = addSource("/lib.dart", "library lib;"); | 2533 Source source = addSource("/lib.dart", "library lib;"); |
| 2534 CompilationUnit compilationUnit = | 2534 CompilationUnit compilationUnit = |
| 2535 context.resolveCompilationUnit2(source, source); | 2535 context.resolveCompilationUnit2(source, source); |
| 2536 expect(compilationUnit, isNotNull); | 2536 expect(compilationUnit, isNotNull); |
| 2537 } | 2537 } |
| 2538 | 2538 |
| 2539 void test_setAnalysisOptions() { | 2539 void test_setAnalysisOptions() { |
| 2540 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 2540 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2541 options.cacheSize = 42; | |
| 2542 options.dart2jsHint = false; | 2541 options.dart2jsHint = false; |
| 2543 options.hint = false; | 2542 options.hint = false; |
| 2544 context.analysisOptions = options; | 2543 context.analysisOptions = options; |
| 2545 AnalysisOptions result = context.analysisOptions; | 2544 AnalysisOptions result = context.analysisOptions; |
| 2546 expect(result.cacheSize, options.cacheSize); | |
| 2547 expect(result.dart2jsHint, options.dart2jsHint); | 2545 expect(result.dart2jsHint, options.dart2jsHint); |
| 2548 expect(result.hint, options.hint); | 2546 expect(result.hint, options.hint); |
| 2549 } | 2547 } |
| 2550 | 2548 |
| 2551 void test_setAnalysisPriorityOrder() { | 2549 void test_setAnalysisPriorityOrder() { |
| 2552 int priorityCount = 4; | 2550 int priorityCount = 4; |
| 2553 List<Source> sources = <Source>[]; | 2551 List<Source> sources = <Source>[]; |
| 2554 for (int index = 0; index < priorityCount; index++) { | 2552 for (int index = 0; index < priorityCount; index++) { |
| 2555 sources.add(addSource("/lib.dart$index", "")); | 2553 sources.add(addSource("/lib.dart$index", "")); |
| 2556 } | 2554 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2726 // delete a.dart | 2724 // delete a.dart |
| 2727 resourceProvider.deleteFile('/a.dart'); | 2725 resourceProvider.deleteFile('/a.dart'); |
| 2728 // analysis should eventually stop | 2726 // analysis should eventually stop |
| 2729 _analyzeAll_assertFinished(); | 2727 _analyzeAll_assertFinished(); |
| 2730 } | 2728 } |
| 2731 | 2729 |
| 2732 void xtest_performAnalysisTask_stress() { | 2730 void xtest_performAnalysisTask_stress() { |
| 2733 int maxCacheSize = 4; | 2731 int maxCacheSize = 4; |
| 2734 AnalysisOptionsImpl options = | 2732 AnalysisOptionsImpl options = |
| 2735 new AnalysisOptionsImpl.from(context.analysisOptions); | 2733 new AnalysisOptionsImpl.from(context.analysisOptions); |
| 2736 options.cacheSize = maxCacheSize; | |
| 2737 context.analysisOptions = options; | 2734 context.analysisOptions = options; |
| 2738 int sourceCount = maxCacheSize + 2; | 2735 int sourceCount = maxCacheSize + 2; |
| 2739 List<Source> sources = <Source>[]; | 2736 List<Source> sources = <Source>[]; |
| 2740 ChangeSet changeSet = new ChangeSet(); | 2737 ChangeSet changeSet = new ChangeSet(); |
| 2741 for (int i = 0; i < sourceCount; i++) { | 2738 for (int i = 0; i < sourceCount; i++) { |
| 2742 Source source = addSource("/lib$i.dart", "library lib$i;"); | 2739 Source source = addSource("/lib$i.dart", "library lib$i;"); |
| 2743 sources.add(source); | 2740 sources.add(source); |
| 2744 changeSet.addedSource(source); | 2741 changeSet.addedSource(source); |
| 2745 } | 2742 } |
| 2746 context.applyChanges(changeSet); | 2743 context.applyChanges(changeSet); |
| (...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5270 * Initialize the visitor. | 5267 * Initialize the visitor. |
| 5271 */ | 5268 */ |
| 5272 _ElementGatherer(); | 5269 _ElementGatherer(); |
| 5273 | 5270 |
| 5274 @override | 5271 @override |
| 5275 void visitElement(Element element) { | 5272 void visitElement(Element element) { |
| 5276 elements[element] = element; | 5273 elements[element] = element; |
| 5277 super.visitElement(element); | 5274 super.visitElement(element); |
| 5278 } | 5275 } |
| 5279 } | 5276 } |
| OLD | NEW |