• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ExtendScript Throws on Nested Ternary Operator

New Here ,
Jan 22, 2018 Jan 22, 2018

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.

Views

400

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 22, 2018 Jan 22, 2018

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 : )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines