From 43c0343755383fdd79e7c402ab316dc561825b15 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sat, 1 Dec 2012 00:36:24 +0100 Subject: [PATCH] Offsetting builtins so we can use 'if builtin!=0' as condition but also allow a '#0' builtin --- ir.c | 2 +- parser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ir.c b/ir.c index bf08a5d..b564bae 100644 --- a/ir.c +++ b/ir.c @@ -2862,7 +2862,7 @@ static bool gen_global_function(ir_builder *ir, ir_value *global) fun.locals = vec_size(code_globals) - fun.firstlocal; if (irfun->builtin) - fun.entry = irfun->builtin; + fun.entry = irfun->builtin+1; else { irfun->code_function_def = vec_size(code_functions); fun.entry = vec_size(code_statements); diff --git a/parser.c b/parser.c index f6a3024..1a5c427 100644 --- a/parser.c +++ b/parser.c @@ -4028,7 +4028,7 @@ skipvar: } vec_push(parser->functions, func); - func->builtin = -parser_token(parser)->constval.i; + func->builtin = -parser_token(parser)->constval.i-1; } if (!parser_next(parser)) { -- 2.39.2