From 2a6fbbd8fba30b8d24aa966606372f595c102d55 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 6 Nov 2019 23:21:31 -0500 Subject: introduce `@as` builtin for type coercion This commit also hooks up type coercion (previously called implicit casting) into the result location mechanism, and additionally hooks up variable declarations, maintaining the property that: var a: T = b; is semantically equivalent to: var a = @as(T, b); See #1757 --- src/codegen.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 89c41b61cc..4861def16c 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8070,6 +8070,7 @@ static void define_builtin_fns(CodeGen *g) { create_builtin_fn(g, BuiltinFnIdFrameType, "Frame", 1); create_builtin_fn(g, BuiltinFnIdFrameAddress, "frameAddress", 0); create_builtin_fn(g, BuiltinFnIdFrameSize, "frameSize", 1); + create_builtin_fn(g, BuiltinFnIdAs, "as", 2); } static const char *bool_to_str(bool b) { -- cgit v1.2.3