Browse Source

fixes for latest zig

master
Luna 6 months ago
parent
commit
f9e8543b7c
3 changed files with 7 additions and 5 deletions
  1. +2
    -0
      examples/hello.v
  2. +3
    -3
      src/main.zig
  3. +2
    -2
      src/parser.zig

+ 2
- 0
examples/hello.v View File

@@ -17,6 +17,8 @@ fn main(a int) int {
mut a := 1+2
a = 2

a = 1 && 0

if a {
println(30)
} else {


+ 3
- 3
src/main.zig View File

@@ -13,7 +13,7 @@ pub const Result = error{
pub const StdOut = *std.io.OutStream(std.fs.File.WriteError);

fn run(allocator: *Allocator, data: []u8) !void {
var stdout_file = try std.io.getStdOut();
var stdout_file = std.io.getStdOut();
const stdout = &stdout_file.outStream().stream;

var runner = runners.Runner.init(allocator, stdout);
@@ -39,7 +39,7 @@ fn runFile(allocator: *Allocator, path: []const u8) !void {
}

fn runPrompt(allocator: *Allocator) !void {
var stdout_file = try std.io.getStdOut();
var stdout_file = std.io.getStdOut();
const stdout = &stdout_file.outStream().stream;

while (true) {
@@ -71,7 +71,7 @@ pub fn main() anyerror!void {
defer arena.deinit();
var allocator = &arena.allocator;

var stdout_file = try std.io.getStdOut();
var stdout_file = std.io.getStdOut();
var stdout = &stdout_file.outStream().stream;

var args_it = std.process.args();


+ 2
- 2
src/parser.zig View File

@@ -1029,8 +1029,8 @@ pub const Parser = struct {
fn finishStructVal(self: *@This(), expr: *Expr) !*Expr {
// <expr>{a: 10 b: 10}
// for this to work properly, <expr> must be Variable, since its a type.
if (ast.ExprType(expr.*) != .Variable) {
self.doError("Expected variable for struct type, got {}", ast.ExprType(expr.*));
if (@as(ast.ExprType, expr.*) != .Variable) {
self.doError("Expected variable for struct type, got {}", @as(ast.ExprType, expr.*));
return Result.CompileError;
}



Loading…
Cancel
Save