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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection' show Queue; | 6 import 'dart:collection' show Queue; |
7 | 7 |
8 import 'package:kernel/ast.dart' as ir; | 8 import 'package:kernel/ast.dart' as ir; |
9 import 'package:kernel/checks.dart' show CheckParentPointers; | 9 import 'package:kernel/checks.dart' show CheckParentPointers; |
10 | 10 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 member.isAccessor || | 203 member.isAccessor || |
204 member.isConstructor) { | 204 member.isConstructor) { |
205 classNode.addMember(functionToIr(member)); | 205 classNode.addMember(functionToIr(member)); |
206 } else if (member.isField) { | 206 } else if (member.isField) { |
207 classNode.addMember(fieldToIr(member)); | 207 classNode.addMember(fieldToIr(member)); |
208 } else { | 208 } else { |
209 internalError(member, "Unhandled class member: $member"); | 209 internalError(member, "Unhandled class member: $member"); |
210 } | 210 } |
211 }); | 211 }); |
212 classNode.typeParameters.addAll(typeVariablesToIr(cls.typeVariables)); | 212 classNode.typeParameters.addAll(typeVariablesToIr(cls.typeVariables)); |
213 for (ir.InterfaceType interface in typesToIr(cls.interfaces.toList())) { | 213 for (ir.InterfaceType interface |
| 214 in typesToIr(cls.interfaces.reverse().toList())) { |
214 classNode.implementedTypes.add(interface); | 215 classNode.implementedTypes.add(interface); |
215 } | 216 } |
216 }); | 217 }); |
217 return classNode; | 218 return classNode; |
218 }); | 219 }); |
219 } | 220 } |
220 | 221 |
221 bool hasHierarchyProblem(ClassElement cls) => cls.hasIncompleteHierarchy; | 222 bool hasHierarchyProblem(ClassElement cls) => cls.hasIncompleteHierarchy; |
222 | 223 |
223 ir.InterfaceType interfaceTypeToIr(InterfaceType type) { | 224 ir.InterfaceType interfaceTypeToIr(InterfaceType type) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 ir.DartType type = | 435 ir.DartType type = |
435 field.isMalformed ? const ir.InvalidType() : typeToIr(field.type); | 436 field.isMalformed ? const ir.InvalidType() : typeToIr(field.type); |
436 ir.Field fieldNode = new ir.Field(irName(field.memberName.text, field), | 437 ir.Field fieldNode = new ir.Field(irName(field.memberName.text, field), |
437 type: type, | 438 type: type, |
438 initializer: null, | 439 initializer: null, |
439 isFinal: field.isFinal, | 440 isFinal: field.isFinal, |
440 isStatic: field.isStatic || field.isTopLevel, | 441 isStatic: field.isStatic || field.isTopLevel, |
441 isConst: field.isConst); | 442 isConst: field.isConst); |
442 addWork(field, () { | 443 addWork(field, () { |
443 setParent(fieldNode, field); | 444 setParent(fieldNode, field); |
444 if (!field.isMalformed && | 445 if (!field.isMalformed && field.initializer != null) { |
445 !field.isInstanceMember && | |
446 field.initializer != null) { | |
447 KernelVisitor visitor = | 446 KernelVisitor visitor = |
448 new KernelVisitor(field, field.treeElements, this); | 447 new KernelVisitor(field, field.treeElements, this); |
449 fieldNode.initializer = visitor.buildInitializer() | 448 fieldNode.initializer = visitor.buildInitializer() |
450 ..parent = fieldNode; | 449 ..parent = fieldNode; |
451 } | 450 } |
452 }); | 451 }); |
453 return fieldNode; | 452 return fieldNode; |
454 }); | 453 }); |
455 } | 454 } |
456 | 455 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 } | 651 } |
653 | 652 |
654 class ConstructorTarget { | 653 class ConstructorTarget { |
655 final ConstructorElement element; | 654 final ConstructorElement element; |
656 final DartType type; | 655 final DartType type; |
657 | 656 |
658 ConstructorTarget(this.element, this.type); | 657 ConstructorTarget(this.element, this.type); |
659 | 658 |
660 String toString() => "ConstructorTarget($element, $type)"; | 659 String toString() => "ConstructorTarget($element, $type)"; |
661 } | 660 } |
OLD | NEW |