playerglobalc: constants that should be read/write variables
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 @@
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 @@
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 @@
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,