yats.vim icon indicating copy to clipboard operation
yats.vim copied to clipboard

template syntax breaks on curious combination of five conditions

Open qbalukom opened this issue 5 years ago • 1 comments

To achieve the bug, following must be met:

  • assignment to a variable (or as a parameter in a function call)
  • right side must be an object
  • on the value side of a key:value pair must be a ternary expression
  • condition of that expression must have array access operator (foo[bar])
  • "true" value of the ternary must be a template string
  • the template string must contain an interpolated bit once that happens the template string is considered not closed and treats all following code as part of it. my experiments point to a theory that the "true" value is somehow treated as another key for the object, instead of an expression (included in the example files).

attaching both a file where i analyse and deconstruct the problem, as well as a screenshot with how it looks on my machine:

ts-syntax-bug.txt ts-syntax-bug

qbalukom avatar Oct 21 '19 12:10 qbalukom

also, i've noticed i made a typo - in the deconstruction part of template-as-key, it should say "still shouldn't break"

qbalukom avatar Oct 21 '19 12:10 qbalukom