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 analysis.server; | 5 library analysis.server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:math' show max; | 9 import 'dart:math' show max; |
10 | 10 |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 557 |
558 /** | 558 /** |
559 * Returns resolved [AstNode]s at the given [offset] of the given [file]. | 559 * Returns resolved [AstNode]s at the given [offset] of the given [file]. |
560 * | 560 * |
561 * May be empty, but not `null`. | 561 * May be empty, but not `null`. |
562 */ | 562 */ |
563 List<AstNode> getNodesAtOffset(String file, int offset) { | 563 List<AstNode> getNodesAtOffset(String file, int offset) { |
564 List<CompilationUnit> units = getResolvedCompilationUnits(file); | 564 List<CompilationUnit> units = getResolvedCompilationUnits(file); |
565 List<AstNode> nodes = <AstNode>[]; | 565 List<AstNode> nodes = <AstNode>[]; |
566 for (CompilationUnit unit in units) { | 566 for (CompilationUnit unit in units) { |
567 AstNode node = new NodeLocator.con1(offset).searchWithin(unit); | 567 AstNode node = new NodeLocator(offset).searchWithin(unit); |
568 if (node != null) { | 568 if (node != null) { |
569 nodes.add(node); | 569 nodes.add(node); |
570 } | 570 } |
571 } | 571 } |
572 return nodes; | 572 return nodes; |
573 } | 573 } |
574 | 574 |
575 /** | 575 /** |
576 * Returns resolved [CompilationUnit]s of the Dart file with the given [path]. | 576 * Returns resolved [CompilationUnit]s of the Dart file with the given [path]. |
577 * | 577 * |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 /** | 1132 /** |
1133 * Use the given updaters to update the values of the options in every | 1133 * Use the given updaters to update the values of the options in every |
1134 * existing analysis context. | 1134 * existing analysis context. |
1135 */ | 1135 */ |
1136 void updateOptions(List<OptionUpdater> optionUpdaters) { | 1136 void updateOptions(List<OptionUpdater> optionUpdaters) { |
1137 // | 1137 // |
1138 // Update existing contexts. | 1138 // Update existing contexts. |
1139 // | 1139 // |
1140 folderMap.forEach((Folder folder, AnalysisContext context) { | 1140 folderMap.forEach((Folder folder, AnalysisContext context) { |
1141 AnalysisOptionsImpl options = | 1141 AnalysisOptionsImpl options = |
1142 new AnalysisOptionsImpl.con1(context.analysisOptions); | 1142 new AnalysisOptionsImpl.from(context.analysisOptions); |
1143 optionUpdaters.forEach((OptionUpdater optionUpdater) { | 1143 optionUpdaters.forEach((OptionUpdater optionUpdater) { |
1144 optionUpdater(options); | 1144 optionUpdater(options); |
1145 }); | 1145 }); |
1146 context.analysisOptions = options; | 1146 context.analysisOptions = options; |
1147 }); | 1147 }); |
1148 // | 1148 // |
1149 // Update the defaults used to create new contexts. | 1149 // Update the defaults used to create new contexts. |
1150 // | 1150 // |
1151 AnalysisOptionsImpl options = contextDirectoryManager.defaultOptions; | 1151 AnalysisOptionsImpl options = contextDirectoryManager.defaultOptions; |
1152 optionUpdaters.forEach((OptionUpdater optionUpdater) { | 1152 optionUpdaters.forEach((OptionUpdater optionUpdater) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 Stream<ContextsChangedEvent> get onContextsChanged => | 1314 Stream<ContextsChangedEvent> get onContextsChanged => |
1315 _onContextsChangedController.stream; | 1315 _onContextsChangedController.stream; |
1316 | 1316 |
1317 @override | 1317 @override |
1318 AnalysisContext addContext(Folder folder, UriResolver packageUriResolver) { | 1318 AnalysisContext addContext(Folder folder, UriResolver packageUriResolver) { |
1319 InternalAnalysisContext context = | 1319 InternalAnalysisContext context = |
1320 AnalysisEngine.instance.createAnalysisContext(); | 1320 AnalysisEngine.instance.createAnalysisContext(); |
1321 context.contentCache = analysisServer.overlayState; | 1321 context.contentCache = analysisServer.overlayState; |
1322 analysisServer.folderMap[folder] = context; | 1322 analysisServer.folderMap[folder] = context; |
1323 context.sourceFactory = _createSourceFactory(packageUriResolver); | 1323 context.sourceFactory = _createSourceFactory(packageUriResolver); |
1324 context.analysisOptions = new AnalysisOptionsImpl.con1(defaultOptions); | 1324 context.analysisOptions = new AnalysisOptionsImpl.from(defaultOptions); |
1325 _onContextsChangedController | 1325 _onContextsChangedController |
1326 .add(new ContextsChangedEvent(added: [context])); | 1326 .add(new ContextsChangedEvent(added: [context])); |
1327 analysisServer.schedulePerformAnalysisOperation(context); | 1327 analysisServer.schedulePerformAnalysisOperation(context); |
1328 return context; | 1328 return context; |
1329 } | 1329 } |
1330 | 1330 |
1331 @override | 1331 @override |
1332 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { | 1332 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { |
1333 AnalysisContext context = analysisServer.folderMap[contextFolder]; | 1333 AnalysisContext context = analysisServer.folderMap[contextFolder]; |
1334 if (context != null) { | 1334 if (context != null) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 /** | 1500 /** |
1501 * The [PerformanceTag] for time spent in server request handlers. | 1501 * The [PerformanceTag] for time spent in server request handlers. |
1502 */ | 1502 */ |
1503 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1503 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
1504 | 1504 |
1505 /** | 1505 /** |
1506 * The [PerformanceTag] for time spent in split store microtasks. | 1506 * The [PerformanceTag] for time spent in split store microtasks. |
1507 */ | 1507 */ |
1508 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1508 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
1509 } | 1509 } |
OLD | NEW |