[Laszlo-dev] For Review: Change 20080107-ptw-n Summary: Implement `is` operator

Donald Anderson dda at ddanderson.com
Tue Jan 8 06:57:48 PST 2008


Approved.

Given knowledge of the implementation, I would like to see a couple
additional tests with more complex expressions for more code coverage:

       LzTestManager.assertFalse( (new Banana()) instanceof Number );
       LzTestManager.assertTrue( (new Number()) instanceof Number );
       LzTestManager.assertFalse( (new Banana()) is Number );
       LzTestManager.assertTrue( (new Number()) is Number );

- Don


On Jan 7, 2008, at 4:10 PM, P T Withington wrote:

> Change 20080107-ptw-n by ptw at dueling-banjos.local on 2008-01-07  
> 15:41:52 EST
>    in /Users/ptw/OpenLaszlo/ringding-2
>    for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: Implement `is` operator
>
> Bugs Fixed:
> LPP-3632 'Implement `is` operator'
>
> Technical Reviewer: dda at ddanderson.com (pending)
> QA Reviewer: henry.minsky at gmail.com (pending)
> Doc Reviewer: lou at louiorio.com (pending)
>
> Documentation:
> We now implement the ECMAScript 4 `is` operator
>
> Details:
>    lztest-class-impl: Use modern syntax, verify that `is` is
>    equivalent to `instanceof` and works properly for mixins.
>
>    Class: add runtime support for `is` operator on mixins
>
>    JavascriptGenerator, CodeGenerator, ParseTreePrinter, Parser:  Add
>    support for `is` operator, which in JS1 runtimes is approximated
>    as:  a is b => b['$lzsc$isa'] ? b.$lzsc$isa(a) : (a instanceof b),
>    relying on the runtime support in Class for $lzsc$isa.
>
>    ASTVisitor: remove the unused visitBinaryExpression
>
> Tests:
>    Amended class-impl test to test that `is` is equivalent to
>    `instanceof` for classes and works properly for mixins.
>
> Files:
> M      test/lztest/lztest-class-impl.lzx
> M      WEB-INF/lps/lfc/compiler/Class.lzs
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/ 
> JavascriptGenerator.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/ASTVisitor.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
> M      WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
>
> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080107-ptw-n.tar


--

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