From 634e8713c394bacfe080d03256d1dd4f9a43dd8c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 6 Nov 2017 22:07:19 -0500 Subject: 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 --- src/codegen.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/codegen.cpp') 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); -- cgit v1.2.3