improve comptime interpreter stack trace message
This commit is contained in:
parent
ca644d67c1
commit
9131285db1
@ -52,7 +52,7 @@ pub fn recordError(
|
|||||||
.code = code,
|
.code = code,
|
||||||
.message = message,
|
.message = message,
|
||||||
});
|
});
|
||||||
if (previous != null) interpreter.allocator.free(message);
|
if (previous) |p| interpreter.allocator.free(p.value.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(interpreter: *ComptimeInterpreter) void {
|
pub fn deinit(interpreter: *ComptimeInterpreter) void {
|
||||||
|
@ -764,30 +764,26 @@ pub fn resolveTypeOfNodeInternal(store: *DocumentStore, arena: *std.heap.ArenaAl
|
|||||||
log.info("Invoking interpreter!", .{});
|
log.info("Invoking interpreter!", .{});
|
||||||
|
|
||||||
store.ensureInterpreterExists(handle.uri) catch |err| {
|
store.ensureInterpreterExists(handle.uri) catch |err| {
|
||||||
log.err("Interpreter error: {s}", .{@errorName(err)});
|
log.err("Failed to interpret file: {s}", .{@errorName(err)});
|
||||||
if (@errorReturnTrace()) |trace| {
|
if (@errorReturnTrace()) |trace| {
|
||||||
std.debug.dumpStackTrace(trace.*);
|
std.debug.dumpStackTrace(trace.*);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
var interpreter = handle.interpreter.?;
|
var interpreter: *ComptimeInterpreter = handle.interpreter.?;
|
||||||
|
|
||||||
try interpreter.namespaces.append(interpreter.allocator, .{
|
const root_namespace = @intToEnum(ComptimeInterpreter.NamespaceIndex, 0);
|
||||||
.parent = .none,
|
|
||||||
.node_idx = 0,
|
|
||||||
.ty = .none,
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO: Start from current/nearest-current scope
|
// TODO: Start from current/nearest-current scope
|
||||||
const result = interpreter.interpret(node, .none, .{}) catch |err| {
|
const result = interpreter.interpret(node, root_namespace, .{}) catch |err| {
|
||||||
log.err("Interpreter error: {s}", .{@errorName(err)});
|
log.err("Failed to interpret node: {s}", .{@errorName(err)});
|
||||||
if (@errorReturnTrace()) |trace| {
|
if (@errorReturnTrace()) |trace| {
|
||||||
std.debug.dumpStackTrace(trace.*);
|
std.debug.dumpStackTrace(trace.*);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
const value = result.getValue() catch |err| {
|
const value = result.getValue() catch |err| {
|
||||||
log.err("Interpreter error: {s}", .{@errorName(err)});
|
log.err("interpreter return no result: {s}", .{@errorName(err)});
|
||||||
if (@errorReturnTrace()) |trace| {
|
if (@errorReturnTrace()) |trace| {
|
||||||
std.debug.dumpStackTrace(trace.*);
|
std.debug.dumpStackTrace(trace.*);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user