diff options
-rw-r--r-- | src/js_lexer.zig | 6 | ||||
-rw-r--r-- | src/json_parser.zig | 2 | ||||
-rw-r--r-- | src/logger.zig | 32 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/js_lexer.zig b/src/js_lexer.zig index 3f221d3c5..5b1bfc127 100644 --- a/src/js_lexer.zig +++ b/src/js_lexer.zig @@ -43,7 +43,7 @@ pub const Lexer = struct { log: *logger.Log, json_options: ?JSONOptions = null, for_global_name: bool = false, - source: logger.Source, + source: *logger.Source, current: usize = 0, start: usize = 0, end: usize = 0, @@ -1103,7 +1103,7 @@ pub const Lexer = struct { var empty_string_literal: JavascriptString = &emptyJavaScriptString; var lex = LexerType{ .log = log, - .source = source.*, + .source = source, .string_literal = empty_string_literal, .prev_error_loc = logger.Loc.Empty, .allocator = allocator, @@ -1124,7 +1124,7 @@ pub const Lexer = struct { var empty_string_literal: JavascriptString = &emptyJavaScriptString; var lex = LexerType{ .log = log, - .source = source.*, + .source = source, .string_literal = empty_string_literal, .prev_error_loc = logger.Loc.Empty, .allocator = allocator, diff --git a/src/json_parser.zig b/src/json_parser.zig index 9c0257899..87910b7eb 100644 --- a/src/json_parser.zig +++ b/src/json_parser.zig @@ -216,7 +216,7 @@ pub fn ParseJSON(source: *logger.Source, log: *logger.Log, allocator: *std.mem.A return parser.parseExpr(); } -pub fn ParseTSConfig(log: logger.Loc, source: logger.Source, allocator: *std.mem.Allocator) !Expr { +pub fn ParseTSConfig(log: logger.Loc, source: *logger.Source, allocator: *std.mem.Allocator) !Expr { var parser = try TSConfigParser.init(allocator, log, source); return parser.parseExpr(); diff --git a/src/logger.zig b/src/logger.zig index 7736e5d62..ce5960050 100644 --- a/src/logger.zig +++ b/src/logger.zig @@ -72,7 +72,7 @@ pub const Location = struct { }; } - pub fn init_or_nil(_source: ?Source, r: Range) ?Location { + pub fn init_or_nil(_source: ?*Source, r: Range) ?Location { if (_source) |source| { var data = source.initErrorPosition(r.loc); return Location{ @@ -164,14 +164,14 @@ pub const Log = struct { }; } - pub fn addVerbose(log: *Log, source: ?Source, loc: Loc, text: string) !void { + pub fn addVerbose(log: *Log, source: ?*Source, loc: Loc, text: string) !void { try log.addMsg(Msg{ .kind = .verbose, .data = rangeData(source, Range{ .loc = loc }, text), }); } - pub fn addVerboseWithNotes(source: ?Source, loc: Loc, text: string, notes: []Data) !void { + pub fn addVerboseWithNotes(source: ?*Source, loc: Loc, text: string, notes: []Data) !void { try log.addMsg(Msg{ .kind = .verbose, .data = rangeData(source, Range{ .loc = loc }, text), @@ -179,7 +179,7 @@ pub const Log = struct { }); } - pub fn addRangeError(log: *Log, source: ?Source, r: Range, text: string) !void { + pub fn addRangeError(log: *Log, source: ?*Source, r: Range, text: string) !void { log.errors += 1; try log.addMsg(Msg{ .kind = .err, @@ -187,7 +187,7 @@ pub const Log = struct { }); } - pub fn addRangeErrorFmt(log: *Log, source: ?Source, r: Range, allocator: *std.mem.Allocator, comptime text: string, args: anytype) !void { + pub fn addRangeErrorFmt(log: *Log, source: ?*Source, r: Range, allocator: *std.mem.Allocator, comptime text: string, args: anytype) !void { log.errors += 1; try log.addMsg(Msg{ .kind = .err, @@ -195,7 +195,7 @@ pub const Log = struct { }); } - pub fn addRangeErrorFmtWithNotes(log: *Log, source: ?Source, r: Range, allocator: *std.mem.Allocator, notes: []Data, comptime text: string, args: anytype) !void { + pub fn addRangeErrorFmtWithNotes(log: *Log, source: ?*Source, r: Range, allocator: *std.mem.Allocator, notes: []Data, comptime text: string, args: anytype) !void { log.errors += 1; try log.addMsg(Msg{ .kind = .err, @@ -204,7 +204,7 @@ pub const Log = struct { }); } - pub fn addErrorFmt(log: *Log, source: ?Source, l: Loc, allocator: *std.mem.Allocator, comptime text: string, args: anytype) !void { + pub fn addErrorFmt(log: *Log, source: ?*Source, l: Loc, allocator: *std.mem.Allocator, comptime text: string, args: anytype) !void { log.errors += 1; try log.addMsg(Msg{ .kind = .err, @@ -212,7 +212,7 @@ pub const Log = struct { }); } - pub fn addRangeWarning(log: *Log, source: ?Source, r: Range, text: string) !void { + pub fn addRangeWarning(log: *Log, source: ?*Source, r: Range, text: string) !void { log.warnings += 1; try log.addMsg(Msg{ .kind = .warn, @@ -220,7 +220,7 @@ pub const Log = struct { }); } - pub fn addWarningFmt(log: *Log, source: ?Source, l: Loc, allocator: *std.mem.Allocator, comptime text: string, args: anytype) !void { + pub fn addWarningFmt(log: *Log, source: ?*Source, l: Loc, allocator: *std.mem.Allocator, comptime text: string, args: anytype) !void { log.warnings += 1; try log.addMsg(Msg{ .kind = .err, @@ -228,7 +228,7 @@ pub const Log = struct { }); } - pub fn addRangeWarningFmt(log: *Log, source: ?Source, r: Range, allocator: *std.mem.Allocator, comptime text: string, args: anytype) !void { + pub fn addRangeWarningFmt(log: *Log, source: ?*Source, r: Range, allocator: *std.mem.Allocator, comptime text: string, args: anytype) !void { log.warnings += 1; try log.addMsg(Msg{ .kind = .warn, @@ -236,7 +236,7 @@ pub const Log = struct { }); } - pub fn addWarning(log: *Log, source: ?Source, l: Loc, text: string) !void { + pub fn addWarning(log: *Log, source: ?*Source, l: Loc, text: string) !void { log.warnings += 1; try log.addMsg(Msg{ .kind = .warn, @@ -244,14 +244,14 @@ pub const Log = struct { }); } - pub fn addRangeDebug(log: *Log, source: ?Source, r: Range, text: string) !void { + pub fn addRangeDebug(log: *Log, source: ?*Source, r: Range, text: string) !void { try log.addMsg(Msg{ .kind = .debug, .data = rangeData(source, r, text), }); } - pub fn addRangeErrorWithNotes(log: *Log, source: ?Source, r: Range, text: string, notes: []Data) !void { + pub fn addRangeErrorWithNotes(log: *Log, source: ?*Source, r: Range, text: string, notes: []Data) !void { log.errors += 1; try log.addMsg(Msg{ .kind = Kind.err, @@ -260,7 +260,7 @@ pub const Log = struct { }); } - pub fn addRangeWarningWithNotes(log: *Log, source: ?Source, r: Range, text: string, notes: []Data) !void { + pub fn addRangeWarningWithNotes(log: *Log, source: ?*Source, r: Range, text: string, notes: []Data) !void { log.warnings += 1; try log.addMsg(Msg{ .kind = .warning, @@ -275,7 +275,7 @@ pub const Log = struct { } // TODO: - pub fn addError(self: *Log, _source: ?Source, loc: Loc, text: string) !void { + pub fn addError(self: *Log, _source: ?*Source, loc: Loc, text: string) !void { self.errors += 1; try self.addMsg(Msg{ .kind = .err, .data = rangeData(_source, Range{ .loc = loc }, text) }); } @@ -444,7 +444,7 @@ pub const Source = struct { } }; -pub fn rangeData(source: ?Source, r: Range, text: string) Data { +pub fn rangeData(source: ?*Source, r: Range, text: string) Data { return Data{ .text = text, .location = Location.init_or_nil(source, r) }; } |