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