You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2021/03/16 21:07:31 UTC
[royale-compiler] 12/12: playerglobalc: constants that should be
read/write variables
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
commit bf016f17cdd67b0cd8ce40fdfc3ffb27f7292e6d
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Mar 16 14:06:38 2021 -0700
playerglobalc: constants that should be read/write variables
---
.../org/apache/royale/compiler/clients/PLAYERGLOBALC.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java b/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
index d164b41..bfb13b9 100644
--- a/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
+++ b/compiler-playerglobalc/src/main/java/org/apache/royale/compiler/clients/PLAYERGLOBALC.java
@@ -76,6 +76,10 @@ class PLAYERGLOBALC implements FlexTool {
GLOBAL_CONSTANTS.put("NaN", "0 / 0");
GLOBAL_CONSTANTS.put("undefined", "void 0");
}
+ private static final Map<String, List<String>> WRITABLE_VARIABLES = new HashMap<String, List<String>>();
+ {
+ WRITABLE_VARIABLES.put("flash.external.ExternalInterface", Arrays.asList("marshallExceptions"));
+ }
private static final Map<String, List<String>> REST_METHODS = new HashMap<String, List<String>>();
{
REST_METHODS.put("Array", Arrays.asList("splice"));
@@ -685,7 +689,7 @@ class PLAYERGLOBALC implements FlexTool {
boolean isGetter = false;
boolean isSetter = false;
- boolean isConst = true;
+ boolean isConst = !isVariableThatShouldBeWritable(contextClassName, variableName);
boolean isStatic = false;
boolean isOverride = false;
String variableType = "*";
@@ -1173,6 +1177,13 @@ class PLAYERGLOBALC implements FlexTool {
return ANY_VARIABLES.get(contextClassName).contains(contextVariableName);
}
+ private boolean isVariableThatShouldBeWritable(String contextClassName, String contextVariableName) {
+ if (!WRITABLE_VARIABLES.containsKey(contextClassName)) {
+ return false;
+ }
+ return WRITABLE_VARIABLES.get(contextClassName).contains(contextVariableName);
+ }
+
private void parseParameters(List<Element> apiParamElements, String contextClassName, String contextFunctionName,
StringBuilder functionBuilder) throws Exception {
boolean forceOptionalConstructor = isConstructorThatNeedsParamsTypedAsAny(contextClassName,