Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in operator not usable in if. #660

Closed
AlexMax opened this issue Feb 2, 2016 · 2 comments
Closed

in operator not usable in if. #660

AlexMax opened this issue Feb 2, 2016 · 2 comments

Comments

@AlexMax
Copy link
Contributor

AlexMax commented Feb 2, 2016

On the subject of if, the documentation says:

It behaves exactly as javascript's if behaves.

However, in converting some swig templates over, I found that they were failing whenever the template made use of the in operator. A failing test is contained in #659. Here is a backtrace for the failing test:

  Template render error: (unknown path)
    TypeError: runtime.contextOrFrameLookup(...).indexOf is not a function
      at Object.exports.prettifyError (src/lib.js:9:1149)
      at src/environment.js:9:23995
      at root [as rootRenderFunc] (eval at <anonymous> (src/environment.js:9:27$78), <anonymous>:19:3)
      at Obj.extend.render (src/environment.js:9:23652)
      at render (tests/util.js:98:22)
      at equal (tests/util.js:36:19)
      at Context.<anonymous> (tests/compiler.js:130:13)
@carljm
Copy link
Contributor

carljm commented Feb 2, 2016

Pretty sure if in works fine with arrays, it just doesn't support objects. It should, though; thanks for the report and failing test!

@carljm
Copy link
Contributor

carljm commented Feb 2, 2016

Closed with merge of #661 - thanks @oyyd !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants