| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 var kernels = <Uri, Program>{}; | 65 var kernels = <Uri, Program>{}; |
| 66 for (Uri uri in deltaLibraries.newState.keys) { | 66 for (Uri uri in deltaLibraries.newState.keys) { |
| 67 // The kernel generation code doesn't currently support building a kernel | 67 // The kernel generation code doesn't currently support building a kernel |
| 68 // directly from resolved ASTs--it wants to query an analysis context. So | 68 // directly from resolved ASTs--it wants to query an analysis context. So |
| 69 // we provide it with a proxy analysis context that feeds it the resolved | 69 // we provide it with a proxy analysis context that feeds it the resolved |
| 70 // ASTs. | 70 // ASTs. |
| 71 var strongMode = true; // TODO(paulberry): set this correctly | 71 var strongMode = true; // TODO(paulberry): set this correctly |
| 72 var analysisOptions = new _AnalysisOptionsProxy(strongMode); | 72 var analysisOptions = new _AnalysisOptionsProxy(strongMode); |
| 73 var context = | 73 var context = |
| 74 new _AnalysisContextProxy(deltaLibraries.newState, analysisOptions); | 74 new _AnalysisContextProxy(deltaLibraries.newState, analysisOptions); |
| 75 var repository = new Repository(); | 75 var program = new Program(); |
| 76 var loader = | 76 var loader = |
| 77 new DartLoader(repository, kernelOptions, packages, context: context); | 77 new DartLoader(program, kernelOptions, packages, context: context); |
| 78 loader.loadLibrary(uri); | 78 loader.loadLibrary(uri); |
| 79 kernels[uri] = new Program(repository.libraries); | 79 kernels[uri] = program; |
| 80 // TODO(paulberry) rework watch invocation to eliminate race condition, | 80 // TODO(paulberry) rework watch invocation to eliminate race condition, |
| 81 // include part source files, and prevent watch from being a bottleneck | 81 // include part source files, and prevent watch from being a bottleneck |
| 82 if (watch != null) await watch(uri, true); | 82 if (watch != null) await watch(uri, true); |
| 83 } | 83 } |
| 84 // TODO(paulberry) invoke watch with used=false for each unused source | 84 // TODO(paulberry) invoke watch with used=false for each unused source |
| 85 return new DeltaProgram(kernels); | 85 return new DeltaProgram(kernels); |
| 86 } | 86 } |
| 87 | 87 |
| 88 @override | 88 @override |
| 89 void invalidate(String path) => _resolvedAstGenerator.invalidate(path); | 89 void invalidate(String path) => _resolvedAstGenerator.invalidate(path); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 Source forUri2(Uri absoluteUri) => new _SourceProxy(absoluteUri); | 143 Source forUri2(Uri absoluteUri) => new _SourceProxy(absoluteUri); |
| 144 | 144 |
| 145 noSuchMethod(Invocation invocation) => unimplemented(); | 145 noSuchMethod(Invocation invocation) => unimplemented(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 class _SourceProxy extends BasicSource { | 148 class _SourceProxy extends BasicSource { |
| 149 _SourceProxy(Uri uri) : super(uri); | 149 _SourceProxy(Uri uri) : super(uri); |
| 150 | 150 |
| 151 noSuchMethod(Invocation invocation) => unimplemented(); | 151 noSuchMethod(Invocation invocation) => unimplemented(); |
| 152 } | 152 } |
| OLD | NEW |