xo-interpreter2 stack: + dict type + pop more pm types
This commit is contained in:
parent
60a34aec87
commit
bc4f80e29b
3 changed files with 41 additions and 6 deletions
|
|
@ -32,17 +32,27 @@ namespace xo {
|
|||
* for a function with return type @p ret_type and arguments @p args
|
||||
**/
|
||||
template <typename... Args>
|
||||
requires (std::same_as<Args, obj<AType>> && ...)
|
||||
requires (std::convertible_to<Args, obj<AType>> && ...)
|
||||
explicit DFunctionType(obj<AAllocator> mm, obj<AType> ret_type, Args... args);
|
||||
|
||||
/** create instance using memory from @p mm,
|
||||
* for a function with return type @p ret_type and arguments @p args
|
||||
**/
|
||||
template <typename... Args>
|
||||
requires (std::same_as<Args, obj<AType>> && ...)
|
||||
requires (std::convertible_to<Args, obj<AType>> && ...)
|
||||
static DFunctionType * _make(obj<AAllocator> mm,
|
||||
obj<AType> ret_type, Args... args);
|
||||
|
||||
#ifdef NOT_USING
|
||||
/** create instance using memory from @p mm
|
||||
* for function with return type @p ret_type and arguments @p args
|
||||
**/
|
||||
template <typename... Args>
|
||||
requires (std::same_as<Args, obj<AType>> && ...)
|
||||
static obj<AType,DFunctionType> make(obj<AAllocator> mm,
|
||||
obj<AType> ret_type, Args... args);
|
||||
#endif
|
||||
|
||||
///@}
|
||||
/** @defgroup xo-scm-arraytype-type-facet **/
|
||||
///@{
|
||||
|
|
@ -72,14 +82,14 @@ namespace xo {
|
|||
};
|
||||
|
||||
template <typename... Args>
|
||||
requires (std::same_as<Args, obj<AType>> && ...)
|
||||
requires (std::convertible_to<Args, obj<AType>> && ...)
|
||||
DFunctionType::DFunctionType(obj<AAllocator> mm, obj<AType> return_type, Args... args)
|
||||
: return_type_{return_type},
|
||||
arg_types_{DArray::array(mm, args...)}
|
||||
arg_types_{DArray::array(mm, args.template to_facet<AGCObject>()...)}
|
||||
{}
|
||||
|
||||
template <typename... Args>
|
||||
requires (std::same_as<Args, obj<AType>> && ...)
|
||||
requires (std::convertible_to<Args, obj<AType>> && ...)
|
||||
DFunctionType *
|
||||
DFunctionType::_make(obj<AAllocator> mm, obj<AType> ret_type, Args... args)
|
||||
{
|
||||
|
|
@ -88,6 +98,18 @@ namespace xo {
|
|||
return new (mem) DFunctionType(mm, ret_type, args...);
|
||||
}
|
||||
|
||||
#ifdef NOT_USING
|
||||
template <typename... Args>
|
||||
requires (std::same_as<Args, obj<AType>> && ...)
|
||||
obj<AType,DFunctionType>
|
||||
DFunctionType::make(obj<AAllocator> mm, obj<AType> ret_type, Args... args)
|
||||
{
|
||||
void * mem = mm.alloc_for<DFunctionType>();
|
||||
|
||||
return obj<AType,DFunctionType>(_make(mm, ret_type, args...));
|
||||
}
|
||||
#endif
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,13 @@ namespace xo {
|
|||
t_function,
|
||||
/* struct<a:T,b:U,..> */
|
||||
t_struct,
|
||||
/* dicttionary: like struct, but w/ dynamic key/value pairs */
|
||||
t_dict,
|
||||
|
||||
/* any numeric type: i16|i32|i64|f32|f64 */
|
||||
/** any integer type: i16|i32|i64 **/
|
||||
t_integer,
|
||||
|
||||
/** any numeric type: i16|i32|i64|f32|f64 **/
|
||||
t_numeric,
|
||||
|
||||
/* any type at all */
|
||||
|
|
@ -66,7 +71,9 @@ namespace xo {
|
|||
static Metatype t_array() { return Metatype(code::t_array); }
|
||||
static Metatype t_function() { return Metatype(code::t_function); }
|
||||
static Metatype t_struct() { return Metatype(code::t_struct); }
|
||||
static Metatype t_dict() { return Metatype(code::t_dict); }
|
||||
|
||||
static Metatype t_integer() { return Metatype(code::t_integer); }
|
||||
static Metatype t_numeric() { return Metatype(code::t_numeric); }
|
||||
static Metatype t_any() { return Metatype(code::t_any); }
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ namespace xo {
|
|||
case code::t_array: return "array";
|
||||
case code::t_function: return "function";
|
||||
case code::t_struct: return "struct";
|
||||
case code::t_dict: return "dict";
|
||||
|
||||
case code::t_integer: return "integer";
|
||||
case code::t_numeric: return "numeric";
|
||||
case code::t_any: return "any";
|
||||
}
|
||||
|
|
@ -68,7 +70,11 @@ namespace xo {
|
|||
return false;
|
||||
case code::t_struct:
|
||||
return false;
|
||||
case code::t_dict:
|
||||
return true;
|
||||
|
||||
case code::t_integer:
|
||||
return true;
|
||||
case code::t_numeric:
|
||||
return true;
|
||||
case code::t_any:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue