All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.extendj.ast.BoundMethodAccess Maven / Gradle / Ivy

There is a newer version: 8.1.2
Show newest version
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.0 */
package org.extendj.ast;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.ArrayList;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.zip.*;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.jastadd.util.*;
import java.io.File;
import java.io.IOException;
import java.util.Set;
import beaver.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
/**
 * @ast node
 * @declaredat /home/jesper/git/extendj/java4/grammar/BoundNames.ast:3
 * @astdecl BoundMethodAccess : MethodAccess;
 * @production BoundMethodAccess : {@link MethodAccess};

 */
public class BoundMethodAccess extends MethodAccess implements Cloneable {
  /**
   * A BoundMethodAccess is a MethodAccess where the name analysis is bypassed
   * by explicitly setting the desired binding. This is useful when name
   * binding is cached and recomputation is undesired.
   * 
   * 

Specifying the hostType changes the target qualifier type which is used * to invoke the bound method. * @aspect BoundNames * @declaredat /home/jesper/git/extendj/java4/frontend/BoundNames.jrag:68 */ public BoundMethodAccess(String name, List args, MethodDecl methodDecl, TypeDecl hostType) { this(name, args); this.methodDecl = methodDecl; this.boundHostType = hostType; } /** * @aspect BoundNames * @declaredat /home/jesper/git/extendj/java4/frontend/BoundNames.jrag:75 */ public BoundMethodAccess(String name, List args, MethodDecl methodDecl) { this(name, args, methodDecl, methodDecl.hostType()); } /** * @aspect BoundNames * @declaredat /home/jesper/git/extendj/java4/frontend/BoundNames.jrag:79 */ private MethodDecl methodDecl; /** * @aspect BoundNames * @declaredat /home/jesper/git/extendj/java4/frontend/BoundNames.jrag:81 */ private TypeDecl boundHostType; /** * @declaredat ASTNode:1 */ public BoundMethodAccess() { super(); } /** * Initializes the child array to the correct size. * Initializes List and Opt nta children. * @apilevel internal * @ast method * @declaredat ASTNode:10 */ public void init$Children() { children = new ASTNode[1]; setChild(new List(), 0); } /** * @declaredat ASTNode:14 */ @ASTNodeAnnotation.Constructor( name = {"ID", "Arg"}, type = {"String", "List"}, kind = {"Token", "List"} ) public BoundMethodAccess(String p0, List p1) { setID(p0); setChild(p1, 0); } /** * @declaredat ASTNode:23 */ public BoundMethodAccess(beaver.Symbol p0, List p1) { setID(p0); setChild(p1, 0); } /** @apilevel low-level * @declaredat ASTNode:28 */ protected int numChildren() { return 1; } /** * @apilevel internal * @declaredat ASTNode:34 */ public boolean mayHaveRewrite() { return false; } /** @apilevel internal * @declaredat ASTNode:38 */ public void flushAttrCache() { super.flushAttrCache(); decl_reset(); } /** @apilevel internal * @declaredat ASTNode:43 */ public void flushCollectionCache() { super.flushCollectionCache(); } /** @apilevel internal * @declaredat ASTNode:47 */ public BoundMethodAccess clone() throws CloneNotSupportedException { BoundMethodAccess node = (BoundMethodAccess) super.clone(); return node; } /** @apilevel internal * @declaredat ASTNode:52 */ public BoundMethodAccess copy() { try { BoundMethodAccess node = (BoundMethodAccess) clone(); node.parent = null; if (children != null) { node.children = (ASTNode[]) children.clone(); } return node; } catch (CloneNotSupportedException e) { throw new Error("Error: clone not supported for " + getClass().getName()); } } /** * Create a deep copy of the AST subtree at this node. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @deprecated Please use treeCopy or treeCopyNoTransform instead * @declaredat ASTNode:71 */ @Deprecated public BoundMethodAccess fullCopy() { return treeCopyNoTransform(); } /** * Create a deep copy of the AST subtree at this node. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @declaredat ASTNode:81 */ public BoundMethodAccess treeCopyNoTransform() { BoundMethodAccess tree = (BoundMethodAccess) copy(); if (children != null) { for (int i = 0; i < children.length; ++i) { ASTNode child = (ASTNode) children[i]; if (child != null) { child = child.treeCopyNoTransform(); tree.setChild(child, i); } } } return tree; } /** * Create a deep copy of the AST subtree at this node. * The subtree of this node is traversed to trigger rewrites before copy. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @declaredat ASTNode:101 */ public BoundMethodAccess treeCopy() { BoundMethodAccess tree = (BoundMethodAccess) copy(); if (children != null) { for (int i = 0; i < children.length; ++i) { ASTNode child = (ASTNode) getChild(i); if (child != null) { child = child.treeCopy(); tree.setChild(child, i); } } } return tree; } /** @apilevel internal * @declaredat ASTNode:115 */ protected boolean is$Equal(ASTNode node) { return super.is$Equal(node) && (tokenString_ID == ((BoundMethodAccess) node).tokenString_ID); } /** * Replaces the lexeme ID. * @param value The new value for the lexeme ID. * @apilevel high-level */ public void setID(String value) { tokenString_ID = value; } /** * JastAdd-internal setter for lexeme ID using the Beaver parser. * @param symbol Symbol containing the new value for the lexeme ID * @apilevel internal */ public void setID(beaver.Symbol symbol) { if (symbol.value != null && !(symbol.value instanceof String)) throw new UnsupportedOperationException("setID is only valid for String lexemes"); tokenString_ID = (String)symbol.value; IDstart = symbol.getStart(); IDend = symbol.getEnd(); } /** * Retrieves the value for the lexeme ID. * @return The value for the lexeme ID. * @apilevel high-level */ @ASTNodeAnnotation.Token(name="ID") public String getID() { return tokenString_ID != null ? tokenString_ID : ""; } /** * Replaces the Arg list. * @param list The new list node to be used as the Arg list. * @apilevel high-level */ public void setArgList(List list) { setChild(list, 0); } /** * Retrieves the number of children in the Arg list. * @return Number of children in the Arg list. * @apilevel high-level */ public int getNumArg() { return getArgList().getNumChild(); } /** * Retrieves the number of children in the Arg list. * Calling this method will not trigger rewrites. * @return Number of children in the Arg list. * @apilevel low-level */ public int getNumArgNoTransform() { return getArgListNoTransform().getNumChildNoTransform(); } /** * Retrieves the element at index {@code i} in the Arg list. * @param i Index of the element to return. * @return The element at position {@code i} in the Arg list. * @apilevel high-level */ public Expr getArg(int i) { return (Expr) getArgList().getChild(i); } /** * Check whether the Arg list has any children. * @return {@code true} if it has at least one child, {@code false} otherwise. * @apilevel high-level */ public boolean hasArg() { return getArgList().getNumChild() != 0; } /** * Append an element to the Arg list. * @param node The element to append to the Arg list. * @apilevel high-level */ public void addArg(Expr node) { List list = (parent == null) ? getArgListNoTransform() : getArgList(); list.addChild(node); } /** @apilevel low-level */ public void addArgNoTransform(Expr node) { List list = getArgListNoTransform(); list.addChild(node); } /** * Replaces the Arg list element at index {@code i} with the new node {@code node}. * @param node The new node to replace the old list element. * @param i The list index of the node to be replaced. * @apilevel high-level */ public void setArg(Expr node, int i) { List list = getArgList(); list.setChild(node, i); } /** * Retrieves the Arg list. * @return The node representing the Arg list. * @apilevel high-level */ @ASTNodeAnnotation.ListChild(name="Arg") public List getArgList() { List list = (List) getChild(0); return list; } /** * Retrieves the Arg list. *

This method does not invoke AST transformations.

* @return The node representing the Arg list. * @apilevel low-level */ public List getArgListNoTransform() { return (List) getChildNoTransform(0); } /** * @return the element at index {@code i} in the Arg list without * triggering rewrites. */ public Expr getArgNoTransform(int i) { return (Expr) getArgListNoTransform().getChildNoTransform(i); } /** * Retrieves the Arg list. * @return The node representing the Arg list. * @apilevel high-level */ public List getArgs() { return getArgList(); } /** * Retrieves the Arg list. *

This method does not invoke AST transformations.

* @return The node representing the Arg list. * @apilevel low-level */ public List getArgsNoTransform() { return getArgListNoTransform(); } /** @apilevel internal */ private void decl_reset() { decl_computed = null; decl_value = null; } /** @apilevel internal */ protected ASTState.Cycle decl_computed = null; /** @apilevel internal */ protected MethodDecl decl_value; /** * Find the single method declaration matching this invocation. * *

If no such declaration exists, the unknown method declaration is returned * instead. * @attribute syn * @aspect LookupMethod * @declaredat /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:260 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="LookupMethod", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupMethod.jrag:260") public MethodDecl decl() { ASTState state = state(); if (decl_computed == ASTState.NON_CYCLE || decl_computed == state().cycle()) { return decl_value; } decl_value = methodDecl; if (state().inCircle()) { decl_computed = state().cycle(); } else { decl_computed = ASTState.NON_CYCLE; } return decl_value; } /** * @attribute syn * @aspect InnerClasses * @declaredat /home/jesper/git/extendj/java4/backend/InnerClasses.jrag:85 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="InnerClasses", declaredAt="/home/jesper/git/extendj/java4/backend/InnerClasses.jrag:85") public TypeDecl methodQualifierType() { TypeDecl methodQualifierType_value = boundHostType; return methodQualifierType_value; } /** @apilevel internal */ public ASTNode rewriteTo() { return super.rewriteTo(); } /** @apilevel internal */ public boolean canRewrite() { return false; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy