You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/09/10 00:42:01 UTC
[royale-compiler] 02/02: fix handling of altparams
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch release/0.9.6
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 7fc29ec584abf74c8e58a71047b2b8916963eb0b
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Sep 9 17:40:51 2019 -0700
fix handling of altparams
---
.../compiler/internal/projects/RoyaleProject.java | 55 +++++++++++++++-------
1 file changed, 39 insertions(+), 16 deletions(-)
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
index f4ad3d1..7609413 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
@@ -2349,27 +2349,50 @@ public class RoyaleProject extends ASProject implements IRoyaleProject, ICompile
{
if (meta.getTagName().equals(IMetaAttributeConstants.ATTRIBUTE_SWFOVERRIDE))
{
- IMetaTagAttribute attr = meta.getAttribute(IMetaAttributeConstants.NAME_SWFOVERRIDE_ALTPARAMS);
- if (attr != null)
+ IMetaTagAttribute altattr = meta.getAttribute(IMetaAttributeConstants.NAME_SWFOVERRIDE_ALTPARAMS);
+ if (altattr != null)
{
- // format is expectedQName:allowedQName,expectedQName:allowedQName.
- // we don't know which parameter it is so we're assuming for now that any mapping
- // applies to all occurences of that type in the parameter list
- String paramList = attr.getValue();
- String[] paramMap;
- if (paramList.contains(","))
- paramMap = paramList.split(",");
+ String altparamList = altattr.getValue();
+ String[] altparamMap;
+ if (altparamList.contains(","))
+ altparamMap = altparamList.split(",");
else
{
- paramMap = new String[1];
- paramMap[0] = paramList;
+ altparamMap = new String[1];
+ altparamMap[0] = altparamList;
}
- for (String item : paramMap)
+ IMetaTagAttribute attr = meta.getAttribute(IMetaAttributeConstants.NAME_SWFOVERRIDE_PARAMS);
+ if (attr != null)
{
- String[] parts = item.split(":");
- if (expectedDefinition.getQualifiedName().equals(parts[0]))
- if (((ITypeDefinition)actualDefinition).isInstanceOf(parts[1], this))
- return true;
+ String paramList = attr.getValue();
+ String[] paramMap;
+ if (paramList.contains(","))
+ paramMap = paramList.split(",");
+ else
+ {
+ paramMap = new String[1];
+ paramMap[0] = paramList;
+ }
+ int n = paramMap.length;
+ for (int i = 0; i < n; i++)
+ {
+ String item = paramMap[i];
+ if (expectedDefinition.getQualifiedName().equals(item))
+ {
+ String alts = altparamMap[i];
+ String[] altList;
+ if (alts.contains(":"))
+ altList = alts.split(":");
+ else
+ {
+ altList = new String[1];
+ altList[0] = alts;
+ }
+ for (String alt : altList)
+ if (((ITypeDefinition)actualDefinition).isInstanceOf(alt, this))
+ return true;
+ }
+ }
}
}
}