FIx macros remap in Transpiler

This commit is contained in:
Jarred Sumner
2022-01-21 18:10:38 -08:00
parent 111f0921f5
commit 22c01ca14c
2 changed files with 8 additions and 1 deletions

View File

@@ -443,7 +443,7 @@ fn transformOptionsFromJSC(ctx: JSC.C.JSContextRef, temp_allocator: std.mem.Allo
macros: {
if (macros.isUndefinedOrNull()) break :macros;
const kind = macros.jsType();
const is_object = kind == JSC.JSValue.JSType.Object;
const is_object = kind.isObject();
if (!(kind.isStringLike() or is_object)) {
JSC.throwInvalidArguments("macro must be an object", .{}, ctx, exception);
return transpiler;

View File

@@ -1439,6 +1439,13 @@ pub const JSValue = enum(i64) {
MaxJS = 0b11111111,
_,
pub fn isObject(this: JSType) bool {
return switch (this) {
.Object, .FinalObject => true,
else => false,
};
}
pub fn toC(this: JSType) C_API.JSTypedArrayType {
return switch (this) {
.Int8Array => .kJSTypedArrayTypeInt8Array,