OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE.md file. | |
4 | |
5 library fletchc.class_debug_info; | |
6 | |
7 import 'package:compiler/src/elements/elements.dart'; | |
8 | |
9 import '../fletch_system.dart'; | |
10 | |
11 class ClassDebugInfo { | |
12 final FletchClass klass; | |
13 List<String> fieldNames; | |
14 | |
15 ClassDebugInfo(FletchClass klass) | |
16 : this.klass = klass, | |
17 fieldNames = _computeFieldNames(klass); | |
18 | |
19 static _computeFieldNames(FletchClass klass) { | |
20 int localFields = klass.fields.length - klass.superclassFields; | |
21 List fieldNames = new List(localFields); | |
22 int index = 0; | |
23 ClassElement classElement = klass.element.implementation; | |
24 String className = classElement.name != null ? '${classElement.name}.' : ''; | |
25 classElement.forEachInstanceField((_, FieldElement field) { | |
26 fieldNames[index++] = '$className${field.name}'; | |
27 }); | |
28 assert(index == localFields); | |
29 return fieldNames; | |
30 } | |
31 } | |
OLD | NEW |