Author: dda
Date: 2007-12-18 08:35:07 -0800 (Tue, 18 Dec 2007)
New Revision: 7592
Modified:
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
Log:
Change 20071218-dda-v by [EMAIL PROTECTED] on 2007-12-18 11:30:41 EST
in /Users/dda/laszlo/src/svn/openlaszlo/branches/devildog
for http://svn.openlaszlo.org/openlaszlo/branches/devildog
Summary: SWF9: All user defined classes should extend Instance
New Features: none
Bugs Fixed: LPP-5234
Technical Reviewer: ptw (pending)
QA Reviewer: hminsky (pending)
Doc Reviewer: (pending)
Documentation: none
Release Notes: none
Details:
User defined classes should extend 'Instance' by default,
if a superclass is not indicated, we insert 'extends Instance',
unless the class is Instance itself. Users not wanting to
extend Instance must use 'extends Object' explicitly.
Tests:
Tried some simple classes, if not marked by 'extends', they
now extend Instance. 'Instance' class itself is excepted.
Modified:
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
===================================================================
---
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
2007-12-18 16:34:15 UTC (rev 7591)
+++
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
2007-12-18 16:35:07 UTC (rev 7592)
@@ -45,6 +45,11 @@
public static final boolean USE_COMPILER_DEBUG_FLAG = true;
/**
+ * If no 'extends' keyword is present, we insert an inheritence.
+ */
+ public static final String DEFAULT_SUPER_CLASS = "Instance";
+
+ /**
* Saved program node, to show during debugging
*/
SimpleNode savedProgram = null;
@@ -95,20 +100,10 @@
ASTIdentifier classname = (ASTIdentifier)children[1];
String classnameString = classname.getName();
SimpleNode superclass = children[2];
- SimpleNode traits = children[3];
- SimpleNode traitsandsuper;
- if (traits instanceof ASTEmptyExpression) {
- if (superclass instanceof ASTEmptyExpression) {
- traitsandsuper = new ASTLiteral(null);
- } else {
- traitsandsuper = superclass;
- }
- } else {
- traitsandsuper = new ASTArrayLiteral(0);
- traitsandsuper.setChildren(traits.getChildren());
- if (! (superclass instanceof ASTEmptyExpression)) {
- traitsandsuper.set(traitsandsuper.size(), superclass);
- }
+ SimpleNode mixins = children[3];
+
+ if (superclass instanceof ASTEmptyExpression &&
!classnameString.equals(DEFAULT_SUPER_CLASS)) {
+ superclass = children[2] = new ASTIdentifier(DEFAULT_SUPER_CLASS);
}
SimpleNode[] dirs = (SimpleNode [])(Arrays.asList(children).subList(4,
children.length).toArray(new SimpleNode[0]));
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins