Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address Kevin's comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/testing/suite.dart ('k') | pkg/front_end/test/fasta/compile.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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';
11 import 'package:analyzer/src/generated/engine.dart'; 11 import 'package:analyzer/src/generated/engine.dart';
12 import 'package:analyzer/src/generated/source.dart'; 12 import 'package:analyzer/src/generated/source.dart';
13 import 'package:front_end/incremental_kernel_generator.dart'; 13 import 'package:front_end/incremental_kernel_generator.dart';
14 import 'package:front_end/incremental_resolved_ast_generator.dart'; 14 import 'package:front_end/incremental_resolved_ast_generator.dart';
15 import 'package:front_end/src/base/processed_options.dart'; 15 import 'package:front_end/src/base/processed_options.dart';
16 import 'package:front_end/src/base/source.dart'; 16 import 'package:front_end/src/base/source.dart';
17 import 'package:front_end/src/incremental_resolved_ast_generator_impl.dart'; 17 import 'package:front_end/src/incremental_resolved_ast_generator_impl.dart';
18 import 'package:kernel/analyzer/loader.dart'; 18 import 'package:kernel/analyzer/loader.dart';
19 import 'package:kernel/kernel.dart' hide Source; 19 import 'package:kernel/kernel.dart' hide Source;
20 import 'package:kernel/repository.dart';
21 20
22 dynamic unimplemented() { 21 dynamic unimplemented() {
23 // TODO(paulberry): get rid of this. 22 // TODO(paulberry): get rid of this.
24 throw new UnimplementedError(); 23 throw new UnimplementedError();
25 } 24 }
26 25
27 DartOptions _convertOptions(ProcessedOptions options) { 26 DartOptions _convertOptions(ProcessedOptions options) {
28 // TODO(paulberry): make sure options.compileSdk is handled correctly. 27 // TODO(paulberry): make sure options.compileSdk is handled correctly.
29 return new DartOptions( 28 return new DartOptions(
30 strongMode: true, // TODO(paulberry): options.strongMode, 29 strongMode: true, // TODO(paulberry): options.strongMode,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 var kernels = <Uri, Program>{}; 64 var kernels = <Uri, Program>{};
66 for (Uri uri in deltaLibraries.newState.keys) { 65 for (Uri uri in deltaLibraries.newState.keys) {
67 // The kernel generation code doesn't currently support building a kernel 66 // The kernel generation code doesn't currently support building a kernel
68 // directly from resolved ASTs--it wants to query an analysis context. So 67 // 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 68 // we provide it with a proxy analysis context that feeds it the resolved
70 // ASTs. 69 // ASTs.
71 var strongMode = true; // TODO(paulberry): set this correctly 70 var strongMode = true; // TODO(paulberry): set this correctly
72 var analysisOptions = new _AnalysisOptionsProxy(strongMode); 71 var analysisOptions = new _AnalysisOptionsProxy(strongMode);
73 var context = 72 var context =
74 new _AnalysisContextProxy(deltaLibraries.newState, analysisOptions); 73 new _AnalysisContextProxy(deltaLibraries.newState, analysisOptions);
75 var repository = new Repository(); 74 var program = new Program();
76 var loader = 75 var loader =
77 new DartLoader(repository, kernelOptions, packages, context: context); 76 new DartLoader(program, kernelOptions, packages, context: context);
78 loader.loadLibrary(uri); 77 loader.loadLibrary(uri);
79 kernels[uri] = new Program(repository.libraries); 78 kernels[uri] = program;
80 // TODO(paulberry) rework watch invocation to eliminate race condition, 79 // TODO(paulberry) rework watch invocation to eliminate race condition,
81 // include part source files, and prevent watch from being a bottleneck 80 // include part source files, and prevent watch from being a bottleneck
82 if (watch != null) await watch(uri, true); 81 if (watch != null) await watch(uri, true);
83 } 82 }
84 // TODO(paulberry) invoke watch with used=false for each unused source 83 // TODO(paulberry) invoke watch with used=false for each unused source
85 return new DeltaProgram(kernels); 84 return new DeltaProgram(kernels);
86 } 85 }
87 86
88 @override 87 @override
89 void invalidate(String path) => _resolvedAstGenerator.invalidate(path); 88 void invalidate(String path) => _resolvedAstGenerator.invalidate(path);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 Source forUri2(Uri absoluteUri) => new _SourceProxy(absoluteUri); 137 Source forUri2(Uri absoluteUri) => new _SourceProxy(absoluteUri);
139 138
140 noSuchMethod(Invocation invocation) => unimplemented(); 139 noSuchMethod(Invocation invocation) => unimplemented();
141 } 140 }
142 141
143 class _SourceProxy extends BasicSource { 142 class _SourceProxy extends BasicSource {
144 _SourceProxy(Uri uri) : super(uri); 143 _SourceProxy(Uri uri) : super(uri);
145 144
146 noSuchMethod(Invocation invocation) => unimplemented(); 145 noSuchMethod(Invocation invocation) => unimplemented();
147 } 146 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/testing/suite.dart ('k') | pkg/front_end/test/fasta/compile.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698