| OLD | NEW |
| 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.dill_library_builder; | 5 library fasta.dill_library_builder; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
| 8 show Class, Field, Library, ListLiteral, Member, StaticGet, Typedef; | 8 show Class, Field, Library, ListLiteral, Member, StaticGet, Typedef; |
| 9 | 9 |
| 10 import '../problems.dart' show unimplemented; | 10 import '../problems.dart' show unimplemented; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 final DillLoader loader; | 34 final DillLoader loader; |
| 35 | 35 |
| 36 Library library; | 36 Library library; |
| 37 | 37 |
| 38 DillLibraryBuilder(this.uri, this.loader) | 38 DillLibraryBuilder(this.uri, this.loader) |
| 39 : super(uri, new Scope.top(), new Scope.top()); | 39 : super(uri, new Scope.top(), new Scope.top()); |
| 40 | 40 |
| 41 Uri get fileUri => uri; | 41 Uri get fileUri => uri; |
| 42 | 42 |
| 43 @override |
| 44 Library get target => library; |
| 45 |
| 43 void addClass(Class cls) { | 46 void addClass(Class cls) { |
| 44 DillClassBuilder classBulder = new DillClassBuilder(cls, this); | 47 DillClassBuilder classBulder = new DillClassBuilder(cls, this); |
| 45 addBuilder(cls.name, classBulder, cls.fileOffset); | 48 addBuilder(cls.name, classBulder, cls.fileOffset); |
| 46 cls.procedures.forEach(classBulder.addMember); | 49 cls.procedures.forEach(classBulder.addMember); |
| 47 cls.constructors.forEach(classBulder.addMember); | 50 cls.constructors.forEach(classBulder.addMember); |
| 48 for (Field field in cls.fields) { | 51 for (Field field in cls.fields) { |
| 49 if (field.name.name == "_redirecting#") { | 52 if (field.name.name == "_redirecting#") { |
| 50 ListLiteral initializer = field.initializer; | 53 ListLiteral initializer = field.initializer; |
| 51 for (StaticGet get in initializer.expressions) { | 54 for (StaticGet get in initializer.expressions) { |
| 52 RedirectingFactoryBody.restoreFromDill(get.target); | 55 RedirectingFactoryBody.restoreFromDill(get.target); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // top-level declaration with the name `k` exists in `L`. | 112 // top-level declaration with the name `k` exists in `L`. |
| 110 if (builder.parent == this) return builder; | 113 if (builder.parent == this) return builder; |
| 111 return new KernelInvalidTypeBuilder(name, charOffset, fileUri); | 114 return new KernelInvalidTypeBuilder(name, charOffset, fileUri); |
| 112 } | 115 } |
| 113 | 116 |
| 114 @override | 117 @override |
| 115 String get fullNameForErrors { | 118 String get fullNameForErrors { |
| 116 return library.name ?? "<library '${library.fileUri}'>"; | 119 return library.name ?? "<library '${library.fileUri}'>"; |
| 117 } | 120 } |
| 118 } | 121 } |
| OLD | NEW |