| author | |
| committer | |
| log | b0c173910c8131298d9cc74335843fdcf91d4225 |
| tree | 7cdfdd0f18964d7ec3dede0032c73430e90412e4 |
| parent | 4470c3b285523251143a844ca7821d457fdae8af |
| signature | Commit is signed but in an unrecognized format. |
5 files changed, 7 insertions(+), 5 deletions(-)
CHANGELOG.md+2| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | ## 0.1.7 | 1 | ## 0.1.7 |
| 2 | 2 | ||
| 3 | - feat: allow any expression as a function body | ||
| 4 | |||
| 3 | ## 0.1.6 | 5 | ## 0.1.6 |
| 4 | 6 | ||
| 5 | - breaking: rename `@js` to `@extern`, considering future backends | 7 | - breaking: rename `@js` to `@extern`, considering future backends |
src/cli_compiler.zig+2| ... | @@ -48,6 +48,8 @@ pub fn main() !u8 { | ... | @@ -48,6 +48,8 @@ pub fn main() !u8 { |
| 48 | defer Cli.programArgsFree(alloc, args); | 48 | defer Cli.programArgsFree(alloc, args); |
| 49 | const opts = arg_config.parse(program_name, args); | 49 | const opts = arg_config.parse(program_name, args); |
| 50 | 50 | ||
| 51 | if (opts.report_trace == true) Report.debug_show_report_trace = true; | ||
| 52 | |||
| 51 | const file_path = try std.fs.path.resolve(alloc, &.{ | 53 | const file_path = try std.fs.path.resolve(alloc, &.{ |
| 52 | cwd, | 54 | cwd, |
| 53 | opts.positionals orelse | 55 | opts.positionals orelse |
src/core/Parse.zig+1-2| ... | @@ -498,8 +498,7 @@ fn parseFnDecl(p: *Parse) Error!NodeIndex { | ... | @@ -498,8 +498,7 @@ fn parseFnDecl(p: *Parse) Error!NodeIndex { |
| 498 | else | 498 | else |
| 499 | null; | 499 | null; |
| 500 | 500 | ||
| 501 | try p.expectWithoutAdvance(.start_brace); | 501 | const body = try p.parseExpression(.expression); |
| 502 | const body = try p.parseBlock(); | ||
| 503 | 502 | ||
| 504 | const extra = try p.addExtra(Ast.Fn, .{ | 503 | const extra = try p.addExtra(Ast.Fn, .{ |
| 505 | .params = params orelse .empty, | 504 | .params = params orelse .empty, |
src/core/Sema.zig+1-1| ... | @@ -1706,7 +1706,7 @@ fn coerceRef(s: *Sema, src: LazyNode, ref: Air.Inst.Ref, to: Type) !Air.Inst.Ref | ... | @@ -1706,7 +1706,7 @@ fn coerceRef(s: *Sema, src: LazyNode, ref: Air.Inst.Ref, to: Type) !Air.Inst.Ref |
| 1706 | }, | 1706 | }, |
| 1707 | .int32 => switch (from) { | 1707 | .int32 => switch (from) { |
| 1708 | .int32 => unreachable, // same type handled | 1708 | .int32 => unreachable, // same type handled |
| 1709 | .numeric_literal => unreachable, // must should comptime known | 1709 | .numeric_literal => unreachable, // must be comptime known |
| 1710 | else => {}, | 1710 | else => {}, |
| 1711 | }, | 1711 | }, |
| 1712 | .float => switch (from) { | 1712 | .float => switch (from) { |
test/behavior/inferred_return_type+1-2| ... | @@ -1,8 +1,7 @@ | ... | @@ -1,8 +1,7 @@ |
| 1 | let assertEqual = @extern("assertEqual"); | 1 | let assertEqual = @extern("assertEqual"); |
| 2 | 2 | ||
| 3 | fn getString() { | 3 | fn getString() |
| 4 | "hello" | 4 | "hello" |
| 5 | } | ||
| 6 | 5 | ||
| 7 | fn main { | 6 | fn main { |
| 8 | let str = getString(); | 7 | let str = getString(); |