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

Unified Diff: pkg/fletchc/lib/src/fletch_system_builder.dart

Issue 1450393002: Roll sdk dependency to 34357cdad108dcba734949bd13bd28c76ea285e0 (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: pkg/fletchc/lib/src/fletch_system_builder.dart
diff --git a/pkg/fletchc/lib/src/fletch_system_builder.dart b/pkg/fletchc/lib/src/fletch_system_builder.dart
index 258b1190a9bcba61d825137ba8c2269308629907..59f2fa99ad415f41f4352448b777d38ef9cd647f 100644
--- a/pkg/fletchc/lib/src/fletch_system_builder.dart
+++ b/pkg/fletchc/lib/src/fletch_system_builder.dart
@@ -20,10 +20,12 @@ import 'package:compiler/src/elements/elements.dart' show
ClassElement,
ConstructorElement,
Element,
+ FieldElement,
FunctionElement,
- FunctionSignature;
+ FunctionSignature,
+ MemberElement;
-import 'package:compiler/src/universe/universe.dart' show
+import 'package:compiler/src/universe/call_structure.dart' show
CallStructure;
import 'package:persistent/persistent.dart' show
@@ -361,7 +363,7 @@ class FletchSystemBuilder {
// Create all new FletchFunctions.
List<FletchFunction> functions = <FletchFunction>[];
for (FletchFunctionBuilder builder in _newFunctions) {
- context.compiler.withCurrentElement(builder.element, () {
+ context.compiler.reporter.withCurrentElement(builder.element, () {
functions.add(builder.finalizeFunction(context, commands));
});
}
@@ -485,10 +487,30 @@ class FletchSystemBuilder {
ClassElement classElement = value.type.element;
// TODO(ajohnsen): Avoid usage of builders (should be FletchClass).
FletchClassBuilder classBuilder = _classBuildersByElement[classElement];
- for (ConstantValue field in value.fields.values) {
- int fieldId = context.compiledConstants[field];
+
+ void addIfField(MemberElement member) {
+ if (!member.isField || member.isStatic || member.isPatch) return;
+ FieldElement fieldElement = member;
+ ConstantValue fieldValue = value.fields[fieldElement];
+ int fieldId = context.compiledConstants[fieldValue];
commands.add(new PushFromMap(MapId.constants, fieldId));
}
+
+ // Adds all the fields of [currentClass] in order starting from the top
+ // of the inheritance chain, and for each class adds non-patch fields
+ // before patch fields.
+ void addFields(ClassElement currentClass) {
+ if (currentClass.superclass != null) {
+ addFields(currentClass.superclass);
+ }
+ currentClass.forEachLocalMember(addIfField);
ahe 2015/11/17 16:44:09 Why not forEachInstanceField?
sigurdm 2015/11/19 14:33:47 forEachInstanceField has in the end calls forEachL
+ if (currentClass.isPatched) {
+ currentClass.patch.forEachLocalMember(addIfField);
+ }
+ }
+
+ addFields(classElement);
+
commands
..add(new PushFromMap(MapId.classes, classBuilder.classId))
..add(const PushNewInstance());

Powered by Google App Engine
This is Rietveld 408576698