Closed jberkel closed 5 years ago
Weird, because we explicitly have a test for empty tokens: https://github.com/stencilproject/Stencil/blob/master/Tests/StencilTests/LexerSpec.swift#L79
Although you're right, we don't seem have a test for empty variables (at first glance). I do wonder though, should we even consider this correct syntax?
I think we shouldn't even if it would be an easy thing to do. Looking at the test we have it might be that extra space makes a difference in this case (IIRC it is used to break down content of the token into components). Throwing syntax error would be nicer than fatalError here though.
@jberkel what is your use case where you end up with such syntax?
@ilyapuchka I don't have a use case, but in my app the templates are user editable, so I have to deal with invalid input. I expect and handle TemplateSyntaxError
, but this bug just crashes the app.
In 0.12.x. and earlier,
{{ }}
simply yielded an empty string, now it produces "Fatal error: Index out of range" in Node.swift:87Testcase: