Today I added MXML parser unit tests for MXMLPropertySpecifierNode in the case
of properties of type Boolean, int, uint, Number, and String.
Here's some background about property-specifier nodes in Falcon:
Suppose a class has a property p of type int. Then you set can p on an instance
(or a class definition) in three ways:
(1) Instance tag + property tag + instance tag for value
<MyComponent>
<p>
<int>1</int>
</p>
</MyComponent>
(2) Instance tag + property tag + text for value
<MyComponent>
<p>1</p>
</MyComponent>
(3) Property attrribute
<MyComponent p="1"/>
Note that (1) is the general case and is required for properties of non-scalar
type. (2) and (3) are just terser equivalents that can be used when the
property has a scalar type.
These three MXML snippets all have the same semantics, and produce the same
three nodes in the AST:
MXMLInstanceNode "MyComponent"
MXMLPropertySpecifierNode "p"
MXMLIntNode 1
which means "set the property p of the instance of MyComponent to the int 1".
The code generator produces ABC such as
// ... instance-ref
dup
// ... instance-ref instanceref
push 1
// ... instance-ref instance-ref property-value
setproperty p
// ... instance-ref
(where the comments show what is on the stack) for each
MXMLPropertySpecifierNode, although I haven't added functional tests of
property nodes yet.
- Gordon