This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 208b6ad4dff50dec7c31c25cf7aa4dd3f0e56ceb Author: Josh Tynjala <[email protected]> AuthorDate: Fri Jun 5 16:52:35 2026 -0700 IdentifierEmitter, MemberAccessEmitter: also check for INTERFACE_MEMBER classification when determining if a closure is required for a function --- .../compiler/internal/codegen/js/jx/IdentifierEmitter.java | 7 ++++--- .../compiler/internal/codegen/js/jx/MemberAccessEmitter.java | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/IdentifierEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/IdentifierEmitter.java index 0927b3453..3d7cf0a6d 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/IdentifierEmitter.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/IdentifierEmitter.java @@ -115,9 +115,10 @@ public class IdentifierEmitter extends JSSubEmitter implements else if (!NativeUtils.isNative(node.getName())) { // an instance method not in a function call or member access - boolean generateClosure = identifierIsPlainFunction && ((FunctionDefinition) nodeDef) - .getFunctionClassification() == FunctionClassification.CLASS_MEMBER && - (!(parentNodeId == ASTNodeID.FunctionCallID || parentNodeId == ASTNodeID.MemberAccessExpressionID)); + boolean generateClosure = identifierIsPlainFunction + && (((FunctionDefinition) nodeDef).getFunctionClassification() == FunctionClassification.CLASS_MEMBER + || ((FunctionDefinition) nodeDef).getFunctionClassification() == FunctionClassification.INTERFACE_MEMBER) + && (!(parentNodeId == ASTNodeID.FunctionCallID || parentNodeId == ASTNodeID.MemberAccessExpressionID)); if (generateClosure) { getEmitter().emitClosureStart(); diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java index 5191a587a..f3325865a 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/MemberAccessEmitter.java @@ -189,10 +189,12 @@ public class MemberAccessEmitter extends JSSubEmitter implements ASTNodeID parentNodeId = parentNode.getNodeID(); // we need a closure if this MAE is the top-level in a chain // of MAE and not in a function call. - needClosure = !isStatic && parentNodeId != ASTNodeID.FunctionCallID && - ((IFunctionDefinition) def).getFunctionClassification() == FunctionClassification.CLASS_MEMBER && - parentNodeId != ASTNodeID.MemberAccessExpressionID && - parentNodeId != ASTNodeID.ArrayIndexExpressionID; + needClosure = !isStatic + && parentNodeId != ASTNodeID.FunctionCallID + && (((FunctionDefinition) def).getFunctionClassification() == FunctionClassification.CLASS_MEMBER + || ((FunctionDefinition) def).getFunctionClassification() == FunctionClassification.INTERFACE_MEMBER) + && parentNodeId != ASTNodeID.MemberAccessExpressionID + && parentNodeId != ASTNodeID.ArrayIndexExpressionID; //If binding getterFunctions ever need closures, this seems to be where it would be done (so far not needed, @todo review and remove this when certain) /*if (!needClosure && !isStatic && parentNodeId == ASTNodeID.FunctionCallID) {
