You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2018/09/06 22:36:56 UTC
[royale-compiler] branch develop updated: @debug comment
This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new 83e3ada @debug comment
83e3ada is described below
commit 83e3ada595e3670407d6fa7ad384d7e7770d2914
Author: Harbs <ha...@in-tools.com>
AuthorDate: Fri Sep 7 01:36:47 2018 +0300
@debug comment
causes goog.DEBUG to be used to remove the method on minification
---
.../compiler/internal/codegen/js/goog/JSGoogEmitter.java | 16 ++++++++++++++++
.../codegen/js/royale/JSRoyaleEmitterTokens.java | 2 ++
2 files changed, 18 insertions(+)
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index aa8df40..8fee41b 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.apache.royale.compiler.asdoc.royale.ASDocComment;
import org.apache.royale.compiler.codegen.IASGlobalFunctionConstants.BuiltinType;
import org.apache.royale.compiler.codegen.js.goog.IJSGoogDocEmitter;
import org.apache.royale.compiler.codegen.js.goog.IJSGoogEmitter;
@@ -37,6 +38,7 @@ import org.apache.royale.compiler.definitions.IPackageDefinition;
import org.apache.royale.compiler.definitions.ITypeDefinition;
import org.apache.royale.compiler.definitions.IVariableDefinition;
import org.apache.royale.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.royale.compiler.internal.codegen.js.royale.JSRoyaleEmitterTokens;
import org.apache.royale.compiler.internal.codegen.js.JSEmitter;
import org.apache.royale.compiler.internal.codegen.js.JSEmitterTokens;
import org.apache.royale.compiler.internal.codegen.js.JSSessionModel;
@@ -661,6 +663,20 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
@Override
public void emitFunctionBlockHeader(IFunctionNode node)
{
+ ASDocComment asDoc = (ASDocComment) node
+ .getASDocComment();
+ if (asDoc != null)
+ {
+ String asDocString = asDoc.commentNoEnd();
+ String coercionToken = JSRoyaleEmitterTokens.DEBUG_COMMENT
+ .getToken();
+ int emitIndex = asDocString.indexOf(coercionToken);
+ if(emitIndex != -1)
+ {
+ write(JSRoyaleEmitterTokens.DEBUG_RETURN);
+ writeNewline();
+ }
+ }
IDefinition def = node.getDefinition();
boolean isStatic = false;
if (def != null && def.isStatic())
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/royale/JSRoyaleEmitterTokens.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/royale/JSRoyaleEmitterTokens.java
index f6235d3..dab13d0 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/royale/JSRoyaleEmitterTokens.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/royale/JSRoyaleEmitterTokens.java
@@ -46,6 +46,8 @@ public enum JSRoyaleEmitterTokens implements IEmitterTokens
IGNORE_IMPORT("@royaleignoreimport"),
IGNORE_STRING_COERCION("@royalenoimplicitstringconversion"),
SUPPRESS_PUBLIC_VAR_WARNING("@royalesuppresspublicvarwarning"),
+ DEBUG_COMMENT("@debug"),
+ DEBUG_RETURN("if(!goog.DEBUG)return;"),
PREINCREMENT("preincrement"),
PREDECREMENT("predecrement"),
POSTINCREMENT("postincrement"),