OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/handles.h" | 10 #include "vm/handles.h" |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 bool IsConstructor() const { | 1064 bool IsConstructor() const { |
1065 return (kind() == RawFunction::kConstructor) && !is_static(); | 1065 return (kind() == RawFunction::kConstructor) && !is_static(); |
1066 } | 1066 } |
1067 bool IsFactory() const { | 1067 bool IsFactory() const { |
1068 return (kind() == RawFunction::kConstructor) && is_static(); | 1068 return (kind() == RawFunction::kConstructor) && is_static(); |
1069 } | 1069 } |
1070 bool IsAbstract() const { | 1070 bool IsAbstract() const { |
1071 return kind() == RawFunction::kAbstract; | 1071 return kind() == RawFunction::kAbstract; |
1072 } | 1072 } |
1073 bool IsInFactoryScope() const; | 1073 bool IsInFactoryScope() const; |
1074 bool IsInStaticScope() const; | |
1075 | 1074 |
1076 intptr_t token_index() const { return raw_ptr()->token_index_; } | 1075 intptr_t token_index() const { return raw_ptr()->token_index_; } |
1077 | 1076 |
1078 static intptr_t num_fixed_parameters_offset() { | 1077 static intptr_t num_fixed_parameters_offset() { |
1079 return OFFSET_OF(RawFunction, num_fixed_parameters_); | 1078 return OFFSET_OF(RawFunction, num_fixed_parameters_); |
1080 } | 1079 } |
1081 intptr_t num_fixed_parameters() const { | 1080 intptr_t num_fixed_parameters() const { |
1082 return raw_ptr()->num_fixed_parameters_; | 1081 return raw_ptr()->num_fixed_parameters_; |
1083 } | 1082 } |
1084 void set_num_fixed_parameters(intptr_t value) const; | 1083 void set_num_fixed_parameters(intptr_t value) const; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 bool IsSubtypeOf(const Function& other) const { | 1131 bool IsSubtypeOf(const Function& other) const { |
1133 return TestType(kIsSubtypeOf, other); | 1132 return TestType(kIsSubtypeOf, other); |
1134 } | 1133 } |
1135 | 1134 |
1136 // Returns true if the type of this function can be assigned to the type of | 1135 // Returns true if the type of this function can be assigned to the type of |
1137 // the destination function. | 1136 // the destination function. |
1138 bool IsAssignableTo(const Function& dst) const { | 1137 bool IsAssignableTo(const Function& dst) const { |
1139 return TestType(kIsAssignableTo, dst); | 1138 return TestType(kIsAssignableTo, dst); |
1140 } | 1139 } |
1141 | 1140 |
1142 // Returns true if this function represents a closure function. | 1141 // Returns true if this function represents a (possibly implicit) closure |
| 1142 // function. |
1143 bool IsClosureFunction() const { | 1143 bool IsClosureFunction() const { |
1144 return kind() == RawFunction::kClosureFunction; | 1144 return kind() == RawFunction::kClosureFunction; |
1145 } | 1145 } |
1146 | 1146 |
| 1147 // Returns true if this function represents an implicit closure function. |
| 1148 bool IsImplicitClosureFunction() const; |
| 1149 |
| 1150 // Returns true if this function represents a non implicit closure function. |
| 1151 bool IsNonImplicitClosureFunction() const { |
| 1152 return IsClosureFunction() && !IsImplicitClosureFunction(); |
| 1153 } |
| 1154 |
| 1155 // Returns true if this function represents an implicit static closure |
| 1156 // function. |
| 1157 bool IsImplicitStaticClosureFunction() const { |
| 1158 return is_static() && IsImplicitClosureFunction(); |
| 1159 } |
| 1160 |
| 1161 // Returns true if this function represents an implicit instance closure |
| 1162 // function. |
| 1163 bool IsImplicitInstanceClosureFunction() const { |
| 1164 return !is_static() && IsImplicitClosureFunction(); |
| 1165 } |
| 1166 |
1147 // Returns true if this function represents a local function. | 1167 // Returns true if this function represents a local function. |
1148 bool IsLocalFunction() const { | 1168 bool IsLocalFunction() const { |
1149 return parent_function() != Function::null(); | 1169 return parent_function() != Function::null(); |
1150 } | 1170 } |
1151 | 1171 |
1152 // Returns true if this function represents a signature function without code. | 1172 // Returns true if this function represents a signature function without code. |
1153 bool IsSignatureFunction() const { | 1173 bool IsSignatureFunction() const { |
1154 return kind() == RawFunction::kSignatureFunction; | 1174 return kind() == RawFunction::kSignatureFunction; |
1155 } | 1175 } |
1156 | 1176 |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 } | 2809 } |
2790 | 2810 |
2791 | 2811 |
2792 void Context::SetAt(intptr_t index, const Instance& value) const { | 2812 void Context::SetAt(intptr_t index, const Instance& value) const { |
2793 StorePointer(InstanceAddr(index), value.raw()); | 2813 StorePointer(InstanceAddr(index), value.raw()); |
2794 } | 2814 } |
2795 | 2815 |
2796 } // namespace dart | 2816 } // namespace dart |
2797 | 2817 |
2798 #endif // VM_OBJECT_H_ | 2818 #endif // VM_OBJECT_H_ |
OLD | NEW |