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

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

Issue 2980863003: The very first bits of resynthesizing elements from kernels. (Closed)
Patch Set: Created 3 years, 5 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 'package:kernel/ast.dart' 9 import 'package:kernel/ast.dart'
10 show 10 show
(...skipping 28 matching lines...) Expand all
39 VoidType; 39 VoidType;
40 40
41 import 'package:kernel/type_algebra.dart' show substitute; 41 import 'package:kernel/type_algebra.dart' show substitute;
42 42
43 import '../../../file_system.dart' show FileSystem; 43 import '../../../file_system.dart' show FileSystem;
44 44
45 import '../compiler_context.dart' show CompilerContext; 45 import '../compiler_context.dart' show CompilerContext;
46 46
47 import '../deprecated_problems.dart' 47 import '../deprecated_problems.dart'
48 show 48 show
49 deprecated_InputError,
49 deprecated_formatUnexpected, 50 deprecated_formatUnexpected,
50 deprecated_InputError,
51 reportCrash, 51 reportCrash,
52 resetCrashReporting; 52 resetCrashReporting,
53 temporaryUntilPrintsRemovedEnablePrinting;
53 54
54 import '../dill/dill_target.dart' show DillTarget; 55 import '../dill/dill_target.dart' show DillTarget;
55 56
56 import '../messages.dart' 57 import '../messages.dart'
57 show 58 show
58 LocatedMessage, 59 LocatedMessage,
59 messageConstConstructorNonFinalField, 60 messageConstConstructorNonFinalField,
60 messageConstConstructorNonFinalFieldCause, 61 messageConstConstructorNonFinalFieldCause,
61 templateSuperclassHasNoDefaultConstructor; 62 templateSuperclassHasNoDefaultConstructor;
62 63
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 builder.supertype = new KernelNamedTypeBuilder("Object", null, 213 builder.supertype = new KernelNamedTypeBuilder("Object", null,
213 builder.charOffset, builder.fileUri ?? Uri.parse(cls.fileUri)) 214 builder.charOffset, builder.fileUri ?? Uri.parse(cls.fileUri))
214 ..builder = objectClassBuilder; 215 ..builder = objectClassBuilder;
215 builder.interfaces = null; 216 builder.interfaces = null;
216 builder.mixedInType = null; 217 builder.mixedInType = null;
217 } 218 }
218 219
219 void handleInputError(deprecated_InputError error, {bool isFullProgram}) { 220 void handleInputError(deprecated_InputError error, {bool isFullProgram}) {
220 if (error != null) { 221 if (error != null) {
221 String message = error.deprecated_format(); 222 String message = error.deprecated_format();
222 print(message); 223 if (temporaryUntilPrintsRemovedEnablePrinting) {
224 print(message);
225 }
223 errors.add(message); 226 errors.add(message);
224 } 227 }
225 program = erroneousProgram(isFullProgram); 228 program = erroneousProgram(isFullProgram);
226 } 229 }
227 230
228 @override 231 @override
229 Future<Program> buildOutlines({CanonicalName nameRoot}) async { 232 Future<Program> buildOutlines({CanonicalName nameRoot}) async {
230 if (loader.first == null) return null; 233 if (loader.first == null) return null;
231 try { 234 try {
232 loader.createTypeInferenceEngine(); 235 loader.createTypeInferenceEngine();
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 returnType: const VoidType()); 502 returnType: const VoidType());
500 SuperInitializer initializer = new SuperInitializer( 503 SuperInitializer initializer = new SuperInitializer(
501 constructor, new Arguments(positional, named: named)); 504 constructor, new Arguments(positional, named: named));
502 return new Constructor(function, 505 return new Constructor(function,
503 name: constructor.name, initializers: <Initializer>[initializer]); 506 name: constructor.name, initializers: <Initializer>[initializer]);
504 } 507 }
505 508
506 Constructor makeDefaultConstructor() { 509 Constructor makeDefaultConstructor() {
507 return new Constructor( 510 return new Constructor(
508 new FunctionNode(new EmptyStatement(), returnType: const VoidType()), 511 new FunctionNode(new EmptyStatement(), returnType: const VoidType()),
509 name: new Name("")); 512 name: new Name(""),
513 isSyntheticDefault: true);
510 } 514 }
511 515
512 void finishAllConstructors() { 516 void finishAllConstructors() {
513 Class objectClass = this.objectClass; 517 Class objectClass = this.objectClass;
514 for (SourceClassBuilder builder in collectAllSourceClasses()) { 518 for (SourceClassBuilder builder in collectAllSourceClasses()) {
515 Class cls = builder.target; 519 Class cls = builder.target;
516 if (cls != objectClass) { 520 if (cls != objectClass) {
517 finishConstructors(builder); 521 finishConstructors(builder);
518 } 522 }
519 } 523 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 659 }
656 for (Constructor constructor in superclass.constructors) { 660 for (Constructor constructor in superclass.constructors) {
657 if (constructor.name.name.isEmpty) { 661 if (constructor.name.name.isEmpty) {
658 return constructor.function.requiredParameterCount == 0 662 return constructor.function.requiredParameterCount == 0
659 ? constructor 663 ? constructor
660 : null; 664 : null;
661 } 665 }
662 } 666 }
663 return null; 667 return null;
664 } 668 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698