* 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
This commit is contained in:
Minero Aoki 2009-04-26 04:50:57 +00:00
parent 1074c0177f
commit 78a2217cd9
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,7 @@
Sun Apr 26 13:50:54 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/ast/FuncallNode.java: detect static call.
Sun Apr 26 13:30:10 2009 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/Simplifier.java (While): must loop.

View File

@ -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();
}
/**