[Laszlo-checkins] r13695 - openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler

hqm@openlaszlo.org hqm at openlaszlo.org
Wed Apr 15 20:39:03 PDT 2009


Author: hqm
Date: 2009-04-15 20:39:02 -0700 (Wed, 15 Apr 2009)
New Revision: 13695

Modified:
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
Log:
Change 20090415-hqm-L by hqm at badtzmaru.home on 2009-04-15 16:45:10 EDT
    in /Users/hqm/openlaszlo/trunk5
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: support <passthrough> block on canvas element

New Features:

Bugs Fixed: LPP-7717

Technical Reviewer: ptw
QA Reviewer: andre.bargull
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
    
+ treat <passthrough> element as a "property element", so it is compiled in the same
code path as <handler>, <method> , etc.


Tests:

+ test case below compiles in swf9 correctly, the imports are visible in the scope of the
canvas class or (anon subclass)
<canvas>
  <passthrough>
    import flash.geom.*;
    import flash.printing.*;
  </passthrough>
  <method name="foo">
    Debug.write('foo');
  </method>
</canvas>



Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java	2009-04-15 23:54:07 UTC (rev 13694)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java	2009-04-16 03:39:02 UTC (rev 13695)
@@ -460,7 +460,7 @@
         String name = elt.getName();
         return "attribute".equals(name) || "method".equals(name)
           || "handler".equals(name) || "setter".equals(name)
-          || "event".equals(name);
+          || "event".equals(name) || "passthrough".equals(name);
     }
 
     /** Returns a name that is used to report this element in warning
@@ -1280,12 +1280,6 @@
                     checkChildNameConflict(element.getName(), child, env);
                     NodeModel dpnode = elementAsModel(child, schema, env);
                     this.datapath = dpnode;
-                } else if (child.getName().equals("passthrough")) {
-                  if (env.isAS3()) {
-                    passthroughBlock = child.getText();
-                  } else {
-                    env.warn("The passthrough tag can only be used in an as3 runtime, perhaps you could put this in a switch tag?",child);
-                  }
                 } else {
                     checkChildNameConflict(element.getName(), child, env);
                     NodeModel childModel = elementAsModel(child, schema, env);
@@ -1392,9 +1386,24 @@
         addAttributeElement(element);
       } else if ("setter".equals(tagName)) {
         addSetterElement(element);
+      } else if ("passthrough".equals(tagName)) {
+        addPassthroughElement(element);
       }
     }
 
+    /** Compile a <passthrough> block for a node.
+     *
+     * Transforms to a #passthrough compiler pragma in the script output
+     */
+    void addPassthroughElement(Element element) {
+      if (env.isAS3()) {
+        passthroughBlock = element.getText();
+      } else {
+        env.warn("The passthrough tag can only be used in an as3 runtime, "
+                 + "perhaps you could put this in a switch tag?",element);
+      }
+    }
+
     /** Defines an event handler.
      *
      * <handler name="eventname" [method="methodname"]>



More information about the Laszlo-checkins mailing list