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.fletch_constants; | |
6 | |
7 import 'package:compiler/src/constants/values.dart' show | |
8 ConstantValue; | |
9 | |
10 import 'package:compiler/src/core_types.dart' show | |
11 CoreTypes; | |
12 | |
13 import 'package:compiler/src/dart_types.dart' show | |
14 DartType, | |
15 DynamicType; | |
16 | |
17 class FletchFunctionConstant extends ConstantValue { | |
18 final int functionId; | |
19 | |
20 FletchFunctionConstant(this.functionId); | |
21 | |
22 DartType getType(CoreTypes types) => const DynamicType(); | |
23 | |
24 List<ConstantValue> getDependencies() => const <ConstantValue>[]; | |
25 | |
26 accept(visitor, arg) { | |
27 throw new UnsupportedError("FletchFunctionConstant.accept"); | |
28 } | |
29 | |
30 String unparse() => toStructuredString(); | |
31 | |
32 String toStructuredString() { | |
33 return 'FletchFunctionConstant($functionId)'; | |
34 } | |
35 } | |
36 | |
37 class FletchClassConstant extends ConstantValue { | |
38 final int classId; | |
39 | |
40 FletchClassConstant(this.classId); | |
41 | |
42 DartType getType(CoreTypes types) => const DynamicType(); | |
43 | |
44 List<ConstantValue> getDependencies() => const <ConstantValue>[]; | |
45 | |
46 accept(visitor, arg) { | |
47 throw new UnsupportedError("FletchClassConstant.accept"); | |
48 } | |
49 | |
50 String unparse() => toStructuredString(); | |
51 | |
52 String toStructuredString() { | |
53 return 'FletchClassConstant($classId)'; | |
54 } | |
55 } | |
56 | |
57 class FletchClassInstanceConstant extends ConstantValue { | |
58 final int classId; | |
59 | |
60 FletchClassInstanceConstant(this.classId); | |
61 | |
62 DartType getType(CoreTypes types) => const DynamicType(); | |
63 | |
64 List<ConstantValue> getDependencies() => const <ConstantValue>[]; | |
65 | |
66 accept(visitor, arg) { | |
67 throw new UnsupportedError("FletchClassInstanceConstant.accept"); | |
68 } | |
69 | |
70 String unparse() => toStructuredString(); | |
71 | |
72 String toStructuredString() { | |
73 return 'FletchClassInstanceConstant($classId)'; | |
74 } | |
75 | |
76 bool operator==(other) { | |
77 return other is FletchClassInstanceConstant && other.classId == classId; | |
78 } | |
79 | |
80 int get hashCode => classId; | |
81 } | |
OLD | NEW |