SELF HOSTING
This commit is contained in:
@@ -1092,6 +1092,8 @@ fun make_operator_call(func: string, params: vector<*ast_node>): *ast_node {
|
|||||||
return ast_function_call_ptr(get_builtin_function(func, params.map(fun(p:*ast_node): *type return get_ast_type(p);)), params)
|
return ast_function_call_ptr(get_builtin_function(func, params.map(fun(p:*ast_node): *type return get_ast_type(p);)), params)
|
||||||
}
|
}
|
||||||
fun get_builtin_function(name: string, param_types: vector<*type>): *ast_node {
|
fun get_builtin_function(name: string, param_types: vector<*type>): *ast_node {
|
||||||
|
// none of the builtin functions should take in references
|
||||||
|
param_types = param_types.map(fun(t: *type): *type return t->clone_without_ref();)
|
||||||
if (name == "==" || name == "!=" || name == ">" || name == "<" || name == "<=" || name == ">" || name == ">=" || name == "&&" || name == "||" || name == "!")
|
if (name == "==" || name == "!=" || name == ">" || name == "<" || name == "<=" || name == ">" || name == ">=" || name == "&&" || name == "||" || name == "!")
|
||||||
return ast_function_ptr(name, type_ptr(param_types, type_ptr(base_type::boolean())), vector<*ast_node>())
|
return ast_function_ptr(name, type_ptr(param_types, type_ptr(base_type::boolean())), vector<*ast_node>())
|
||||||
if (name == "." || name == "->")
|
if (name == "." || name == "->")
|
||||||
|
|||||||
@@ -568,7 +568,10 @@ obj c_generator (Object) {
|
|||||||
|
|
||||||
// if we're returning a ref, we need to account for that in the temp type
|
// if we're returning a ref, we need to account for that in the temp type
|
||||||
// note the temp type is a pointer, not a ref so we don't have the deref/ref thing on return
|
// note the temp type is a pointer, not a ref so we don't have the deref/ref thing on return
|
||||||
var temp_ident_type = return_value_type
|
|
||||||
|
// now use the function_return_type instead so we don't make a ref
|
||||||
|
// var temp_ident_type = return_value_type
|
||||||
|
var temp_ident_type = function_return_type
|
||||||
if (function_return_type->is_ref)
|
if (function_return_type->is_ref)
|
||||||
temp_ident_type = temp_ident_type->clone_with_increased_indirection()
|
temp_ident_type = temp_ident_type->clone_with_increased_indirection()
|
||||||
var temp_ident = ast_identifier_ptr(string("temporary_return")+get_id(), temp_ident_type, null<ast_node>())
|
var temp_ident = ast_identifier_ptr(string("temporary_return")+get_id(), temp_ident_type, null<ast_node>())
|
||||||
|
|||||||
Reference in New Issue
Block a user