diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-11-06 23:21:31 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-11-08 15:57:24 -0500 |
| commit | 2a6fbbd8fba30b8d24aa966606372f595c102d55 (patch) | |
| tree | 1cdb0d029de60a63d3bba24520aa8665536ba65c /src/codegen.cpp | |
| parent | 6d28b28ccc689e6bf8849b1d39e969e8da760999 (diff) | |
| download | zig-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.cpp | 1 |
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) { |
