From a116312f79782e204bae9e3aac858af53ff79beb Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 1 Jan 2021 22:06:12 -0600 Subject: [PATCH] random little changes --- misc/onyx.sublime-syntax | 12 ++++++++++++ src/onyxutils.c | 4 +--- src/onyxwasm.c | 4 +--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/misc/onyx.sublime-syntax b/misc/onyx.sublime-syntax index 3ef22813..bb27b144 100644 --- a/misc/onyx.sublime-syntax +++ b/misc/onyx.sublime-syntax @@ -48,6 +48,18 @@ contexts: - match: '#[a-zA-Z_]+' scope: keyword.other.onyx + - match: '([a-zA-Z_][a-zA-Z0-9_]*)\s*::\s*proc' + captures: + 1: entity.name.function + + - match: '([a-zA-Z_][a-zA-Z0-9_]*)\s*::\s*struct' + captures: + 1: entity.name.struct + + - match: '([a-zA-Z_][a-zA-Z0-9_]*)\s*::\s*enum' + captures: + 1: entity.name.enum + - match: '([a-zA-Z_][a-zA-Z0-9_\.]+)\s*\(' captures: 1: meta.function-call.onyx diff --git a/src/onyxutils.c b/src/onyxutils.c index 132a43cc..ace28bbe 100644 --- a/src/onyxutils.c +++ b/src/onyxutils.c @@ -929,10 +929,8 @@ b32 type_check_or_auto_cast(AstTyped** pnode, Type* type) { if (types_are_compatible(node->type, type)) return 1; if (node_is_auto_cast((AstNode *) node)) { - // If the node is an auto cast, we convert it to a cast node which will reports errors if - // the cast is illegal in the code generation. + // HACK: Check that this cast is legal! ((AstUnaryOp *) node)->type = type; - // ((AstUnaryOp *) node)->operation = Unary_Op_Cast; return 1; } else if (node->kind == Ast_Kind_NumLit) { diff --git a/src/onyxwasm.c b/src/onyxwasm.c index a563d589..ebed5db1 100644 --- a/src/onyxwasm.c +++ b/src/onyxwasm.c @@ -1366,10 +1366,8 @@ EMIT_FUNC(unaryop, AstUnaryOp* unop) { break; } + case Unary_Op_Auto_Cast: case Unary_Op_Cast: emit_cast(mod, &code, unop); break; - - // NOTE: Any remaining auto casts can be ignored since it means that a cast was not necessary. - brendanfh 2020/09/19 - case Unary_Op_Auto_Cast: emit_cast(mod, &code, unop); break; } *pcode = code; -- 2.25.1