Harbs opened a new issue #201:
URL: https://github.com/apache/royale-compiler/issues/201


   Here is a very simple app which uses trace.
   
   ```
   <?xml version="1.0" encoding="utf-8"?>
   <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
                   xmlns:js="library://ns.apache.org/royale/basic"
                   applicationComplete="onComplete()">
       <fx:Script>
           <![CDATA[
               private function onComplete():void{
                   trace("foo");
               }
           ]]>
       </fx:Script>
       <js:valuesImpl>
           <js:SimpleCSSValuesImpl />
       </js:valuesImpl>
       <js:initialView>
           <js:View>
               <js:Label text="ID" id="id1" localId="id1" />
           </js:View>
       </js:initialView>
   </js:Application>
   ```
   `Language.trace` has a "debug comment" of `@royaledebug` This is suposed to 
cause `if(!goog.DEBUG)return;` to be inserted at the top of the function. That 
line allows the Google Complier to strip out the entire function and any 
references to it in the app using dead code removal.
   
   It's not actually being removed. Currently, `Language.trace` is output like 
this:
   
   ```
   /**
    * @royaledebug
    * @nocollapse
    * @param {...} rest
    */
   org.apache.royale.utils.Language.trace = function(rest) {
     rest = rest;if(!goog.DEBUG)return;
     rest = Array.prototype.slice.call(arguments, 0);
     var /** @type {*} */ theConsole;
     theConsole = goog.global.console;
     if (theConsole === undefined) {
       if (typeof(window) !== "undefined") {
         theConsole = window.console;
       } else if (typeof(console) !== "undefined") {
         theConsole = console;
       }
     }
     try {
       if (theConsole && theConsole.log) {
         theConsole.log.apply(theConsole, rest);
       }
     } catch (e) {
     }
   };
   ```
   Notice that `if(!goog.DEBUG)return;` is being inserted, but it's after `rest 
= rest;` I don't know if that's the reason it's not being stripped or there's 
some other reason.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to