return targ.vis;
};
+void() printworking = {
+ print("Working\n");
+};
+
+void(void() callback) testcallback = {
+ callback();
+};
+
void() main = {
local entity pawn, pawn2;
if (!visible(pawn.other))
print("Yes\n");
+
+ testcallback(printworking);
};
case TYPE_FUNCTION:
if (code_defs_add(def) < 0)
return false;
- ir_value_code_setaddr(global, code_globals_elements);
- code_globals_add(code_functions_elements);
- return gen_global_function(self, global);
+ if (!global->isconst) {
+ ir_value_code_setaddr(global, code_globals_add(0));
+ return global->code.globaladdr >= 0;
+ } else {
+ ir_value_code_setaddr(global, code_globals_elements);
+ code_globals_add(code_functions_elements);
+ return gen_global_function(self, global);
+ }
case TYPE_VARIANT:
/* assume biggest type */
ir_value_code_setaddr(global, code_globals_add(0));
ast_value *param;
ast_value *fld;
bool isfield = false;
- bool dummy;
+ bool isfuncparam = false;
if (!parser_next(parser))
goto on_error;
if (!parser_next(parser))
goto on_error;
- param = parser_parse_type(parser, temptype, &dummy);
- (void)dummy;
+ param = parser_parse_type(parser, temptype, &isfuncparam);
if (!param)
goto on_error;
goto on_error;
}
+ /* This comes before the isfield part! */
+ if (isfuncparam) {
+ ast_value *fval = ast_value_new(ast_ctx(param), param->name, TYPE_FUNCTION);
+ if (!fval) {
+ ast_delete(param);
+ goto on_error;
+ }
+ fval->expression.next = (ast_expression*)param;
+ MEM_VECTOR_MOVE(¶m->expression, params, &fval->expression, params);
+ param = fval;
+ }
+
if (isfield) {
fld = ast_value_new(ctx, param->name, TYPE_FIELD);
fld->expression.next = (ast_expression*)param;