Search in sources :

Example 16 with ExprStmt

use of kalang.ast.ExprStmt in project kalang by kasonyang.

the class AstUtil method isConstructorCallStatement.

public static boolean isConstructorCallStatement(Statement stmt) {
    try {
        ExprStmt exprStmt = (ExprStmt) stmt;
        InvocationExpr invExpr = (InvocationExpr) exprStmt.getExpr();
        ExecutableDescriptor method = invExpr.getMethod();
        return method.getName().equals("<init>") && !Modifier.isStatic(method.getModifier());
    } catch (ClassCastException ex) {
        return false;
    }
}
Also used : ExprStmt(kalang.ast.ExprStmt) InvocationExpr(kalang.ast.InvocationExpr) ExecutableDescriptor(kalang.core.ExecutableDescriptor)

Aggregations

ExprStmt (kalang.ast.ExprStmt)16 ExprNode (kalang.ast.ExprNode)13 AssignExpr (kalang.ast.AssignExpr)11 GenericType (kalang.core.GenericType)8 ObjectType (kalang.core.ObjectType)8 ArrayType (kalang.core.ArrayType)7 ClassType (kalang.core.ClassType)7 Type (kalang.core.Type)7 BlockStmt (kalang.ast.BlockStmt)6 LocalVarNode (kalang.ast.LocalVarNode)6 VarDeclStmt (kalang.ast.VarDeclStmt)6 VarExpr (kalang.ast.VarExpr)6 Statement (kalang.ast.Statement)5 PrimitiveType (kalang.core.PrimitiveType)5 WildcardType (kalang.core.WildcardType)5 LinkedList (java.util.LinkedList)4 ClassReference (kalang.ast.ClassReference)4 ConstExpr (kalang.ast.ConstExpr)4 MethodNode (kalang.ast.MethodNode)4 MultiStmtExpr (kalang.ast.MultiStmtExpr)4