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 2020/04/02 09:50:41 UTC

[royale-compiler] 06/08: Fix for an issue with complex static initializers. Fixes access to vars and consts from other code.

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 53fd37240745bbb9f668cfd5ed81b12bd6547e60
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Apr 2 22:35:22 2020 +1300

    Fix for an issue with complex static initializers. Fixes access to vars and consts from other code.
---
 .../royale/compiler/internal/codegen/js/jx/FieldEmitter.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/FieldEmitter.java
index b6ac6a3..7e81916 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -232,6 +232,18 @@ public class FieldEmitter extends JSSubEmitter implements
 	                write(ASEmitterTokens.BLOCK_CLOSE);
 	                writeNewline(ASEmitterTokens.SEMICOLON);
                 }
+                //Fix for references to the target : the following empty declaration is required for @lends to work in Object.defineProperties below
+                //otherwise references elsewhere in code to the target can be renamed (and therefore do not work)
+                if (getEmitter().getDocEmitter() instanceof IJSGoogDocEmitter)
+                {
+                    ((IJSGoogDocEmitter) getEmitter().getDocEmitter()).emitFieldDoc(node, def, getProject());
+                }
+                write(className);
+                write(ASEmitterTokens.MEMBER_ACCESS);
+                writeFieldName(node, fjs);
+                write(ASEmitterTokens.SEMICOLON);
+                writeNewline();
+                writeNewline();
                 write(IASLanguageConstants.Object);
                 write(ASEmitterTokens.MEMBER_ACCESS);
                 write(JSEmitterTokens.DEFINE_PROPERTIES);