If the 'interfaces' array is implemented as a class constant, the Closure Compiler (release mode) "optimises" it to a global variable, thereby making it unreachable with a class member access. When instead using a class member for storage, and using an instance for access, the code is no longer optimised into oblivion.
Signed-off-by: Erik de Bruin <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ad778607 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ad778607 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ad778607 Branch: refs/heads/develop Commit: ad7786071f4f501e8906541701c59d09285dec07 Parents: 63b5f7f Author: Erik de Bruin <[email protected]> Authored: Tue Nov 5 13:40:47 2013 +0100 Committer: Erik de Bruin <[email protected]> Committed: Tue Nov 5 13:40:47 2013 +0100 ---------------------------------------------------------------------- frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad778607/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js b/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js index a4784ca..e9f919f 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js @@ -78,8 +78,10 @@ org.apache.flex.utils.Language.is = function(leftOperand, rightOperand) { for (i = interfaces.length - 1; i > -1; i--) { if (interfaces[i] === rightOperand) { return true; - } else if (interfaces[i].AFJS_INTERFACES) { - return checkInterfaces(interfaces[i]); + } + + if (interfaces[i].prototype.AFJS_INTERFACES) { + return checkInterfaces(new interfaces[i]()); } } @@ -89,7 +91,7 @@ org.apache.flex.utils.Language.is = function(leftOperand, rightOperand) { if (leftOperand instanceof rightOperand) { return true; } else if (leftOperand.AFJS_INTERFACES) { - return checkInterfaces(leftOperand) + return checkInterfaces(leftOperand); } return false;
