Re: SCXML Test 553 assumes unset variables are invalid

Le 3 jul 2014 à 02:58, Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> a écrit :

> But I am having trouble to determine whether something is a valid LHS, how would you check such a thing in JavaScript? I could have “NAMELIST_ENTRY = undefined;” and see if I can parse it, without evaluating it but I was wondering if someone thought of something more clever?

Currently, JSSC also doesn't bother checking whether names in a namelist are valid LHS expressions.
However, for <assign>, what I do is essentially what you suggest. I save the original value in a temporary variable, then try{ eval("LHS = value") } catch(error){ if(error instanceOf ReferenceError) … }
and that's how I'll probably do it for this test. Try to assign some value (doesn't matter what) and catch ReferenceError, then reassign the original value and proceed (but since you have greater control over the ECMAScript runtime you can stop at parsing which is even better).

			David

Received on Thursday, 3 July 2014 05:51:07 UTC