You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by go...@apache.org on 2013/01/26 00:58:15 UTC
svn commit: r1438781 - in /flex/falcon/trunk:
compiler.tests/feature-tests/properties/
compiler/src/org/apache/flex/compiler/internal/as/codegen/
compiler/src/org/apache/flex/compiler/internal/tree/mxml/
Author: gordonsmith
Date: Fri Jan 25 23:58:15 2013
New Revision: 1438781
URL: http://svn.apache.org/viewvc?rev=1438781&view=rev
Log: (empty)
Added:
flex/falcon/trunk/compiler.tests/feature-tests/properties/
flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyBooleanTests.java (with props)
flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyClassTests.java (with props)
flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyIntTests.java (with props)
flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyNumberTests.java (with props)
flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyStringTests.java (with props)
flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyTestsBase.java (with props)
flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyUintTests.java (with props)
Modified:
flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java
Added: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyBooleanTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyBooleanTests.java?rev=1438781&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyBooleanTests.java (added)
+++ flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyBooleanTests.java Fri Jan 25 23:58:15 2013
@@ -0,0 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package properties;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for MXML property tags and attributes of type {@code <Boolean>}.
+ *
+ * @author Gordon Smith
+ */
+public class MXMLPropertyBooleanTests extends MXMLPropertyTestsBase
+{
+ @Override
+ protected String getPropertyType()
+ {
+ return "Boolean";
+ }
+
+ @Test
+ public void MXMLPropertyBooleanTests_default()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, false);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyBooleanTests_attribute()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1' p=' true '/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, true);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyBooleanTests_tag_text()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p> true </p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, true);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyBooleanTests_tag_tag()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p><fx:Boolean> true </fx:Boolean></p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, true);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+}
Propchange: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyBooleanTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyClassTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyClassTests.java?rev=1438781&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyClassTests.java (added)
+++ flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyClassTests.java Fri Jan 25 23:58:15 2013
@@ -0,0 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package properties;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for MXML property tags and attributes of type {@code <Class>}.
+ *
+ * @author Gordon Smith
+ */
+public class MXMLPropertyClassTests extends MXMLPropertyTestsBase
+{
+ @Override
+ protected String getPropertyType()
+ {
+ return "Class";
+ }
+
+ @Test
+ public void MXMLPropertyClassTests_default()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, null);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyClassTests_attribute()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1' p=' flash.display.Sprite '/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, flash.display.Sprite);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyClassTests_tag_text()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p> flash.display.Sprite </p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, flash.display.Sprite);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyClassTests_tag_tag()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p><fx:Class> flash.display.Sprite </fx:Class></p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, flash.display.Sprite);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+}
Propchange: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyClassTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyIntTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyIntTests.java?rev=1438781&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyIntTests.java (added)
+++ flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyIntTests.java Fri Jan 25 23:58:15 2013
@@ -0,0 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package properties;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for MXML property tags and attributes of type {@code <int>}.
+ *
+ * @author Gordon Smith
+ */
+public class MXMLPropertyIntTests extends MXMLPropertyTestsBase
+{
+ @Override
+ protected String getPropertyType()
+ {
+ return "int";
+ }
+
+ @Test
+ public void MXMLPropertyIntTests_default()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, 0);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyIntTests_attribute()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1' p=' -1 '/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, -1);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyIntTests_tag_text()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p> -1 </p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, -1);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyIntTests_tag_tag()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p><fx:int> -1 </fx:int></p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, -1);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+}
Propchange: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyIntTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyNumberTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyNumberTests.java?rev=1438781&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyNumberTests.java (added)
+++ flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyNumberTests.java Fri Jan 25 23:58:15 2013
@@ -0,0 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package properties;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for MXML property tags and attributes of type {@code <Number>}.
+ *
+ * @author Gordon Smith
+ */
+public class MXMLPropertyNumberTests extends MXMLPropertyTestsBase
+{
+ @Override
+ protected String getPropertyType()
+ {
+ return "Number";
+ }
+
+ @Test
+ public void MXMLPropertyNumberTests_default()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('isNaN(mc1.p)', isNaN(mc1.p), true);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyNumberTests_attribute()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1' p=' 1.5 '/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, 1.5);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyNumberTests_tag_text()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p> 1.5 </p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, 1.5);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyNumberTests_tag_tag()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p><fx:Number> 1.5 </fx:Number></p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, 1.5);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+}
Propchange: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyNumberTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyStringTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyStringTests.java?rev=1438781&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyStringTests.java (added)
+++ flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyStringTests.java Fri Jan 25 23:58:15 2013
@@ -0,0 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package properties;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for MXML property tags and attributes of type {@code <String>}.
+ *
+ * @author Gordon Smith
+ */
+public class MXMLPropertyStringTests extends MXMLPropertyTestsBase
+{
+ @Override
+ protected String getPropertyType()
+ {
+ return "String";
+ }
+
+ @Test
+ public void MXMLPropertyStringTests_default()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, null);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyStringTests_attribute()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1' p=' abc '/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, ' abc ');"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyStringTests_tag_text()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p> abc </p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, ' abc ');"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyStringTests_tag_tag()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p><fx:String> abc </fx:String></p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, ' abc ');"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+}
Propchange: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyStringTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyTestsBase.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyTestsBase.java?rev=1438781&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyTestsBase.java (added)
+++ flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyTestsBase.java Fri Jan 25 23:58:15 2013
@@ -0,0 +1,91 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package properties;
+
+import mxml.tags.MXMLFeatureTestsBase;
+
+import org.apache.flex.utils.StringUtils;
+
+/**
+ * Base class for feature tests for MXML property tags and attributes.
+ *
+ * @author Gordon Smith
+ */
+public abstract class MXMLPropertyTestsBase extends MXMLFeatureTestsBase
+{
+ protected String[] getTemplate()
+ {
+ // Property-node tests use this template, which declares a component
+ // with a property of a particular type. The tests then set the
+ // property on a <MyComp> tag inside the <Declarations> tag.
+ return new String[]
+ {
+ "<d:Sprite xmlns:fx='http://ns.adobe.com/mxml/2009'",
+ " xmlns:d='flash.display.*'",
+ " xmlns='*'",
+ " enterFrame='enterFrameHandler(event)'>",
+ " <fx:Declarations>",
+ " <fx:Component className='MyComp'>",
+ " <d:Sprite>",
+ " <fx:Script>",
+ " public var p:%1;",
+ " </fx:Script>",
+ " </d:Sprite>",
+ " </fx:Component>",
+ " %2",
+ " </fx:Declarations>",
+ " <fx:Script>",
+ " <![CDATA[",
+ " private function assertEqual(message:String, actualValue:*, expectedValue:*):void",
+ " {",
+ " if (actualValue !== expectedValue)",
+ " {",
+ " trace(message, actualValue, expectedValue);",
+ " System.exit(1);",
+ " }",
+ " }",
+ " private function enterFrameHandler(event:Event):void",
+ " {",
+ " %3",
+ " System.exit(0);",
+ " }",
+ " ]]>",
+ " </fx:Script>",
+ "</d:Sprite>"
+ };
+ }
+
+ // Note: The presence of <fx:Component> means that these tests must compile against framework.swc
+ // in order to find mx.core.ClassFactory.
+
+ // TODO: When mx.core.ClassFactory isn't found, we currently don't report a compilation error
+ // and instead compile a SWF that doesn't verify.
+
+ protected String getMXML(String[] declarations, String[] asserts)
+ {
+ String mxml = StringUtils.join(getTemplate(), "\n");
+ mxml = mxml.replace("%1", getPropertyType());
+ mxml = mxml.replace("%2", StringUtils.join(declarations, "\n "));
+ mxml = mxml.replace("%3", StringUtils.join(asserts, "\n "));
+ return mxml;
+ }
+
+ abstract protected String getPropertyType();
+}
Propchange: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyTestsBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyUintTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyUintTests.java?rev=1438781&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyUintTests.java (added)
+++ flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyUintTests.java Fri Jan 25 23:58:15 2013
@@ -0,0 +1,100 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package properties;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for MXML property tags and attributes of type {@code <uint>}.
+ *
+ * @author Gordon Smith
+ */
+public class MXMLPropertyUintTests extends MXMLPropertyTestsBase
+{
+ @Override
+ protected String getPropertyType()
+ {
+ return "uint";
+ }
+
+ @Test
+ public void MXMLPropertyUintTests_default()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, 0);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyUintTests_attribute()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1' p=' 4000000000 '/>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, 4000000000);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyUintTests_tag_text()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p> 4000000000 </p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, 4000000000);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+
+ @Test
+ public void MXMLPropertyUintTests_tag_tag()
+ {
+ String[] declarations = new String[]
+ {
+ "<MyComp id='mc1'>",
+ " <p><fx:uint> 4000000000 </fx:uint></p>",
+ "</MyComp>"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('mc1.p', mc1.p, 4000000000);"
+ };
+ String mxml = getMXML(declarations, asserts);
+ compileAndRun(mxml, true, false, false, null);
+ }
+}
Propchange: flex/falcon/trunk/compiler.tests/feature-tests/properties/MXMLPropertyUintTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java?rev=1438781&r1=1438780&r2=1438781&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java (original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java Fri Jan 25 23:58:15 2013
@@ -3127,7 +3127,7 @@ public class MXMLClassDirectiveProcessor
// Get the Name for the mx.core.ClassFactory class.
ICompilerProject project = getProject();
ClassDefinition classReference = (ClassDefinition)factoryNode.getClassReference(project);
- Name factoryClassName = classReference.getMName(project);
+ Name factoryClassName = classReference != null ? classReference.getMName(project) : null;
// Push this class.
context.addInstruction(OP_finddef, factoryClassName);
Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java?rev=1438781&r1=1438780&r2=1438781&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java (original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNode.java Fri Jan 25 23:58:15 2013
@@ -295,10 +295,13 @@ class MXMLInstanceNode extends MXMLClass
FlexProject project = builder.getProject();
IClassDefinition classReference = getClassReference(project);
- String qname = classReference.getQualifiedName();
- builder.addDependency(qname, DependencyType.EXPRESSION);
- if (id != null)
- builder.addDependency(qname, DependencyType.SIGNATURE);
+ if (classReference != null)
+ {
+ String qname = classReference.getQualifiedName();
+ builder.addDependency(qname, DependencyType.EXPRESSION);
+ if (id != null)
+ builder.addDependency(qname, DependencyType.SIGNATURE);
+ }
}
@Override