You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2019/08/22 20:51:36 UTC
[royale-compiler] 02/03: Minor: remove extra comma in bindings
output.
This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit d5144c19d15eea6b1f765d1c353376dda69ab4de
Author: greg-dove <gr...@gmail.com>
AuthorDate: Fri Aug 23 06:59:03 2019 +1200
Minor: remove extra comma in bindings output.
---
.../codegen/mxml/royale/MXMLRoyaleEmitter.java | 25 +++++++++++++++-------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
index 3dc1a2c..e06efba 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
@@ -1335,8 +1335,8 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
private void outputBindingInfoAsData(String cname, BindingDatabase bindingDataBase)
{
IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker())
- .getASEmitter();
-
+ .getASEmitter();
+
writeNewline("/**");
writeNewline(" * @export"); // must export or else GCC will remove it
writeNewline(" */");
@@ -1345,9 +1345,11 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
Set<BindingInfo> bindingInfo = bindingDataBase.getBindingInfo();
writeNewline(bindingInfo.size() + ","); // number of bindings
-
+ boolean hadOutput = false;
for (BindingInfo bi : bindingInfo)
{
+ if (hadOutput) writeNewline(ASEmitterTokens.COMMA.getToken());
+ hadOutput = true;
String s;
IMXMLNode node = bi.node;
if (node instanceof IMXMLSingleDataBindingNode)
@@ -1438,7 +1440,7 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
if (s == null)
{
- writeNewline(ASEmitterTokens.NULL.getToken() + ASEmitterTokens.COMMA.getToken());
+ write(ASEmitterTokens.NULL.getToken());
}
else if (s.contains("."))
{
@@ -1451,17 +1453,22 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
String part = parts[i];
write(", " + ASEmitterTokens.DOUBLE_QUOTE.getToken() + part + ASEmitterTokens.DOUBLE_QUOTE.getToken());
}
- writeNewline(ASEmitterTokens.SQUARE_CLOSE.getToken() + ASEmitterTokens.COMMA.getToken());
+ write(ASEmitterTokens.SQUARE_CLOSE.getToken());
}
else
- writeNewline(ASEmitterTokens.DOUBLE_QUOTE.getToken() + s +
- ASEmitterTokens.DOUBLE_QUOTE.getToken() + ASEmitterTokens.COMMA.getToken());
+ write(ASEmitterTokens.DOUBLE_QUOTE.getToken() + s +
+ ASEmitterTokens.DOUBLE_QUOTE.getToken());
+
}
Set<Entry<Object, WatcherInfoBase>> watcherChains = bindingDataBase.getWatcherChains();
-
+
if (watcherChains != null)
{
int count = watcherChains.size();
+ if (hadOutput) {
+ if (count > 0) writeNewline(ASEmitterTokens.COMMA);
+ else writeNewline();
+ }
for (Entry<Object, WatcherInfoBase> entry : watcherChains)
{
count--;
@@ -1469,6 +1476,8 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements
encodeWatcher(watcherInfoBase);
if (count > 0) writeNewline(ASEmitterTokens.COMMA);
}
+ } else {
+ if (hadOutput) writeNewline();
}
writeNewline( ASEmitterTokens.SQUARE_CLOSE.getToken() + ASEmitterTokens.SEMICOLON.getToken());