OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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 library fletchc.class_debug_info; | 5 library dartino_compiler.class_debug_info; |
6 | 6 |
7 import 'package:compiler/src/elements/elements.dart'; | 7 import 'package:compiler/src/elements/elements.dart'; |
8 | 8 |
9 import '../fletch_system.dart'; | 9 import '../dartino_system.dart'; |
10 | 10 |
11 class ClassDebugInfo { | 11 class ClassDebugInfo { |
12 final FletchClass klass; | 12 final DartinoClass klass; |
13 List<String> fieldNames; | 13 List<String> fieldNames; |
14 | 14 |
15 ClassDebugInfo(FletchClass klass) | 15 ClassDebugInfo(DartinoClass klass) |
16 : this.klass = klass, | 16 : this.klass = klass, |
17 fieldNames = _computeFieldNames(klass); | 17 fieldNames = _computeFieldNames(klass); |
18 | 18 |
19 static _computeFieldNames(FletchClass klass) { | 19 static _computeFieldNames(DartinoClass klass) { |
20 int localFields = klass.fields.length - klass.superclassFields; | 20 int localFields = klass.fields.length - klass.superclassFields; |
21 List fieldNames = new List(localFields); | 21 List fieldNames = new List(localFields); |
22 int index = 0; | 22 int index = 0; |
23 ClassElement classElement = klass.element.implementation; | 23 ClassElement classElement = klass.element.implementation; |
24 String className = classElement.name != null ? '${classElement.name}.' : ''; | 24 String className = classElement.name != null ? '${classElement.name}.' : ''; |
25 classElement.forEachInstanceField((_, FieldElement field) { | 25 classElement.forEachInstanceField((_, FieldElement field) { |
26 fieldNames[index++] = '$className${field.name}'; | 26 fieldNames[index++] = '$className${field.name}'; |
27 }); | 27 }); |
28 assert(index == localFields); | 28 assert(index == localFields); |
29 return fieldNames; | 29 return fieldNames; |
30 } | 30 } |
31 } | 31 } |
OLD | NEW |