Good catch. Adding those tests showed a bug in my code (which I will
fix in a second).
On 2008-01-08, at 09:57 EST, Donald Anderson wrote:
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] (pending)
QA Reviewer: [EMAIL PROTECTED] (pending)
Doc Reviewer: [EMAIL PROTECTED] (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: [EMAIL PROTECTED]
www: http://www.ddanderson.com