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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_target.dart

Issue 2729913005: [Fasta] include source code in dill (Closed)
Patch Set: Use Uint8List.view when possible Created 3 years, 9 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
OLDNEW
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 fasta.kernel_target; 5 library fasta.kernel_target;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show File, IOSink; 9 import 'dart:io' show File, IOSink;
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 [Map<String, Source> uriToSource]) 99 [Map<String, Source> uriToSource])
100 : dillTarget = dillTarget, 100 : dillTarget = dillTarget,
101 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, 101 uriToSource = uriToSource ?? CompilerContext.current.uriToSource,
102 super(dillTarget.ticker, uriTranslator) { 102 super(dillTarget.ticker, uriTranslator) {
103 resetCrashReporting(); 103 resetCrashReporting();
104 loader = createLoader(); 104 loader = createLoader();
105 } 105 }
106 106
107 SourceLoader<Library> createLoader() => new SourceLoader<Library>(this); 107 SourceLoader<Library> createLoader() => new SourceLoader<Library>(this);
108 108
109 void addLineStarts(Uri uri, List<int> lineStarts) { 109 void addSourceInformation(
110 Uri uri, List<int> lineStarts, List<int> sourceCode) {
110 String fileUri = relativizeUri(uri); 111 String fileUri = relativizeUri(uri);
111 uriToSource[fileUri] = new Source(lineStarts, fileUri); 112 uriToSource[fileUri] = new Source(lineStarts, sourceCode);
112 } 113 }
113 114
114 void read(Uri uri) { 115 void read(Uri uri) {
115 loader.read(uri); 116 loader.read(uri);
116 } 117 }
117 118
118 LibraryBuilder createLibraryBuilder(Uri uri, Uri fileUri) { 119 LibraryBuilder createLibraryBuilder(Uri uri, Uri fileUri) {
119 if (dillTarget.isLoaded) { 120 if (dillTarget.isLoaded) {
120 var builder = dillTarget.loader.builders[uri]; 121 var builder = dillTarget.loader.builders[uri];
121 if (builder != null) { 122 if (builder != null) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 311
311 final Program binary = dillTarget.loader.program; 312 final Program binary = dillTarget.loader.program;
312 if (binary != null) { 313 if (binary != null) {
313 libraries.addAll(binary.libraries); 314 libraries.addAll(binary.libraries);
314 uriToSource.addAll(binary.uriToSource); 315 uriToSource.addAll(binary.uriToSource);
315 } 316 }
316 317
317 // TODO(ahe): Remove this line. Kernel seems to generate a default line map 318 // TODO(ahe): Remove this line. Kernel seems to generate a default line map
318 // that used when there's no fileUri on an element. Instead, ensure all 319 // that used when there's no fileUri on an element. Instead, ensure all
319 // elements have a fileUri. 320 // elements have a fileUri.
320 uriToSource[""] = new Source(<int>[0], ""); 321 uriToSource[""] = new Source(<int>[0], const <int>[]);
321 Program program = new Program(libraries, uriToSource); 322 Program program = new Program(libraries, uriToSource);
322 if (loader.first != null) { 323 if (loader.first != null) {
323 Builder builder = loader.first.members["main"]; 324 Builder builder = loader.first.members["main"];
324 if (builder is KernelProcedureBuilder) { 325 if (builder is KernelProcedureBuilder) {
325 program.mainMethod = builder.procedure; 326 program.mainMethod = builder.procedure;
326 } 327 }
327 } 328 }
328 if (errors.isEmpty || dillTarget.isLoaded) { 329 if (errors.isEmpty || dillTarget.isLoaded) {
329 setup_builtin_library.transformProgram(program); 330 setup_builtin_library.transformProgram(program);
330 } 331 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 605 }
605 for (Constructor constructor in superclass.constructors) { 606 for (Constructor constructor in superclass.constructors) {
606 if (constructor.name.name.isEmpty) { 607 if (constructor.name.name.isEmpty) {
607 return constructor.function.requiredParameterCount == 0 608 return constructor.function.requiredParameterCount == 0
608 ? constructor 609 ? constructor
609 : null; 610 : null;
610 } 611 }
611 } 612 }
612 return null; 613 return null;
613 } 614 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/dill/dill_target.dart ('k') | pkg/front_end/lib/src/fasta/source/source_loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698