@@ -0,0 +1,2743 @@
+/*%0A * This file is released under terms of BSD license%0A * See LICENSE file for more information%0A */%0Apackage claw.tatsu.xcodeml.abstraction;%0A%0Aimport claw.tatsu.xcodeml.xnode.common.Xattr;%0Aimport claw.tatsu.xcodeml.xnode.common.Xcode;%0Aimport claw.tatsu.xcodeml.xnode.common.Xnode;%0Aimport claw.tatsu.xcodeml.xnode.fortran.Xintrinsic;%0A%0Aimport java.util.Collections;%0Aimport java.util.List;%0A%0A/**%0A * @author clementval%0A */%0Apublic class FunctionCall extends Xnode %7B%0A%0A  private final String _name;%0A  private final Xnode _arguments;%0A  private final boolean _isTbp;%0A%0A  /**%0A   * Basic ctor from Xnode.%0A   *%0A   * @param node Raw node.%0A   */%0A  public FunctionCall(Xnode node) %7B%0A    super(node == null ? null : node.element());%0A%0A    _name = getFctNameFromFctCall();%0A    _isTbp = Xnode.isOfCode(firstChild(), Xcode.F_MEMBER_REF);%0A    _arguments = matchDirectDescendant(Xcode.ARGUMENTS);%0A  %7D%0A%0A  /**%0A   * Get called function name.%0A   *%0A   * @return Function call called.%0A   */%0A  public String getFctName() %7B%0A    return _name;%0A  %7D%0A%0A  /**%0A   * Get list of arguments of the function call.%0A   *%0A   * @return List of arguments nodes.%0A   */%0A  public List%3CXnode%3E arguments() %7B%0A    return _arguments != null ? _arguments.children() : Collections.emptyList();%0A  %7D%0A%0A  /**%0A   * Check whether the call is a call to a type-bound procedure.%0A   *%0A   * @return True if the call is a type-bound procedure call.%0A   */%0A  public boolean isTbpCall() %7B%0A    return _isTbp;%0A  %7D%0A%0A  public void addArguments(Xnode newArg) %7B%0A    _arguments.append(newArg);%0A  %7D%0A%0A  /**%0A   * Extract the name of the function in a function call.%0A   *%0A   * @return Function name if can be extracted. Null otherwise.%0A   */%0A  private String getFctNameFromFctCall() %7B%0A    if(Xnode.isOfCode(firstChild(), Xcode.F_MEMBER_REF)) %7B%0A      return firstChild().getAttribute(Xattr.MEMBER);%0A    %7D else %7B%0A      return matchSeq(Xcode.NAME).value();%0A    %7D%0A  %7D%0A%0A  /**%0A   * Check if the function call is an intrinsic call of the given type.%0A   *%0A   * @param intrinsic Intrinsic to be checked for.%0A   * @return True if the function call is an intrinsic call of the given%0A   * intrinsic. False otherwise.%0A   */%0A  public boolean isIntrinsicCall(Xintrinsic intrinsic) %7B%0A    if(!getBooleanAttribute(Xattr.IS_INTRINSIC)) %7B%0A      return false;%0A    %7D%0A    return getFctName().equalsIgnoreCase(intrinsic.toString());%0A  %7D%0A%0A  /**%0A   * Find meaningful line number for error reporting.%0A   *%0A   * @return First line number found in ancestors.%0A   */%0A  public int getLineNo() %7B%0A    Xnode crtAncestor = ancestor();%0A    while(crtAncestor != null) %7B%0A      if(crtAncestor.hasAttribute(Xattr.LINENO)) %7B%0A        return crtAncestor.lineNo();%0A      %7D%0A      crtAncestor = crtAncestor.ancestor();%0A    %7D%0A    return lineNo(); // Default if not found%0A  %7D%0A%0A%7D%0A

Add FunctionCall abstraction