Let . refer to entire args struct

This commit is contained in:
jaina heartles 2022-12-08 02:58:18 -08:00
parent 5924c257e0
commit ef27bb5c21
2 changed files with 3 additions and 1 deletions

View file

@ -17,6 +17,7 @@ pub fn main() !void {
.quxx = true,
.maybe_foo = @as(?[]const u8, "foo"),
.maybe_bar = @as(?[]const u8, null),
.x = "y",
},
.{
.context_foo = "foo",
@ -658,7 +659,7 @@ fn parseDeref(comptime tokens: ControlTokenIter) ParseResult(ControlTokenIter, [
if (wants != .period) @compileError("Unexpected token \".\"");
wants = .text;
},
else => if (wants == .period) return .{
else => if (wants == .period or fields.len == 0) return .{
.new_iter = iter,
.item = fields,
} else @compileError("Unexpected token"),

View file

@ -27,6 +27,7 @@
{#if .maybe_foo |$_|}abcd{#else}null{/if}
<template>{#template test_tmpl .bar}</template>
<template>{#template test_tmpl .}</template>
{@context_foo}
</section>