Change 20080222-dda-o by [EMAIL PROTECTED] on 2008-02-22 21:31:39 EST
    in /Users/dda/laszlo/src/svn/openlaszlo/trunk-dep
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Add support for new dependency mechanism in script compiler

New Features:

Bugs Fixed: LPP-5335 (partial)

Technical Reviewer: ptw (pending)
QA Reviewer: hminsky (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
Introduces a new function Compiler.dependenciesForExpression() taking
    a source expression e.g. "a.b.c + this.something.Fcn(1)" and
    producing a source expression representing the dependency, e.g.
[a.b, "c"].concat(this.something.hasOwnProperty("$lsc $Fcn_dependencies") ? (this.something cast Object).$lsc $Fcn_dependencies(this, this.something, 1) : [])

This change does not functionally change *anything*, but it provides an API needed to switch over to having the tag compiler generate the
    dependency functions.

    The significant changes are in ReferenceCollector, which keeps two
implementations (old and new) for the moment. It doesn't make sense to refactor them into a common codebase since the old implementation will go away after new dependencies are fully integrated. The old implementation internal methods can be found in ReferenceCollector named as *_using_subfunction in reference to the original naming convention fcn() -> fcn.dependencies() .

The new implementation uses naming fcn() -> $lsc $fcn_dependencies() as
    indicated in the example above.
The implementation is conscious of the naming convention, since there
    may be calls to the dependency functions in the produced output.

There is also a fix to the ParseTreePrinter so that it knows how to print 'cast'. This wasn't needed before to print final output from JS1, since casts were always removed. Casts are generated in the dependency source so they will work with SWF9 - without it, the flex compile complains about references to nonexistant dependency functions. Downcasting to Object makes the compiler *less* strict and accepting of any function name. The output from the simple dependency given above has been tested to
    compile with flex2 as a proof of concept.

Also a small improvement to ReferenceGenerator to only create one Compiler.Parser object.

This snippet added to NodeModel.java during testing (but not part of this change)
    shows how the new dependency function can be called:

        if (when.equals(WHEN_ALWAYS)) {
System.out.println("CONSTRAINT: src = " + canonicalValue.toString()); String dep = (new org .openlaszlo .sc.Compiler()).dependenciesForExpression(canonicalValue.toString());
            System.out.println("CONSTRAINT: dep = " + dep);
        }


Tests:
    regression: smokecheck,weather,lzpix (swf8/dhtml), runlzunit

Files:
M      WEB-INF/lps/server/src/org/openlaszlo/sc/ReferenceCollector.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
M      WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080222-dda-o.tar



--

Don Anderson
Java/C/C++, Berkeley DB, systems consultant

voice: 617-547-7881
email: [EMAIL PROTECTED]
www: http://www.ddanderson.com




Reply via email to