aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-11-06 23:21:31 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-11-08 15:57:24 -0500
commit2a6fbbd8fba30b8d24aa966606372f595c102d55 (patch)
tree1cdb0d029de60a63d3bba24520aa8665536ba65c /src/codegen.cpp
parent6d28b28ccc689e6bf8849b1d39e969e8da760999 (diff)
downloadzig-2a6fbbd8fba30b8d24aa966606372f595c102d55.tar.gz
zig-2a6fbbd8fba30b8d24aa966606372f595c102d55.zip
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
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp1
1 files changed, 1 insertions, 0 deletions
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) {