diff options
-rw-r--r-- | src/root.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/root.zig b/src/root.zig index b944b1b..d4f55dc 100644 --- a/src/root.zig +++ b/src/root.zig @@ -6,12 +6,24 @@ const ArgsTuple = std.meta.ArgsTuple; const HashMap = std.AutoHashMapUnmanaged; const Type = std.builtin.Type; const assert = std.debug.assert; +const builtin = @import("builtin"); const c = @cImport(@cInclude("janet.h")); const c_allocator = std.heap.c_allocator; +const eql = std.mem.eql; const expectEqualDeep = std.testing.expectEqualDeep; const toLower = std.ascii.toLower; const std = @import("std"); +pub const IgnoredDecl = struct { + type: type, + decl: []const u8, +}; +const ignored_decls = if (builtin.is_test) [_]IgnoredDecl{ +} else @import("root").zsanett_ignored_decls; +comptime { + assert(@typeInfo(@TypeOf(ignored_decls)).array.child == IgnoredDecl); +} + pub const Environment = @import("Environment.zig"); test { _ = Environment; @@ -148,6 +160,12 @@ pub fn wrap(x: anytype) !Value { var count: usize = 0; var cfuns: [info.decls.len]struct { Value, Value } = undefined; inline for (info.decls) |decl_info| { + if (comptime for (ignored_decls) |ignored| { + if (ignored.type == T and eql(u8, ignored.decl, + decl_info.name)) + break true; + } else false) + continue; const decl = @field(T, decl_info.name); switch (@typeInfo(@TypeOf(decl))) { .@"fn" => |fn_info| if (!fn_info.is_generic) { |