From 78a2217cd942969558a6e5dadf1823721e3e0a0e Mon Sep 17 00:00:00 2001 From: Minero Aoki Date: Sun, 26 Apr 2009 04:50:57 +0000 Subject: [PATCH] * net/loveruby/cflat/ast/FuncallNode.java: detect static call. git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4146 1b9489fe-b721-0410-924e-b54b9192deb8 --- ChangeLog | 4 ++++ net/loveruby/cflat/ast/FuncallNode.java | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bafcbe9..aa91356 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Apr 26 13:50:54 2009 Minero Aoki + + * net/loveruby/cflat/ast/FuncallNode.java: detect static call. + Sun Apr 26 13:30:10 2009 Minero Aoki * net/loveruby/cflat/compiler/Simplifier.java (While): must loop. diff --git a/net/loveruby/cflat/ast/FuncallNode.java b/net/loveruby/cflat/ast/FuncallNode.java index feb4e98..c9f4639 100644 --- a/net/loveruby/cflat/ast/FuncallNode.java +++ b/net/loveruby/cflat/ast/FuncallNode.java @@ -22,8 +22,11 @@ public class FuncallNode extends ExprNode { /** Returns true if this funcall is NOT a function pointer call. */ public boolean isStaticCall() { - return (expr instanceof VariableNode) && - (((VariableNode)expr).entity() instanceof Function); + if (! (expr instanceof AddressNode)) return false; + ExprNode var = ((AddressNode)expr).expr(); + if (! (var instanceof VariableNode)) return false; + Entity e = ((VariableNode)var).entity(); + return (e instanceof Function); } /** @@ -31,7 +34,9 @@ public class FuncallNode extends ExprNode { * This method expects this is static function call (isStaticCall()). */ public Function function() { - return (Function)((VariableNode)expr).entity(); + AddressNode a = (AddressNode)expr; + VariableNode var = (VariableNode)a.expr(); + return (Function)var.entity(); } /**