asm...
This commit is contained in:
@@ -82,6 +82,18 @@ pub const Parser = struct {
|
||||
return self.parseImplBlock(start);
|
||||
}
|
||||
|
||||
// Top-level `inline if` — compile-time conditional
|
||||
if (self.current.tag == .kw_inline) {
|
||||
if (self.peekNext() == .kw_if) {
|
||||
self.advance(); // skip 'inline'
|
||||
const expr = try self.parseIfExpr();
|
||||
if (expr.data == .if_expr) {
|
||||
expr.data.if_expr.is_comptime = true;
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
}
|
||||
|
||||
// All top-level declarations start with an identifier
|
||||
if (!self.isIdentLike() and self.current.tag != .kw_Self) {
|
||||
return self.fail("expected identifier at top level");
|
||||
@@ -1375,6 +1387,19 @@ pub const Parser = struct {
|
||||
return try self.createNode(start, .{ .insert_expr = .{ .expr = inner } });
|
||||
}
|
||||
|
||||
// inline if — compile-time conditional
|
||||
if (self.current.tag == .kw_inline) {
|
||||
if (self.peekNext() == .kw_if) {
|
||||
self.advance(); // skip 'inline'
|
||||
const expr = try self.parseIfExpr();
|
||||
if (expr.data == .if_expr) {
|
||||
expr.data.if_expr.is_comptime = true;
|
||||
}
|
||||
try self.expectSemicolonAfter(expr);
|
||||
return expr;
|
||||
}
|
||||
}
|
||||
|
||||
// Block-form if/while/for as statements — parse directly to prevent
|
||||
// postfix chaining (e.g. `if cond { ... }.field` being misparsed)
|
||||
if (self.current.tag == .kw_if) {
|
||||
|
||||
Reference in New Issue
Block a user