dirname="$(dirname -- "$test_file")"
name="${filename%.*}"
- echo "⏲ Checking $name.onyx"
+ printf "%-$((($(tput cols) - 8)))s" "⏲ Checking $name.onyx"
if ! ./bin/onyx "$test_file" -o "./tests/$name.wasm" >/dev/null; then
- echo "❌ Failed to compile $name.onyx."
+ print "\n❌ Failed to compile $name.onyx.\n"
failed=1
continue
fi
if ! ./bin/onyx-js "./tests/$name.wasm" > ./tmpoutput; then
- echo "❌ Failed to run $name.onyx."
+ print "\n❌ Failed to run $name.onyx.\n"
failed=1
continue
fi
if ! diff ./tmpoutput "$dirname/$name" >/dev/null; then
- echo "❌ Test output did not match."
+ print "\n❌ Test output did not match.\n"
diff ./tmpoutput "$dirname/$name"
# failed=0
continue
fi
+ echo "✔ Passed"
+
rm "./tests/$name.wasm"
done
rm ./tmpoutput
which is doesn't match the second one, when the original parameters would
have matched correctly.
-[ ] `defer` statements are not executed at the end of a loop if the loop is
+[X] `defer` statements are not executed at the end of a loop if the loop is
exited using a `break` statement, or a `continue` statement. The semantics
of this need to change because it is not expected behaviour. Also it would
prevent the usefulness of this pattern:
--- /dev/null
+Some tags to watch out for in the code with features that may be removed in the future:
+
+ :ValueDirectiveHack
+ In the same way #type can be used to express a type expression
+ in a value context, #value can be used to express a value expression
+ in a type context, such as a #solidify directive.
+
+ :NullProcHack
+ There are many times where being able to store a procedure that
+ is 'null' is useful, such as a vtable-like structure that doesn't
+ need all members defined. For this reason, `null_proc` was added.
+ It type matches against all procedure types without an error, allowing
+ it to be used wherever a procedure was expected. Also, before calling
+ a dynamic procedure, it should be checked against `null_proc`.
+
+ The implementation of `null_proc` is rather simple, but feels a
+ little verbose an targential compared to everything else being done
+ in the compiler.
\ No newline at end of file
CheckStatus check_block(AstBlock* block) {
CHECK(statement_chain, block->body);
- bh_table_each_start(AstTyped *, block->scope->symbols);
- fill_in_type(value);
-
- // if (value->type == NULL) {
- // onyx_report_error(value->token->pos,
- // "Unable to resolve type for local '%b'.",
- // value->token->text, value->token->length);
- // return 1;
- // }
- bh_table_each_end;
+ bh_arr_each(AstTyped *, value, block->allocate_exprs) {
+ fill_in_type(*value);
+ if ((*value)->type == NULL) {
+ onyx_report_error((*value)->token->pos,
+ "Unable to resolve type for local '%b'.",
+ (*value)->token->text, (*value)->token->length);
+ return 1;
+ }
+ }
return Check_Success;
}