Subj : Re: JS_IsAssigning To : jmtn@blueyonder.co.uk From : Brendan Eich Date : Thu Aug 28 2003 05:43 pm James Turner wrote: >Then I found JS_IsAssigning(), and I was happy, until I tried using >it. The problem is, it never, ever returns 'true' for me, in either of >the cases above (naturally, I'd expect it to return false for the >first case, and true for the second). Have I misunderstood what is's >supposed to do? > Yes, you've misunderstood (or the docs lie again). JS is bytecoded, so the expression foo.bar.x = 42 is turned into postfix code of the form 'name "foo"; getprop "bar"; uint16 42; setprop "x"'. Only from the setprop bytecode would JS_IsAssigning return true. > I also note that there's some JS_RESOLVE flags that >mention assignment; are these something I could be investigating? > Only if you're resolving 'x' in foo.bar. If you're resolving 'bar' in foo while evaluating 'foo.bar.x = 42', the resolve call for 'bar' in foo will not include the JSRESOLVE_ASSIGNING flag. Why do you need to detect a difference when resolving or getting 'bar' in foo between 'baz = foo.bar.x;' and 'foo.bar.x = 42;'? /be .