Copy link to clipboard
Copied
Just filed this bug with Adobe, but wondering if anyone else has run into this:
ExtendScript wasn't listed in the products list for submitting a bug, so that's why I'm using the After Effects bug form for this issue.
When attempting to use a nested ternary (AKA conditional) operatory in ExtendScript (`<test1 expression> ? <test2 expression> ? <if test2 true> : <if test2 false> : <if test1 false>`), it errors rather than running as it should.
Steps to Reproduce Bug:
1. Open ExtendScript
2. Paste the following into a new source file (don't include the backticks): `true ? true ? "one" : "two" : "three";`
3. Run the script
Results: Errors at second question mark ("?") with the error: "Expected: : "
Expected Results: Should have run successfully and returned "one".
I assume that this is an artifact of the implementation of ECMAScript-262 for ExtendScript, but I don't know. This shouldn't error though.
Copy link to clipboard
Copied
This is really above my level of know-how in this area... but how about:
true ? ( true ? "one" : "two" ) : "three"
If not, I think you'd be better reposting this in the scripting 'subspace' for this forum. Look in the banner image at the top of the forum for he link. That's where the code experts hang out : )
Copy link to clipboard
Copied
Didn't see how many communities there were (and that some were more specifically in line with this type of question -- though I couldn't find one simply dedicated to ExtendScript), so I've reposted it here and here.
The code above is a minimal example of code that was generated from the Google Closure compiler, so I haven't written it directly (and thus can't (easily) rewrite it for quirks in the ExtendScript's implementation). But the Google Closure compiler is ECMAScript 3 compatible, so the JS in ExtendScript shouldn't throw an error on the code above. Given that Google Closure compiled JS has been running on browsers running ES3 for years now, I figured it was likely a bug on Adobe's side.