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

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: Addressed comments 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 314
314 final Program binary = dillTarget.loader.program; 315 final Program binary = dillTarget.loader.program;
315 if (binary != null) { 316 if (binary != null) {
316 libraries.addAll(binary.libraries); 317 libraries.addAll(binary.libraries);
317 uriToSource.addAll(binary.uriToSource); 318 uriToSource.addAll(binary.uriToSource);
318 } 319 }
319 320
320 // TODO(ahe): Remove this line. Kernel seems to generate a default line map 321 // TODO(ahe): Remove this line. Kernel seems to generate a default line map
321 // that used when there's no fileUri on an element. Instead, ensure all 322 // that used when there's no fileUri on an element. Instead, ensure all
322 // elements have a fileUri. 323 // elements have a fileUri.
323 uriToSource[""] = new Source(<int>[0], ""); 324 uriToSource[""] = new Source(<int>[0], const <int>[]);
324 Program program = new Program(libraries, uriToSource); 325 Program program = new Program(libraries, uriToSource);
325 if (loader.first != null) { 326 if (loader.first != null) {
326 Builder builder = loader.first.members["main"]; 327 Builder builder = loader.first.members["main"];
327 if (builder is KernelProcedureBuilder) { 328 if (builder is KernelProcedureBuilder) {
328 program.mainMethod = builder.procedure; 329 program.mainMethod = builder.procedure;
329 } 330 }
330 } 331 }
331 if (errors.isEmpty || dillTarget.isLoaded) { 332 if (errors.isEmpty || dillTarget.isLoaded) {
332 setup_builtin_library.transformProgram(program); 333 setup_builtin_library.transformProgram(program);
333 } 334 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 } 604 }
604 for (Constructor constructor in superclass.constructors) { 605 for (Constructor constructor in superclass.constructors) {
605 if (constructor.name.name.isEmpty) { 606 if (constructor.name.name.isEmpty) {
606 return constructor.function.requiredParameterCount == 0 607 return constructor.function.requiredParameterCount == 0
607 ? constructor 608 ? constructor
608 : null; 609 : null;
609 } 610 }
610 } 611 }
611 return null; 612 return null;
612 } 613 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698