[Laszlo-dev] For Review: Change 20090226-hqm-e Summary: fix more cases in compiling classes with 'required' attributes
Donald Anderson
dda at ddanderson.com
Thu Feb 26 20:16:47 PST 2009
approved.
On Feb 26, 2009, at 5:25 PM, Henry Minsky wrote:
> Change 20090226-hqm-e by hqm at badtzmaru.home on 2009-02-26 17:03:43 EST
> in /Users/hqm/openlaszlo/trunk6
> for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: fix more cases in compiling classes with 'required'
> attributes
>
> New Features:
>
> Bugs Fixed: LPP-7440
>
> Technical Reviewer: ptw
> QA Reviewer: dda at ddanderson.com
> Doc Reviewer: (pending)
>
> Documentation:
>
> Release Notes:
>
> It is now an error to define an attribute to have both a
> non-null default value and also to be required. I.e., this is
> forbidden
>
> <class name="bar">
> <attribute name="foo" value="259" require="true"/>
> </class>
>
>
>
> Details:
>
> See bug report. When a class defines a default value for a required
> attribute, then the attribute is no longer 'required', an instance
> will always get the default value.
>
> NodeModel checks, for each instance that it is compiling, for each
> attribute that is declared as required, has it been assigned a value
> in the instance, (2) the class, (3) or any superclass.
>
>
> Tests:
>
> tests in bug report, should give these compilation warnings:
>
> required-a.lzx:
> <canvas>
> <class name="foo">
> <attribute name="grid" value="null" required="true"/>
> </class>
>
> <class name="bar" extends="foo">
> <attribute name="r2" value="null" required="true"/>
> <attribute name="a3" value="null" required="false"/>
> <attribute name="a4" value="null" required="false"/>
> </class>
>
> <foo/>
> <foo grid="259"/>
>
> <bar/>
> <bar grid="259"/>
> <bar grid="259" r2="12" a3="canvas"/>
> </canvas>
>
> required-a.lzx:12:11: Missing required attribute grid for tag foo
> required-a.lzx:15:11: Missing required attribute grid for tag bar
> required-a.lzx:15:11: Missing required attribute r2 for tag bar
> required-a.lzx:16:22: Missing required attribute r2 for tag bar
>
> test/compiler_errors/required-attribute-1.lzx:
> <canvas>
> <class name="foo">
> <attribute name="grid" value="null" required="true"/>
> </class>
> <class name="aa" extends="foo" grid="abc"/>
> <class name="bb" extends="foo"/>
>
> <!--
> this should not give compile warning as this is an instance of
> aa and the value of grid is set in class aa
> -->
> <aa />
>
> <!-- should give compiler warning for missing 'grid' -->
> <bb />
> </canvas>
>
> required-b.lzx:14:9: Missing required attribute grid for tag bb
>
> Files:
> A test/compiler_errors/required-attributes-1.lzx
> M WEB-INF/lps/server/src/org/openlaszlo/compiler/
> ClassCompiler.java
> M WEB-INF/lps/server/src/org/openlaszlo/compiler/ViewSchema.java
> M WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
> M WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java
>
> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090226-hqm-e.tar
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-306-2057
email: dda at ddanderson.com
www: http://www.ddanderson.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20090226/a88136c1/attachment.html
More information about the Laszlo-dev
mailing list