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

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

Issue 2895983002: Read SDK and patches from a JSON file. (Closed)
Patch Set: Created 3 years, 7 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; 9 import 'dart:io' show File;
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void addSourceInformation( 129 void addSourceInformation(
130 Uri uri, List<int> lineStarts, List<int> sourceCode) { 130 Uri uri, List<int> lineStarts, List<int> sourceCode) {
131 String fileUri = relativizeUri(uri); 131 String fileUri = relativizeUri(uri);
132 uriToSource[fileUri] = new Source(lineStarts, sourceCode); 132 uriToSource[fileUri] = new Source(lineStarts, sourceCode);
133 } 133 }
134 134
135 void read(Uri uri) { 135 void read(Uri uri) {
136 loader.read(uri); 136 loader.read(uri);
137 } 137 }
138 138
139 LibraryBuilder createLibraryBuilder(Uri uri, Uri fileUri) { 139 LibraryBuilder createLibraryBuilder(Uri uri, Uri fileUri, bool isPatch) {
140 if (dillTarget.isLoaded) { 140 if (dillTarget.isLoaded) {
141 var builder = dillTarget.loader.builders[uri]; 141 var builder = dillTarget.loader.builders[uri];
142 if (builder != null) { 142 if (builder != null) {
143 return builder; 143 return builder;
144 } 144 }
145 } 145 }
146 return new KernelLibraryBuilder(uri, fileUri, loader); 146 return new KernelLibraryBuilder(uri, fileUri, loader, isPatch);
147 } 147 }
148 148
149 void forEachDirectSupertype(ClassBuilder cls, void f(NamedTypeBuilder type)) { 149 void forEachDirectSupertype(ClassBuilder cls, void f(NamedTypeBuilder type)) {
150 TypeBuilder supertype = cls.supertype; 150 TypeBuilder supertype = cls.supertype;
151 if (supertype is NamedTypeBuilder) { 151 if (supertype is NamedTypeBuilder) {
152 f(supertype); 152 f(supertype);
153 } else if (supertype != null) { 153 } else if (supertype != null) {
154 internalError("Unhandled: ${supertype.runtimeType}"); 154 internalError("Unhandled: ${supertype.runtimeType}");
155 } 155 }
156 if (cls.interfaces != null) { 156 if (cls.interfaces != null) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 345 }
346 sb.writeln(); 346 sb.writeln();
347 await new File.fromUri(depsFile).writeAsString("$sb"); 347 await new File.fromUri(depsFile).writeAsString("$sb");
348 ticker.logMs("Wrote deps file"); 348 ticker.logMs("Wrote deps file");
349 } 349 }
350 350
351 Program erroneousProgram(bool isFullProgram) { 351 Program erroneousProgram(bool isFullProgram) {
352 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); 352 Uri uri = loader.first?.uri ?? Uri.parse("error:error");
353 Uri fileUri = loader.first?.fileUri ?? uri; 353 Uri fileUri = loader.first?.fileUri ?? uri;
354 KernelLibraryBuilder library = 354 KernelLibraryBuilder library =
355 new KernelLibraryBuilder(uri, fileUri, loader); 355 new KernelLibraryBuilder(uri, fileUri, loader, false);
356 loader.first = library; 356 loader.first = library;
357 if (isFullProgram) { 357 if (isFullProgram) {
358 // If this is an outline, we shouldn't add an executable main 358 // If this is an outline, we shouldn't add an executable main
359 // method. Similarly considerations apply to separate compilation. It 359 // method. Similarly considerations apply to separate compilation. It
360 // could also make sense to add a way to mark .dill files as having 360 // could also make sense to add a way to mark .dill files as having
361 // compile-time errors. 361 // compile-time errors.
362 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0, 362 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0,
363 null, "main", null, null, ProcedureKind.Method, library, -1, -1, -1); 363 null, "main", null, null, ProcedureKind.Method, library, -1, -1, -1);
364 library.addBuilder(mainBuilder.name, mainBuilder, -1); 364 library.addBuilder(mainBuilder.name, mainBuilder, -1);
365 mainBuilder.body = new ExpressionStatement( 365 mainBuilder.body = new ExpressionStatement(
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 707 }
708 for (Constructor constructor in superclass.constructors) { 708 for (Constructor constructor in superclass.constructors) {
709 if (constructor.name.name.isEmpty) { 709 if (constructor.name.name.isEmpty) {
710 return constructor.function.requiredParameterCount == 0 710 return constructor.function.requiredParameterCount == 0
711 ? constructor 711 ? constructor
712 : null; 712 : null;
713 } 713 }
714 } 714 }
715 return null; 715 return null;
716 } 716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698