Add ability to register a user defined type conversion
Currently this adds a fair bit of overhead. It will need to be evaluated further before it's merged.
This commit is contained in:
11
unittests/user_defined_conversions.chai
Normal file
11
unittests/user_defined_conversions.chai
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
add_type_conversion(type("string"), type("Type_Info"), fun(s) { return type(s); });
|
||||
|
||||
// This looks simple, but it takes the string "string" and using the registered
|
||||
// conversion above, automatically converts that into a Type_Info object, which then
|
||||
// allows the Type_Info.name() function to be called
|
||||
|
||||
assert_equal("string".name(), "string");
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user