[Laszlo-dev] For Review: Change 20080518-dda-6 Summary: Script compiler line number rework
Donald Anderson
dda at ddanderson.com
Mon May 19 10:34:47 PDT 2008
Aha - thanks, that was baffling.
I'll fix the comment accordingly.
I assume you're still reviewing this.
On May 19, 2008, at 9:16 AM, P T Withington wrote:
> On 2008-05-18, at 16:16 EDT, Donald Anderson wrote:
>
>> Also observed during testing is the necessity of not breaking
>> output
>> lines to insert /* -*- file: .... */ comments. This breaks
>> lzunit
>> test/lztest/lztest-node-options.js in a strange manner:
>>
>> [exec] js: "test/lztest/lztest-node-options.js", line
>> 108: uncaught JavaScript runtime exception: TypeError:
>> org.mozilla.javascript.Undefined at 992bae is not a function, it is
>> org.mozilla.javascript.Undefined.
>
> This is probably because Javascript has 'implicit semi-colons'. The
> parser rule is that if you see a line break where a semi would be
> accepted, pretend you saw a semi. Unfortunately that makes:
>
> return
> foo
>
> Parse as:
>
> return;
> foo;
>
> And your function returns no value and `foo` becomes unreachable code.
>
> (In JS2 they have fixed this by not permitting an implicit semi
> between return and an expression.)
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com
More information about the Laszlo-dev
mailing list