summaryrefslogtreecommitdiffstats
path: root/eshtrans/backend/codegen.esh
diff options
context:
space:
mode:
Diffstat (limited to 'eshtrans/backend/codegen.esh')
-rw-r--r--eshtrans/backend/codegen.esh26
1 files changed, 26 insertions, 0 deletions
diff --git a/eshtrans/backend/codegen.esh b/eshtrans/backend/codegen.esh
index 8fd1088..2637d51 100644
--- a/eshtrans/backend/codegen.esh
+++ b/eshtrans/backend/codegen.esh
@@ -55,6 +55,9 @@ codegen_sub()
local fname=
local static=
local static_fname=
+ local type=
+ local params=
+ local types=
local t=
print_spc=false
@@ -63,6 +66,9 @@ codegen_sub()
fname=''
static=false
static_fname=false
+ type=false
+ params=0
+ types=''
IFS="${RS}"
for t in ${array}; do
@@ -94,11 +100,22 @@ codegen_sub()
;;
T_FNAME)
fname="${t}"
+ params=0
+ types=''
;;
T_STATIC)
static=true
continue
;;
+ T_TYPE)
+ type=true
+ params=$((${params} + 1))
+ types="${types}${t#*${US}}:"
+ continue
+ ;;
+ T_COMMA)
+ continue
+ ;;
esac
if ${pragma}; then
pragma=false
@@ -128,6 +145,10 @@ codegen_sub()
toktext "${fname}"
;;
esac
+ elif ${type}; then
+ type=false
+ types="${types}${t#*${US}} "
+ continue
fi
# Function start/end tokens
@@ -139,6 +160,11 @@ codegen_sub()
else
printf ':;'
fi
+ if [ ${params} -gt 0 ]; then
+ printf ' __check_args %s %d %s %s;' \
+ "${fname#*${US}}" ${params} \
+ "'${types% }'" '"${@}"'
+ fi
;;
T_FN_END)
if ! ${pragma_nostack}; then