This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new 7355acb7c more fixes for RPC classes (HTTPService, WebService,
RemoteObject) request/arguments properties
7355acb7c is described below
commit 7355acb7ce53458788e34a93f75830e473375588
Author: Josh Tynjala <[email protected]>
AuthorDate: Thu Feb 1 16:23:42 2024 -0800
more fixes for RPC classes (HTTPService, WebService, RemoteObject)
request/arguments properties
More sdk.dependent.tests to handle more edge cases
Fixed missing ignoring of prefixes where appropriate
---
.../org/apache/royale/compiler/tree/ASTNodeID.java | 1 -
.../internal/visitor/mxml/MXMLNodeSwitch.java | 1 -
.../as/codegen/MXMLClassDirectiveProcessor.java | 34 +++++++----
.../mxml/MXMLHTTPServiceRequestPropertyNode.java | 10 ++--
...MLRemoteObjectMethodArgumentsPropertyNode.java} | 61 ++++++++++---------
.../tree/mxml/MXMLRemoteObjectMethodNode.java | 28 +++++++++
...LWebServiceOperationArgumentsPropertyNode.java} | 22 +++----
.../tree/mxml/MXMLWebServiceOperationNode.java | 36 ++++++++++-
...XMLRemoteObjectMethodArgumentsPropertyNode.java | 27 +++++++++
...MLWebServiceOperationArgumentsPropertyNode.java | 27 +++++++++
.../java/mxml/tags/MXMLRemoteObjectTagTests.java | 36 +++++++++++
.../java/mxml/tags/MXMLWebServiceTagTests.java | 70 ++++++++++++++++++++++
12 files changed, 293 insertions(+), 60 deletions(-)
diff --git
a/compiler-common/src/main/java/org/apache/royale/compiler/tree/ASTNodeID.java
b/compiler-common/src/main/java/org/apache/royale/compiler/tree/ASTNodeID.java
index 5d55ac08a..415e3acf6 100644
---
a/compiler-common/src/main/java/org/apache/royale/compiler/tree/ASTNodeID.java
+++
b/compiler-common/src/main/java/org/apache/royale/compiler/tree/ASTNodeID.java
@@ -251,7 +251,6 @@ public enum ASTNodeID
MXMLFileID(null, true),
MXMLFunctionID(null, true),
MXMLHTTPServiceID(null, true),
- MXMLHTTPServiceRequestID(null, true),
MXMLImplementsID(null, true),
MXMLInstanceID(null, true),
MXMLIntID(null, true),
diff --git
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
index 8855cc135..a203c7970 100644
---
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
+++
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
@@ -184,7 +184,6 @@ public class MXMLNodeSwitch implements IASNodeStrategy
case MXMLDateID:
case MXMLDefinitionID:
case MXMLDesignLayerID:
- case MXMLHTTPServiceRequestID:
case MXMLLibraryID:
case MXMLModelID:
case MXMLModelPropertyID:
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
index 38304df15..6572f7c8d 100644
---
a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
+++
b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
@@ -112,6 +112,7 @@ import java.util.Vector;
import org.apache.royale.abc.ABCConstants;
import org.apache.royale.abc.instructionlist.InstructionList;
+import org.apache.royale.abc.semantics.Instruction;
import org.apache.royale.abc.semantics.Label;
import org.apache.royale.abc.semantics.MethodBodyInfo;
import org.apache.royale.abc.semantics.MethodInfo;
@@ -959,7 +960,6 @@ public class MXMLClassDirectiveProcessor extends
ClassDirectiveProcessor
processMXMLEventSpecifier((IMXMLEventSpecifierNode) node,
childContext);
break;
}
- case MXMLHTTPServiceRequestID:
case MXMLPropertySpecifierID:
{
processMXMLPropertySpecifier((IMXMLPropertySpecifierNode)
node, childContext);
@@ -2979,19 +2979,19 @@ public class MXMLClassDirectiveProcessor extends
ClassDirectiveProcessor
void processMXMLWebServiceOperation(IMXMLWebServiceOperationNode node,
Context context)
{
- processOperationOrMethod(node, context, node.getOperationName());
+ processOperationOrMethod(node, context, node.getOperationName(),
false);
}
void processMXMLRemoteObjectMethod(IMXMLRemoteObjectMethodNode node,
Context context)
{
- processOperationOrMethod(node, context, node.getMethodName());
+ processOperationOrMethod(node, context, node.getMethodName(), true);
}
/**
* Generates instructions in the current context to push the value of an
* {@code IMXMLOperationNode}.
*/
- void processOperationOrMethod(IMXMLInstanceNode node, Context context,
String name)
+ void processOperationOrMethod(IMXMLInstanceNode node, Context context,
String name, boolean includeArgNames)
{
// If 'name' is undefined, the WebService node will report problem.
if (!Strings.isNullOrEmpty(name))
@@ -3015,15 +3015,27 @@ public class MXMLClassDirectiveProcessor extends
ClassDirectiveProcessor
propNode =
(IMXMLPropertySpecifierNode)argNode;
argList.add(propNode.getName());
}
- if (argList.size() > 0)
+ if (includeArgNames && argList.size() >
0)
{
context.startUsing(IL.PROPERTIES);
- context.addInstruction(OP_pushstring,
"argumentNames");
- context.addInstruction(OP_pushtrue);
- for (String s : argList)
- context.addInstruction(OP_pushstring, s);
- context.addInstruction(OP_newarray,
argList.size());
- context.stopUsing(IL.PROPERTIES, 1);
+
+ if
(!getProject().getTargetSettings().getMxmlChildrenAsData())
+ {
+ context.addInstruction(OP_dup);
+ for (String s : argList)
+ context.addInstruction(OP_pushstring, s);
+ context.addInstruction(OP_newarray,
argList.size());
+ context.addInstruction(OP_setproperty, new
Name("argumentNames"));
+ }
+ else
+ {
+ context.addInstruction(OP_pushstring,
"argumentNames");
+ context.addInstruction(OP_pushtrue);
+ for (String s : argList)
+ context.addInstruction(OP_pushstring, s);
+ context.addInstruction(OP_newarray,
argList.size());
+ }
+ context.stopUsing(IL.PROPERTIES, 1);
}
break;
}
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
index f81e76cf3..683b082b7 100644
---
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
+++
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
@@ -29,12 +29,12 @@ import
org.apache.royale.compiler.tree.mxml.IMXMLHTTPServiceRequestPropertyNode;
import org.apache.royale.compiler.tree.mxml.IMXMLNode;
/**
- * AST node for {@code <s:request>} tag under a {@code <s:HTTPService>} tag.
+ * AST node for {@code <request>} tag under a {@code <HTTPService>} tag.
*/
class MXMLHTTPServiceRequestPropertyNode extends MXMLPropertySpecifierNode
implements IMXMLHTTPServiceRequestPropertyNode
{
/**
- * Create node for {@code <s:request>} tag.
+ * Create node for {@code <request>} tag.
*
* @param parent Parent node.
*/
@@ -49,11 +49,11 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
@Override
public ASTNodeID getNodeID()
{
- return ASTNodeID.MXMLHTTPServiceRequestID;
+ return ASTNodeID.MXMLPropertySpecifierID;
}
/**
- * {@code <s:request>} node only have one "instance" node of type "Object".
+ * {@code <request>} node only have one "instance" node of type "Object".
*/
@Override
public int getChildCount()
@@ -62,7 +62,7 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
}
/**
- * {@code <s:request>} node only have one "instance" node of type "Object".
+ * {@code <request>} node only have one "instance" node of type "Object".
*/
@Override
public IASNode getChild(int i)
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLRemoteObjectMethodArgumentsPropertyNode.java
similarity index 62%
copy from
compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
copy to
compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLRemoteObjectMethodArgumentsPropertyNode.java
index f81e76cf3..5a2b95d7b 100644
---
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
+++
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLRemoteObjectMethodArgumentsPropertyNode.java
@@ -1,21 +1,21 @@
/*
- *
- * 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.
- *
- */
+*
+* 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 org.apache.royale.compiler.internal.tree.mxml;
@@ -25,20 +25,20 @@ import org.apache.royale.compiler.mxml.IMXMLTagData;
import org.apache.royale.compiler.mxml.IMXMLUnitData;
import org.apache.royale.compiler.tree.ASTNodeID;
import org.apache.royale.compiler.tree.as.IASNode;
-import
org.apache.royale.compiler.tree.mxml.IMXMLHTTPServiceRequestPropertyNode;
import org.apache.royale.compiler.tree.mxml.IMXMLNode;
+import
org.apache.royale.compiler.tree.mxml.IMXMLRemoteObjectMethodArgumentsPropertyNode;
/**
- * AST node for {@code <s:request>} tag under a {@code <s:HTTPService>} tag.
+ * AST node for the {@code <arguments>} tag under the {@code <method>} tag,
which is under the {@code <RemoteObject>} tag.
*/
-class MXMLHTTPServiceRequestPropertyNode extends MXMLPropertySpecifierNode
implements IMXMLHTTPServiceRequestPropertyNode
+class MXMLRemoteObjectMethodArgumentsPropertyNode extends
MXMLPropertySpecifierNode implements
IMXMLRemoteObjectMethodArgumentsPropertyNode
{
/**
- * Create node for {@code <s:request>} tag.
+ * Create node for {@code <arguments>} tag.
*
* @param parent Parent node.
*/
- MXMLHTTPServiceRequestPropertyNode(MXMLHTTPServiceNode parent)
+ MXMLRemoteObjectMethodArgumentsPropertyNode(MXMLRemoteObjectMethodNode
parent)
{
super(parent);
objectNode = new MXMLObjectNode(this);
@@ -49,11 +49,11 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
@Override
public ASTNodeID getNodeID()
{
- return ASTNodeID.MXMLHTTPServiceRequestID;
+ return ASTNodeID.MXMLPropertySpecifierID;
}
/**
- * {@code <s:request>} node only have one "instance" node of type "Object".
+ * {@code <arguments>} node only have one "instance" node of type "Object".
*/
@Override
public int getChildCount()
@@ -62,14 +62,14 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
}
/**
- * {@code <s:request>} node only have one "instance" node of type "Object".
+ * {@code <arguments>} node only have one "instance" node of type "Object".
*/
@Override
public IASNode getChild(int i)
{
if (i != 0)
{
- throw new IndexOutOfBoundsException("Request node only have one
child node.");
+ throw new IndexOutOfBoundsException("Arguments node only have one
child node.");
}
return objectNode;
}
@@ -100,6 +100,11 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
@Override
protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
IMXMLTagData childTag, MXMLNodeInfo info)
{
+ if (childTag.getPrefix() != null)
+ {
+ // TODO Report a problem because a prefix means nothing.
+ }
+
final MXMLPropertySpecifierNode specifierNode = new
MXMLPropertySpecifierNode(this);
specifierNode.setDynamicName(childTag.getShortName());
specifierNode.initializeFromTag(builder, childTag);
@@ -108,7 +113,7 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
}
/**
- * Synthesize an "instance" node of type "Object" to own all the request
+ * Synthesize an "instance" node of type "Object" to own all the arguments
* fields.
*/
@Override
@@ -120,7 +125,7 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
}
/**
- * Span "object" node's offset to the parent "request" node. Make the
+ * Span "object" node's offset to the parent "arguments" node. Make the
* dynamic request properties children of the "object" node.
*/
private void initializeObjectNode(MXMLTreeBuilder builder, IMXMLTagData
tag, MXMLNodeInfo info)
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLRemoteObjectMethodNode.java
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLRemoteObjectMethodNode.java
index 3799bb5b7..0eb9198b1 100644
---
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLRemoteObjectMethodNode.java
+++
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLRemoteObjectMethodNode.java
@@ -19,6 +19,7 @@
package org.apache.royale.compiler.internal.tree.mxml;
+import org.apache.royale.compiler.internal.projects.RoyaleProject;
import org.apache.royale.compiler.internal.tree.as.NodeBase;
import org.apache.royale.compiler.mxml.IMXMLTagData;
import org.apache.royale.compiler.problems.ICompilerProblem;
@@ -32,11 +33,16 @@ import org.apache.royale.compiler.tree.mxml.IMXMLStringNode;
import static org.apache.royale.compiler.mxml.IMXMLLanguageConstants.*;
+import org.apache.royale.compiler.definitions.IClassDefinition;
+import org.apache.royale.compiler.definitions.IDefinition;
+
/**
* Implementation of the {@link IMXMLRemoteObjectMethodNode} interface.
*/
class MXMLRemoteObjectMethodNode extends MXMLInstanceNode implements
IMXMLRemoteObjectMethodNode
{
+ private static final String TAG_ARGUMENTS = "arguments";
+
/**
* Create an AST node.
*
@@ -110,4 +116,26 @@ class MXMLRemoteObjectMethodNode extends MXMLInstanceNode
implements IMXMLRemote
{
return methodName;
}
+
+ @Override
+ protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
IMXMLTagData childTag, MXMLNodeInfo info)
+ {
+ if (TAG_ARGUMENTS.equals(childTag.getShortName()) &&
childTag.getURI().equals(tag.getURI()))
+ {
+ final RoyaleProject project = builder.getProject();
+ final IClassDefinition classOperation = getClassReference(project);
+ final IDefinition definitionRequest =
project.resolveSpecifier(classOperation, TAG_ARGUMENTS);
+ if (definitionRequest != null)
+ {
+ final MXMLRemoteObjectMethodArgumentsPropertyNode
argsPropertyNode = new MXMLRemoteObjectMethodArgumentsPropertyNode(this);
+ argsPropertyNode.setDefinition(definitionRequest);
+ argsPropertyNode.initializeFromTag(builder, childTag);
+ info.addChildNode(argsPropertyNode);
+ }
+ }
+ else
+ {
+ super.processChildTag(builder, tag, childTag, info);
+ }
+ }
}
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLWebServiceOperationArgumentsPropertyNode.java
similarity index 81%
copy from
compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
copy to
compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLWebServiceOperationArgumentsPropertyNode.java
index f81e76cf3..81ac1c42e 100644
---
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLHTTPServiceRequestPropertyNode.java
+++
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLWebServiceOperationArgumentsPropertyNode.java
@@ -25,20 +25,20 @@ import org.apache.royale.compiler.mxml.IMXMLTagData;
import org.apache.royale.compiler.mxml.IMXMLUnitData;
import org.apache.royale.compiler.tree.ASTNodeID;
import org.apache.royale.compiler.tree.as.IASNode;
-import
org.apache.royale.compiler.tree.mxml.IMXMLHTTPServiceRequestPropertyNode;
+import
org.apache.royale.compiler.tree.mxml.IMXMLWebServiceOperationArgumentsPropertyNode;
import org.apache.royale.compiler.tree.mxml.IMXMLNode;
/**
- * AST node for {@code <s:request>} tag under a {@code <s:HTTPService>} tag.
+ * AST node for the {@code <arguments>} tag under the {@code <operation>} tag,
which is under the {@code <WebService>} tag.
*/
-class MXMLHTTPServiceRequestPropertyNode extends MXMLPropertySpecifierNode
implements IMXMLHTTPServiceRequestPropertyNode
+class MXMLWebServiceOperationArgumentsPropertyNode extends
MXMLPropertySpecifierNode implements
IMXMLWebServiceOperationArgumentsPropertyNode
{
/**
- * Create node for {@code <s:request>} tag.
+ * Create node for {@code <arguments>} tag.
*
* @param parent Parent node.
*/
- MXMLHTTPServiceRequestPropertyNode(MXMLHTTPServiceNode parent)
+ MXMLWebServiceOperationArgumentsPropertyNode(MXMLWebServiceOperationNode
parent)
{
super(parent);
objectNode = new MXMLObjectNode(this);
@@ -49,11 +49,11 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
@Override
public ASTNodeID getNodeID()
{
- return ASTNodeID.MXMLHTTPServiceRequestID;
+ return ASTNodeID.MXMLPropertySpecifierID;
}
/**
- * {@code <s:request>} node only have one "instance" node of type "Object".
+ * {@code <arguments>} node only have one "instance" node of type "Object".
*/
@Override
public int getChildCount()
@@ -62,14 +62,14 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
}
/**
- * {@code <s:request>} node only have one "instance" node of type "Object".
+ * {@code <arguments>} node only have one "instance" node of type "Object".
*/
@Override
public IASNode getChild(int i)
{
if (i != 0)
{
- throw new IndexOutOfBoundsException("Request node only have one
child node.");
+ throw new IndexOutOfBoundsException("Arguments node only have one
child node.");
}
return objectNode;
}
@@ -108,7 +108,7 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
}
/**
- * Synthesize an "instance" node of type "Object" to own all the request
+ * Synthesize an "instance" node of type "Object" to own all the arguments
* fields.
*/
@Override
@@ -120,7 +120,7 @@ class MXMLHTTPServiceRequestPropertyNode extends
MXMLPropertySpecifierNode imple
}
/**
- * Span "object" node's offset to the parent "request" node. Make the
+ * Span "object" node's offset to the parent "arguments" node. Make the
* dynamic request properties children of the "object" node.
*/
private void initializeObjectNode(MXMLTreeBuilder builder, IMXMLTagData
tag, MXMLNodeInfo info)
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLWebServiceOperationNode.java
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLWebServiceOperationNode.java
index 1dca238db..246a8a017 100644
---
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLWebServiceOperationNode.java
+++
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLWebServiceOperationNode.java
@@ -19,6 +19,11 @@
package org.apache.royale.compiler.internal.tree.mxml;
+import static
org.apache.royale.compiler.mxml.IMXMLLanguageConstants.ATTRIBUTE_NAME;
+
+import org.apache.royale.compiler.definitions.IClassDefinition;
+import org.apache.royale.compiler.definitions.IDefinition;
+import org.apache.royale.compiler.internal.projects.RoyaleProject;
import org.apache.royale.compiler.internal.tree.as.NodeBase;
import org.apache.royale.compiler.mxml.IMXMLTagData;
import org.apache.royale.compiler.problems.ICompilerProblem;
@@ -26,17 +31,18 @@ import
org.apache.royale.compiler.problems.MXMLEmptyAttributeProblem;
import org.apache.royale.compiler.problems.MXMLRequiredAttributeProblem;
import org.apache.royale.compiler.tree.ASTNodeID;
import org.apache.royale.compiler.tree.mxml.IMXMLInstanceNode;
-import org.apache.royale.compiler.tree.mxml.IMXMLWebServiceOperationNode;
import org.apache.royale.compiler.tree.mxml.IMXMLPropertySpecifierNode;
import org.apache.royale.compiler.tree.mxml.IMXMLStringNode;
-
-import static org.apache.royale.compiler.mxml.IMXMLLanguageConstants.*;
+import org.apache.royale.compiler.tree.mxml.IMXMLWebServiceOperationNode;
/**
* Implementation of the {@link IMXMLWebServiceOperationNode} interface.
*/
class MXMLWebServiceOperationNode extends MXMLInstanceNode implements
IMXMLWebServiceOperationNode
{
+ private static final String TAG_REQUEST = "request";
+ private static final String TAG_ARGUMENTS = "arguments";
+
/**
* Create an AST node.
*
@@ -110,4 +116,28 @@ class MXMLWebServiceOperationNode extends MXMLInstanceNode
implements IMXMLWebSe
{
return operationName;
}
+
+ @Override
+ protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
IMXMLTagData childTag, MXMLNodeInfo info)
+ {
+ String childTagShortName = childTag.getShortName();
+ // request is just an alias for arguments
+ if ((TAG_ARGUMENTS.equals(childTagShortName) ||
TAG_REQUEST.equals(childTagShortName)) &&
childTag.getURI().equals(tag.getURI()))
+ {
+ final RoyaleProject project = builder.getProject();
+ final IClassDefinition classOperation = getClassReference(project);
+ final IDefinition definitionRequest =
project.resolveSpecifier(classOperation, TAG_ARGUMENTS);
+ if (definitionRequest != null)
+ {
+ final MXMLWebServiceOperationArgumentsPropertyNode
argsPropertyNode = new MXMLWebServiceOperationArgumentsPropertyNode(this);
+ argsPropertyNode.setDefinition(definitionRequest);
+ argsPropertyNode.initializeFromTag(builder, childTag);
+ info.addChildNode(argsPropertyNode);
+ }
+ }
+ else
+ {
+ super.processChildTag(builder, tag, childTag, info);
+ }
+ }
}
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/tree/mxml/IMXMLRemoteObjectMethodArgumentsPropertyNode.java
b/compiler/src/main/java/org/apache/royale/compiler/tree/mxml/IMXMLRemoteObjectMethodArgumentsPropertyNode.java
new file mode 100644
index 000000000..735f36f14
--- /dev/null
+++
b/compiler/src/main/java/org/apache/royale/compiler/tree/mxml/IMXMLRemoteObjectMethodArgumentsPropertyNode.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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 org.apache.royale.compiler.tree.mxml;
+
+/**
+ * AST node for the {@code <arguments>} tag under the {@code <method>} tag,
which is under the {@code <RemoteObject>} tag.
+ */
+public interface IMXMLRemoteObjectMethodArgumentsPropertyNode extends
IMXMLPropertySpecifierNode
+{
+}
diff --git
a/compiler/src/main/java/org/apache/royale/compiler/tree/mxml/IMXMLWebServiceOperationArgumentsPropertyNode.java
b/compiler/src/main/java/org/apache/royale/compiler/tree/mxml/IMXMLWebServiceOperationArgumentsPropertyNode.java
new file mode 100644
index 000000000..7d68c573d
--- /dev/null
+++
b/compiler/src/main/java/org/apache/royale/compiler/tree/mxml/IMXMLWebServiceOperationArgumentsPropertyNode.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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 org.apache.royale.compiler.tree.mxml;
+
+/**
+ * AST node for the {@code <arguments>} tag under the {@code <operation>} tag,
which is under the {@code <WebService>} tag.
+ */
+public interface IMXMLWebServiceOperationArgumentsPropertyNode extends
IMXMLPropertySpecifierNode
+{
+}
diff --git a/compiler/src/test/java/mxml/tags/MXMLRemoteObjectTagTests.java
b/compiler/src/test/java/mxml/tags/MXMLRemoteObjectTagTests.java
index d3006b7e8..400b26d50 100644
--- a/compiler/src/test/java/mxml/tags/MXMLRemoteObjectTagTests.java
+++ b/compiler/src/test/java/mxml/tags/MXMLRemoteObjectTagTests.java
@@ -112,4 +112,40 @@ public class MXMLRemoteObjectTagTests extends
MXMLInstanceTagTestsBase
String mxml = getMXML(declarations, scriptDeclarations, asserts);
compileAndRun(mxml, true, true, false, null);
}
+
+ @Test
+ public void MXMLRemoteObjectTag_method_withArguments()
+ {
+ String[] declarations = new String[]
+ {
+ "<mx:RemoteObject id='ro1'>",
+ " <mx:method name='m1'>",
+ " <mx:arguments>",
+ " <a>abc</a>",
+ " <b>123</b>",
+ " <c>false</c>",
+ " </mx:arguments>",
+ " </mx:method>",
+ "</mx:RemoteObject>"
+ };
+ String[] scriptDeclarations = new String[]
+ {
+ "import mx.rpc.remoting.mxml.Operation;"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('ro1 is RemoteObject', ro1 is RemoteObject, true);",
+ "assertEqual('ro1.operations.m1', ro1.operations['m1'] is
Operation, true);",
+ "assertEqual('ro1.operations.m1.name', ro1.operations['m1'].name,
'm1');",
+ "assertEqual('ro1.operations.m1.argumentNames.length',
ro1.operations['m1'].argumentNames.length, 3);",
+ "assertEqual('ro1.operations.m1.argumentNames[0]',
ro1.operations['m1'].argumentNames[0], 'a');",
+ "assertEqual('ro1.operations.m1.argumentNames[1]',
ro1.operations['m1'].argumentNames[1], 'b');",
+ "assertEqual('ro1.operations.m1.argumentNames[1]',
ro1.operations['m1'].argumentNames[2], 'c');",
+ "assertEqual('ro1.operations.m1.arguments.a',
ro1.operations['m1'].arguments['a'], 'abc');",
+ "assertEqual('ro1.operations.m1.arguments.b',
ro1.operations['m1'].arguments['b'], 123);",
+ "assertEqual('ro1.operations.m1.arguments.c',
ro1.operations['m1'].arguments['c'], false);",
+ };
+ String mxml = getMXML(declarations, scriptDeclarations, asserts);
+ compileAndRun(mxml, true, true, false, null);
+ }
}
diff --git a/compiler/src/test/java/mxml/tags/MXMLWebServiceTagTests.java
b/compiler/src/test/java/mxml/tags/MXMLWebServiceTagTests.java
index da4ffacb3..69b680b31 100644
--- a/compiler/src/test/java/mxml/tags/MXMLWebServiceTagTests.java
+++ b/compiler/src/test/java/mxml/tags/MXMLWebServiceTagTests.java
@@ -134,4 +134,74 @@ public class MXMLWebServiceTagTests extends
MXMLInstanceTagTestsBase
String mxml = getMXML(declarations, scriptDeclarations, asserts);
compileAndRun(mxml, true, true, false, null);
}
+
+ @Test
+ public void MXMLWebServiceTag_operation_withArguments()
+ {
+ String[] declarations = new String[]
+ {
+ "<mx:WebService id='ws1' wsdl='https://example.com'>",
+ " <mx:operation name='op1'>",
+ " <mx:arguments>",
+ " <a>abc</a>",
+ " <b>123</b>",
+ " <c>false</c>",
+ " </mx:arguments>",
+ " </mx:operation>",
+ "</mx:WebService>"
+ };
+ String[] scriptDeclarations = new String[]
+ {
+ "import mx.rpc.soap.mxml.Operation;"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('ws1 is WebService', ws1 is WebService, true);",
+ "assertEqual('ws1.operations.op1', ws1.operations['op1'] is
Operation, true);",
+ "assertEqual('ws1.operations.op1.name',
ws1.operations['op1'].name, 'op1');",
+ "assertEqual('ws1.operations.op1.arguments.a',
ws1.operations['op1'].arguments['a'], 'abc');",
+ "assertEqual('ws1.operations.op1.arguments.b',
ws1.operations['op1'].arguments['b'], 123);",
+ "assertEqual('ws1.operations.op1.arguments.c',
ws1.operations['op1'].arguments['c'], false);",
+ "assertEqual('ws1.operations.op1.request.a',
ws1.operations['op1'].request['a'], 'abc');",
+ "assertEqual('ws1.operations.op1.request.b',
ws1.operations['op1'].request['b'], 123);",
+ "assertEqual('ws1.operations.op1.request.c',
ws1.operations['op1'].request['c'], false);",
+ };
+ String mxml = getMXML(declarations, scriptDeclarations, asserts);
+ compileAndRun(mxml, true, true, false, null);
+ }
+
+ @Test
+ public void MXMLWebServiceTag_operation_withRequest()
+ {
+ String[] declarations = new String[]
+ {
+ "<mx:WebService id='ws1' wsdl='https://example.com'>",
+ " <mx:operation name='op1'>",
+ " <mx:request>",
+ " <a>abc</a>",
+ " <b>123</b>",
+ " <c>false</c>",
+ " </mx:request>",
+ " </mx:operation>",
+ "</mx:WebService>"
+ };
+ String[] scriptDeclarations = new String[]
+ {
+ "import mx.rpc.soap.mxml.Operation;"
+ };
+ String[] asserts = new String[]
+ {
+ "assertEqual('ws1 is WebService', ws1 is WebService, true);",
+ "assertEqual('ws1.operations.op1', ws1.operations['op1'] is
Operation, true);",
+ "assertEqual('ws1.operations.op1.name',
ws1.operations['op1'].name, 'op1');",
+ "assertEqual('ws1.operations.op1.arguments.a',
ws1.operations['op1'].arguments['a'], 'abc');",
+ "assertEqual('ws1.operations.op1.arguments.b',
ws1.operations['op1'].arguments['b'], 123);",
+ "assertEqual('ws1.operations.op1.arguments.c',
ws1.operations['op1'].arguments['c'], false);",
+ "assertEqual('ws1.operations.op1.request.a',
ws1.operations['op1'].request['a'], 'abc');",
+ "assertEqual('ws1.operations.op1.request.b',
ws1.operations['op1'].request['b'], 123);",
+ "assertEqual('ws1.operations.op1.request.c',
ws1.operations['op1'].request['c'], false);",
+ };
+ String mxml = getMXML(declarations, scriptDeclarations, asserts);
+ compileAndRun(mxml, true, true, false, null);
+ }
}