Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: runtime/vm/object.h

Issue 8391007: Complete generic closure type checking. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/dart.h" 9 #include "vm/dart.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 // ast printing. The special ':' character, if present, is replaced by '_'. 1186 // ast printing. The special ':' character, if present, is replaced by '_'.
1187 const char* ToFullyQualifiedCString() const; 1187 const char* ToFullyQualifiedCString() const;
1188 1188
1189 // Returns true if this function has parameters that are compatible with the 1189 // Returns true if this function has parameters that are compatible with the
1190 // parameters of the other function in order for this function to override the 1190 // parameters of the other function in order for this function to override the
1191 // other function. Parameter types are ignored. 1191 // other function. Parameter types are ignored.
1192 bool HasCompatibleParametersWith(const Function& other) const; 1192 bool HasCompatibleParametersWith(const Function& other) const;
1193 1193
1194 // Returns true if the type of this function is a subtype of the type of 1194 // Returns true if the type of this function is a subtype of the type of
1195 // the other function. 1195 // the other function.
1196 bool IsSubtypeOf(const Function& other) const { 1196 bool IsSubtypeOf(const TypeArguments& type_arguments,
1197 return TestType(kIsSubtypeOf, other); 1197 const Function& other,
1198 const TypeArguments& other_type_arguments) const {
1199 return TestType(kIsSubtypeOf,
1200 type_arguments,
1201 other,
1202 other_type_arguments);
1198 } 1203 }
1199 1204
1200 // Returns true if the type of this function can be assigned to the type of 1205 // Returns true if the type of this function can be assigned to the type of
1201 // the destination function. 1206 // the destination function.
1202 bool IsAssignableTo(const Function& dst) const { 1207 bool IsAssignableTo(const TypeArguments& type_arguments,
1203 return TestType(kIsAssignableTo, dst); 1208 const Function& dst,
1209 const TypeArguments& dst_type_arguments) const {
1210 return TestType(kIsAssignableTo,
1211 type_arguments,
1212 dst,
1213 dst_type_arguments);
1204 } 1214 }
1205 1215
1206 // Returns true if this function represents a (possibly implicit) closure 1216 // Returns true if this function represents a (possibly implicit) closure
1207 // function. 1217 // function.
1208 bool IsClosureFunction() const { 1218 bool IsClosureFunction() const {
1209 return kind() == RawFunction::kClosureFunction; 1219 return kind() == RawFunction::kClosureFunction;
1210 } 1220 }
1211 1221
1212 // Returns true if this function represents an implicit closure function. 1222 // Returns true if this function represents an implicit closure function.
1213 bool IsImplicitClosureFunction() const; 1223 bool IsImplicitClosureFunction() const;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 void set_token_index(intptr_t value) const; 1277 void set_token_index(intptr_t value) const;
1268 void set_implicit_closure_function(const Function& value) const; 1278 void set_implicit_closure_function(const Function& value) const;
1269 static RawFunction* New(); 1279 static RawFunction* New();
1270 1280
1271 RawString* BuildSignature(bool instantiate, 1281 RawString* BuildSignature(bool instantiate,
1272 const TypeArguments& instantiator, 1282 const TypeArguments& instantiator,
1273 intptr_t offset) const; 1283 intptr_t offset) const;
1274 1284
1275 // Checks the subtype or assignability relationship between the type of this 1285 // Checks the subtype or assignability relationship between the type of this
1276 // function and the type of the other function. 1286 // function and the type of the other function.
1277 bool TestType(TypeTestKind test, const Function& other) const; 1287 bool TestType(TypeTestKind test,
1288 const TypeArguments& type_arguments,
1289 const Function& other,
1290 const TypeArguments& other_type_arguments) const;
1278 1291
1279 HEAP_OBJECT_IMPLEMENTATION(Function, Object); 1292 HEAP_OBJECT_IMPLEMENTATION(Function, Object);
1280 friend class Class; 1293 friend class Class;
1281 }; 1294 };
1282 1295
1283 1296
1284 class Field : public Object { 1297 class Field : public Object {
1285 public: 1298 public:
1286 RawString* name() const { return raw_ptr()->name_; } 1299 RawString* name() const { return raw_ptr()->name_; }
1287 bool is_static() const { return raw_ptr()->is_static_; } 1300 bool is_static() const { return raw_ptr()->is_static_; }
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 } 2969 }
2957 2970
2958 2971
2959 void Context::SetAt(intptr_t index, const Instance& value) const { 2972 void Context::SetAt(intptr_t index, const Instance& value) const {
2960 StorePointer(InstanceAddr(index), value.raw()); 2973 StorePointer(InstanceAddr(index), value.raw());
2961 } 2974 }
2962 2975
2963 } // namespace dart 2976 } // namespace dart
2964 2977
2965 #endif // VM_OBJECT_H_ 2978 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698