Make this varaiable/keyword work
This commit is contained in:
@@ -151,7 +151,7 @@ obj ast_transformation (Object) {
|
||||
// make sure not a template
|
||||
// huh, I guess I can't actually assign to the backing.
|
||||
// This is actually a little bit of a problem, maybe these should be pointers also. All the pointers!
|
||||
node->function.body_statement = transform_statement(get_node("statement", ast_to_syntax[node]), translation_unit)
|
||||
node->function.body_statement = transform_statement(get_node("statement", ast_to_syntax[node]), node)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -193,7 +193,7 @@ obj ast_transformation (Object) {
|
||||
print("There are "); print(possibilities.size); println(" possibilites for this object type lookup")
|
||||
for (var i = 0; i < possibilities.size; i++;) {
|
||||
match(*possibilities[i]) {
|
||||
ast_node::type_def(backing) return backing.self_type
|
||||
ast_node::type_def(backing) return backing.self_type->clone_with_indirection(indirection)
|
||||
}
|
||||
}
|
||||
println("No objects in lookup, returning none")
|
||||
@@ -250,9 +250,12 @@ obj ast_transformation (Object) {
|
||||
return nodes.map(fun(node: *tree<symbol>): *ast_node return transform(node, scope);)
|
||||
}
|
||||
fun transform_identifier(node: *tree<symbol>, scope: *ast_node, searching_for: search_type): *ast_node {
|
||||
// for identifier we have to do scope lookup, etc, and maybe limit to function
|
||||
// NOT THIS
|
||||
// first, we check for and generate this
|
||||
var name = concat_symbol_tree(node)
|
||||
if (name == "this") {
|
||||
while (!is_type_def(scope)) scope = get_ast_scope(scope)->get(string("~enclosing_scope"))[0]
|
||||
return ast_identifier_ptr("this", scope->type_def.self_type->clone_with_indirection(1))
|
||||
}
|
||||
/*return ast_identifier_ptr(name, type_ptr(base_type::void_return()))*/
|
||||
match (searching_for) {
|
||||
search_type::none() return identifier_lookup(name, scope)
|
||||
|
||||
@@ -158,7 +158,10 @@ obj c_generator (Object) {
|
||||
is_type_def(get_ast_scope(node->function_call.func->function_call.parameters[1])->get(string("~enclosing_scope"))[0])
|
||||
) {
|
||||
func_name = generate(node->function_call.func->function_call.parameters[1], enclosing_object)
|
||||
call_string = string("&") + generate(node->function_call.func->function_call.parameters[0], enclosing_object)
|
||||
// don't add & if it was ->
|
||||
if (node->function_call.func->function_call.func->function.name == ".")
|
||||
call_string += string("&")
|
||||
call_string += generate(node->function_call.func->function_call.parameters[0], enclosing_object)
|
||||
} else {
|
||||
func_name = generate(node->function_call.func, enclosing_object)
|
||||
}
|
||||
@@ -243,7 +246,7 @@ obj c_generator (Object) {
|
||||
base_type::floating() return string("float") + indirection
|
||||
base_type::double_precision() return string("double") + indirection
|
||||
base_type::object() {
|
||||
return type->type_def->type_def.name
|
||||
return type->type_def->type_def.name + indirection
|
||||
}
|
||||
base_type::function() {
|
||||
var temp = indirection + string("function: (")
|
||||
|
||||
@@ -98,7 +98,7 @@ obj type (Object) {
|
||||
for (var i = 0; i < indirection; i++;) indirection_str += "*"
|
||||
match (base) {
|
||||
base_type::none() return indirection_str + string("none")
|
||||
base_type::object() return indirection_str + string("obj:") + type_def->type_def.name
|
||||
base_type::object() return indirection_str + type_def->type_def.name
|
||||
base_type::template() return indirection_str + string("template")
|
||||
base_type::template_type() return indirection_str + string("template_type")
|
||||
base_type::void_return() return indirection_str + string("void_return")
|
||||
@@ -115,6 +115,11 @@ obj type (Object) {
|
||||
}
|
||||
return string("impossible type, indirection:") + indirection
|
||||
}
|
||||
fun clone_with_indirection(ind: int): *type {
|
||||
var to_ret = new<type>()
|
||||
to_ret->copy_construct(this)
|
||||
to_ret->indirection = ind
|
||||
return to_ret
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user