diff options
author | 2021-08-01 19:04:38 -0700 | |
---|---|---|
committer | 2021-08-01 19:04:38 -0700 | |
commit | 85b6d448cebcb305dce4dee4b7fb96e309e5b94e (patch) | |
tree | bffeca8050173c801ba092d5b65d561b4d03dc1b /src/js_parser/js_parser.zig | |
parent | 7245f90b2dd686acacb9c8ee03f5d8fb05e09aeb (diff) | |
download | bun-85b6d448cebcb305dce4dee4b7fb96e309e5b94e.tar.gz bun-85b6d448cebcb305dce4dee4b7fb96e309e5b94e.tar.zst bun-85b6d448cebcb305dce4dee4b7fb96e309e5b94e.zip |
hm
Former-commit-id: 0dc1c1a74b845d037326f4f2facd786924ca722e
Diffstat (limited to 'src/js_parser/js_parser.zig')
-rw-r--r-- | src/js_parser/js_parser.zig | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig index a987351c7..5ca0b3f57 100644 --- a/src/js_parser/js_parser.zig +++ b/src/js_parser/js_parser.zig @@ -17,17 +17,22 @@ usingnamespace @import("imports.zig"); const TemplatePartTuple = std.meta.Tuple(&[_]type{ []E.TemplatePart, logger.Loc }); const ScopeOrderList = std.ArrayListUnmanaged(?ScopeOrder); -pub fn ExpressionTransposer(comptime ctx: type, visitor: fn (ptr: *ctx, arg: Expr, state: anytype) Expr) type { +pub fn ExpressionTransposer( + comptime Kontext: type, + visitor: fn (ptr: *Kontext, arg: Expr, state: anytype) Expr, +) type { return struct { + pub const Context = Kontext; + pub const This = @This(); context: *Context, - pub fn init(c: *Context) @This() { - return @This(){ + pub fn init(c: *Context) This { + return This{ .context = c, }; } - pub fn maybeTransposeIf(self: *@This(), arg: Expr, state: anytype) Expr { + pub fn maybeTransposeIf(self: *This, arg: Expr, state: anytype) Expr { switch (arg.data) { .e_if => |ex| { ex.yes = self.maybeTransposeIf(ex.yes, state); @@ -39,7 +44,6 @@ pub fn ExpressionTransposer(comptime ctx: type, visitor: fn (ptr: *ctx, arg: Exp }, } } - pub const Context = ctx; }; } |