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

ptw@openlaszlo.org ptw at openlaszlo.org
Thu Oct 2 17:49:09 PDT 2008


Author: ptw
Date: 2008-10-02 17:49:07 -0700 (Thu, 02 Oct 2008)
New Revision: 11327

Modified:
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java
Log:
Change 20081002-ptw-5 by ptw at dueling-banjos.local on 2008-10-02 20:07:36 EDT
    in /Users/ptw/OpenLaszlo/honey-dew
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Import compiler to define classes in tag table

Bugs Fixed:
LPP-7083  ImportCompiler does not install tags into "lz"-namespace
LPP-5443  import and datasets

Technical Reviewer: hminsky (pending)
QA Reviewer: a.bargull at intensis.de (pending)

Details:
    Move the code that outputs the tag map up from CanvasCompiler to
    ToplevelCompiler and call it from CanvasCompiler and
    ImportCompiler.  Note that ImportCompiler builds a separate
    environment to dump the import to, so that must be where the tag
    map gets dumped.

Tests:
    Test cases from LPP-6791 and from LPP-5443, smokecheck



Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java	2008-10-03 00:43:28 UTC (rev 11326)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java	2008-10-03 00:49:07 UTC (rev 11327)
@@ -183,17 +183,7 @@
             }
         }
         
-        // Output the tag->class map.
-        String tagmap = "";
-        for (Iterator v = mEnv.getTags().entrySet().iterator(); v.hasNext(); ) {
-          Map.Entry entry = (Map.Entry) v.next();
-          String tagName = (String) entry.getKey();
-          String className = (String) entry.getValue();
-          // Install in constructor map
-          tagmap += ("lz[" + ScriptCompiler.quote(tagName) + "] = " + className + ";\n");
-        }
-        mEnv.compileScript(tagmap);
-
+        outputTagMap(mEnv);
     }
         
   void computePropertiesAndGlobals (Element element, NodeModel model, ViewSchema schema) {

Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java	2008-10-03 00:43:28 UTC (rev 11326)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java	2008-10-03 00:49:07 UTC (rev 11327)
@@ -209,11 +209,12 @@
 
                     }
                 }
+                // Now output the additions to the tag map
+                outputTagMap(env);
                 if (Compiler.SWF_RUNTIMES.contains(runtime)) {
                     ((SWFWriter) env.getGenerator()).setLevel0(false);
                 }
 
-
                 ViewCompiler.checkUnresolvedResourceReferences (env);
                 writer.closeSnippet();
                 env.compileScript("// FINISH compiling <IMPORT> Library "+liburl+"\n");

Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java	2008-10-03 00:43:28 UTC (rev 11326)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java	2008-10-03 00:49:07 UTC (rev 11327)
@@ -3,7 +3,7 @@
  * ****************************************************************************/
 
 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
+* Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.              *
 * Use is subject to license terms.                                            *
 * J_LZ_COPYRIGHT_END *********************************************************/
 
@@ -14,6 +14,7 @@
 import org.jdom.Element;
 import org.openlaszlo.compiler.ViewCompiler.*;
 import org.openlaszlo.server.*;
+import org.openlaszlo.sc.ScriptCompiler;
 import org.openlaszlo.utils.*;
 import org.jdom.*;
 import org.apache.log4j.*;
@@ -49,7 +50,24 @@
             }
         }
     }
-    
+
+  /**
+   * Outputs the tag map entries for the tags defined in this
+   * top-level form
+   */
+  public void outputTagMap(CompilationEnvironment env) {
+        // Output the tag->class map.
+        String tagmap = "";
+        for (Iterator v = env.getTags().entrySet().iterator(); v.hasNext(); ) {
+          Map.Entry entry = (Map.Entry) v.next();
+          String tagName = (String) entry.getKey();
+          String className = (String) entry.getValue();
+          // Install in constructor map
+          tagmap += ("lz[" + ScriptCompiler.quote(tagName) + "] = " + className + ";\n");
+        }
+        env.compileScript(tagmap);
+  }
+
     /** Parses out user class definitions.
      *
      * <p>



More information about the Laszlo-checkins mailing list