From 33e86c66ce739913d453808d3fecd6670a0e9fe1 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Sun, 30 Jan 2022 01:10:35 -0500 Subject: Functions, yay! We now support function calls! We don't have support for forward declaring functions right now though, so no mutual recursion is possible. The arguments are passed via the stack instead of through registers (unlike the x86_64 calling convention, I think). We'll probably need some sort of primitives built into the language for syscalls eventually because of this. Return types are also not checked, and right now it's possible to have a function that doesn't return anything even when the caller expects it to, error checking and reporting definitely needs to be improved. --- tests/functions.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 tests/functions.sh (limited to 'tests') diff --git a/tests/functions.sh b/tests/functions.sh new file mode 100755 index 0000000..3e87b37 --- /dev/null +++ b/tests/functions.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Test compound scopes + +. tests/common.sh + +set -e + +echo -n "- Different argument counts: " +assert_exit_status_stdin 5 <