What are the Google Closure compiler’s rules for deciding whether to be enuminline or not?
When I run my code through the Closure Compiler , the JSDoc annotation is enum not inline. However, when I create a simplified example, the types enumare inlined, as this nonsense example will demonstrate:
var my_name_space = (function () {
'use strict';
var TASK_STATUS = {
REJECT: -1,
UNKNOWN: 0,
APPROVE: 1
};
function init_(a) {
if (a === TASK_STATUS.UNKNOWN) {
alert("Reject");
a = TASK_STATUS.REJECT;
} else if (a === TASK_STATUS.APPROVE) {
alert("Unknown");
a = TASK_STATUS.UNKNOWN;
} else {
alert("Approve");
a = TASK_STATUS.APPROVE;
}
return a;
}
return { init: init_};
}());
my_name_space.init(-1);
Closing Out:
var my_name_space=function(){return{init:function(a){0===a?(alert("Reject"),a=-1):1===a?(alert("Unknown"),a=0):(alert("Approve"),a=1);return a}}}();my_name_space.init(-1);
In fact, the lining will occur with or without a JSDoc header.
Please explain under what conditions the lining will not occur, or even better, please make changes (a) to the above that would demonstrate when the lining does not occur.
I use the "Simple" level of optimization.