aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-11-06 22:07:19 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-11-06 22:07:19 -0500
commit634e8713c394bacfe080d03256d1dd4f9a43dd8c (patch)
tree8fa396aa96acfa556217f83eb90ecb6a14d88c4d /src/codegen.cpp
parentf0dafd3f209a342f055850108651545bea9b065b (diff)
downloadzig-634e8713c394bacfe080d03256d1dd4f9a43dd8c.tar.gz
zig-634e8713c394bacfe080d03256d1dd4f9a43dd8c.zip
add @memberType and @memberName builtin functions
see #383 there is a plan to unify most of the reflection into 2 builtin functions, as outlined in the above issue, but this gives us needed features for now, and we can iterate on the design in future commits
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 2a2cd3ba10..976b20405e 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3384,6 +3384,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
case IrInstructionIdEmbedFile:
case IrInstructionIdIntType:
case IrInstructionIdMemberCount:
+ case IrInstructionIdMemberType:
+ case IrInstructionIdMemberName:
case IrInstructionIdAlignOf:
case IrInstructionIdFnProto:
case IrInstructionIdTestComptime:
@@ -4867,6 +4869,8 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdMaxValue, "maxValue", 1);
create_builtin_fn(g, BuiltinFnIdMinValue, "minValue", 1);
create_builtin_fn(g, BuiltinFnIdMemberCount, "memberCount", 1);
+ create_builtin_fn(g, BuiltinFnIdMemberType, "memberType", 2);
+ create_builtin_fn(g, BuiltinFnIdMemberName, "memberName", 2);
create_builtin_fn(g, BuiltinFnIdTypeof, "typeOf", 1); // TODO rename to TypeOf
create_builtin_fn(g, BuiltinFnIdAddWithOverflow, "addWithOverflow", 4);
create_builtin_fn(g, BuiltinFnIdSubWithOverflow, "subWithOverflow", 4);