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

org.extendj.ast.VariableDeclarator 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 org.jastadd.util.PrettyPrintable;
import org.jastadd.util.PrettyPrinter;
import org.jastadd.util.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
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;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
/**
 * @ast node
 * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:173
 * @astdecl VariableDeclarator : Declarator;
 * @production VariableDeclarator : {@link Declarator};

 */
public class VariableDeclarator extends Declarator implements Cloneable {
  /**
   * @aspect CreateBCode
   * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:324
   */
  public void createBCode(CodeGeneration gen) {
    if (hasInit()) {
      gen.addLocalVariableEntryAtCurrentPC(name(), type(), localNum(), variableScopeEndLabel(gen));
      emitInitializerBCode(gen);
      type().emitStoreLocal(gen, localNum());
    }
  }
  /**
   * @aspect CreateBCode
   * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:584
   */
  public void emitLoadVariable(CodeGeneration gen, Access access) {
    if (hostType() == access.hostType()) {
      type().emitLoadLocal(gen, localNum());
    } else {
      access.emitLoadLocalInNestedClass(gen, this);
    }
  }
  /**
   * @declaredat ASTNode:1
   */
  public VariableDeclarator() {
    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[3];
    setChild(new List(), 0);
    setChild(new Opt(), 1);
  }
  /**
   * @declaredat ASTNode:15
   */
  @ASTNodeAnnotation.Constructor(
    name = {"ID", "Dims", "Init"},
    type = {"String", "List", "Opt"},
    kind = {"Token", "List", "Opt"}
  )
  public VariableDeclarator(String p0, List p1, Opt p2) {
    setID(p0);
    setChild(p1, 0);
    setChild(p2, 1);
  }
  /**
   * @declaredat ASTNode:25
   */
  public VariableDeclarator(beaver.Symbol p0, List p1, Opt p2) {
    setID(p0);
    setChild(p1, 0);
    setChild(p2, 1);
  }
  /** @apilevel low-level 
   * @declaredat ASTNode:31
   */
  protected int numChildren() {
    return 2;
  }
  /**
   * @apilevel internal
   * @declaredat ASTNode:37
   */
  public boolean mayHaveRewrite() {
    return false;
  }
  /** @apilevel internal 
   * @declaredat ASTNode:41
   */
  public void flushAttrCache() {
    super.flushAttrCache();
    constant_reset();
    localSize_reset();
    blockIndex_reset();
    localNum_reset();
  }
  /** @apilevel internal 
   * @declaredat ASTNode:49
   */
  public void flushCollectionCache() {
    super.flushCollectionCache();
  }
  /** @apilevel internal 
   * @declaredat ASTNode:53
   */
  public VariableDeclarator clone() throws CloneNotSupportedException {
    VariableDeclarator node = (VariableDeclarator) super.clone();
    return node;
  }
  /** @apilevel internal 
   * @declaredat ASTNode:58
   */
  public VariableDeclarator copy() {
    try {
      VariableDeclarator node = (VariableDeclarator) 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:77
   */
  @Deprecated
  public VariableDeclarator 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:87
   */
  public VariableDeclarator treeCopyNoTransform() {
    VariableDeclarator tree = (VariableDeclarator) copy();
    if (children != null) {
      for (int i = 0; i < children.length; ++i) {
        switch (i) {
        case 2:
          tree.children[i] = null;
          continue;
        }
        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:112
   */
  public VariableDeclarator treeCopy() {
    VariableDeclarator tree = (VariableDeclarator) copy();
    if (children != null) {
      for (int i = 0; i < children.length; ++i) {
        switch (i) {
        case 2:
          tree.children[i] = null;
          continue;
        }
        ASTNode child = (ASTNode) getChild(i);
        if (child != null) {
          child = child.treeCopy();
          tree.setChild(child, i);
        }
      }
    }
    return tree;
  }
  /** @apilevel internal 
   * @declaredat ASTNode:131
   */
  protected boolean is$Equal(ASTNode node) {
    return super.is$Equal(node) && (tokenString_ID == ((VariableDeclarator) 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 Dims list.
   * @param list The new list node to be used as the Dims list.
   * @apilevel high-level
   */
  public void setDimsList(List list) {
    setChild(list, 0);
  }
  /**
   * Retrieves the number of children in the Dims list.
   * @return Number of children in the Dims list.
   * @apilevel high-level
   */
  public int getNumDims() {
    return getDimsList().getNumChild();
  }
  /**
   * Retrieves the number of children in the Dims list.
   * Calling this method will not trigger rewrites.
   * @return Number of children in the Dims list.
   * @apilevel low-level
   */
  public int getNumDimsNoTransform() {
    return getDimsListNoTransform().getNumChildNoTransform();
  }
  /**
   * Retrieves the element at index {@code i} in the Dims list.
   * @param i Index of the element to return.
   * @return The element at position {@code i} in the Dims list.
   * @apilevel high-level
   */
  public Dims getDims(int i) {
    return (Dims) getDimsList().getChild(i);
  }
  /**
   * Check whether the Dims list has any children.
   * @return {@code true} if it has at least one child, {@code false} otherwise.
   * @apilevel high-level
   */
  public boolean hasDims() {
    return getDimsList().getNumChild() != 0;
  }
  /**
   * Append an element to the Dims list.
   * @param node The element to append to the Dims list.
   * @apilevel high-level
   */
  public void addDims(Dims node) {
    List list = (parent == null) ? getDimsListNoTransform() : getDimsList();
    list.addChild(node);
  }
  /** @apilevel low-level 
   */
  public void addDimsNoTransform(Dims node) {
    List list = getDimsListNoTransform();
    list.addChild(node);
  }
  /**
   * Replaces the Dims 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 setDims(Dims node, int i) {
    List list = getDimsList();
    list.setChild(node, i);
  }
  /**
   * Retrieves the Dims list.
   * @return The node representing the Dims list.
   * @apilevel high-level
   */
  @ASTNodeAnnotation.ListChild(name="Dims")
  public List getDimsList() {
    List list = (List) getChild(0);
    return list;
  }
  /**
   * Retrieves the Dims list.
   * 

This method does not invoke AST transformations.

* @return The node representing the Dims list. * @apilevel low-level */ public List getDimsListNoTransform() { return (List) getChildNoTransform(0); } /** * @return the element at index {@code i} in the Dims list without * triggering rewrites. */ public Dims getDimsNoTransform(int i) { return (Dims) getDimsListNoTransform().getChildNoTransform(i); } /** * Retrieves the Dims list. * @return The node representing the Dims list. * @apilevel high-level */ public List getDimss() { return getDimsList(); } /** * Retrieves the Dims list. *

This method does not invoke AST transformations.

* @return The node representing the Dims list. * @apilevel low-level */ public List getDimssNoTransform() { return getDimsListNoTransform(); } /** * Replaces the optional node for the Init child. This is the Opt * node containing the child Init, not the actual child! * @param opt The new node to be used as the optional node for the Init child. * @apilevel low-level */ public void setInitOpt(Opt opt) { setChild(opt, 1); } /** * Replaces the (optional) Init child. * @param node The new node to be used as the Init child. * @apilevel high-level */ public void setInit(Expr node) { getInitOpt().setChild(node, 0); } /** * Check whether the optional Init child exists. * @return {@code true} if the optional Init child exists, {@code false} if it does not. * @apilevel high-level */ public boolean hasInit() { return getInitOpt().getNumChild() != 0; } /** * Retrieves the (optional) Init child. * @return The Init child, if it exists. Returns {@code null} otherwise. * @apilevel low-level */ public Expr getInit() { return (Expr) getInitOpt().getChild(0); } /** * Retrieves the optional node for the Init child. This is the Opt node containing the child Init, not the actual child! * @return The optional node for child the Init child. * @apilevel low-level */ @ASTNodeAnnotation.OptChild(name="Init") public Opt getInitOpt() { return (Opt) getChild(1); } /** * Retrieves the optional node for child Init. This is the Opt node containing the child Init, not the actual child! *

This method does not invoke AST transformations.

* @return The optional node for child Init. * @apilevel low-level */ public Opt getInitOptNoTransform() { return (Opt) getChildNoTransform(1); } /** * Retrieves the TypeAccess child. *

This method does not invoke AST transformations.

* @return The current node used as the TypeAccess child. * @apilevel low-level */ public Access getTypeAccessNoTransform() { return (Access) getChildNoTransform(2); } /** * Retrieves the child position of the optional child TypeAccess. * @return The the child position of the optional child TypeAccess. * @apilevel low-level */ protected int getTypeAccessChildPosition() { return 2; } /** * Check for illegal duplicate variable declarations and parameter shadowing. * See JLS8 $6.4. * @attribute syn * @aspect NameCheck * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:463 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="NameCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/NameCheck.jrag:463") public Collection nameProblems() { { Collection problems = new LinkedList(); for (Variable var : lookupVariable(name())) { if (var instanceof VariableDeclarator) { VariableDeclarator decl = (VariableDeclarator) var; if (decl != this && decl.enclosingBodyDecl() == enclosingBodyDecl()) { problems.add(errorf("duplicate declaration of local variable %s", name())); } } else if (var instanceof ParameterDeclaration) { // 8.4.1 ParameterDeclaration decl = (ParameterDeclaration) var; if (decl.enclosingBodyDecl() == enclosingBodyDecl()) { problems.add(errorf("formal parameter is shadowed by local variable %s", name())); } } } return problems; } } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:35 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:35") public boolean isParameter() { boolean isParameter_value = false; return isParameter_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:38 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:38") public boolean isClassVariable() { boolean isClassVariable_value = false; return isClassVariable_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:39 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:39") public boolean isInstanceVariable() { boolean isInstanceVariable_value = false; return isInstanceVariable_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:40 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:40") public boolean isMethodParameter() { boolean isMethodParameter_value = false; return isMethodParameter_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:41 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:41") public boolean isConstructorParameter() { boolean isConstructorParameter_value = false; return isConstructorParameter_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:42 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:42") public boolean isExceptionHandlerParameter() { boolean isExceptionHandlerParameter_value = false; return isExceptionHandlerParameter_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:43 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:43") public boolean isLocalVariable() { boolean isLocalVariable_value = true; return isLocalVariable_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:44 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:44") public boolean isField() { boolean isField_value = false; return isField_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:46 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:46") public boolean isFinal() { boolean isFinal_value = getModifiers().isFinal(); return isFinal_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:47 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:47") public boolean isVolatile() { boolean isVolatile_value = getModifiers().isVolatile(); return isVolatile_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:48 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:48") public boolean isBlank() { boolean isBlank_value = !hasInit(); return isBlank_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:49 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:49") public boolean isStatic() { boolean isStatic_value = false; return isStatic_value; } /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:51 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:51") public String name() { String name_value = getID(); return name_value; } /** @apilevel internal */ private void constant_reset() { constant_computed = null; constant_value = null; } /** @apilevel internal */ protected ASTState.Cycle constant_computed = null; /** @apilevel internal */ protected Constant constant_value; /** * @attribute syn * @aspect Variables * @declaredat /home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:53 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="Variables", declaredAt="/home/jesper/git/extendj/java4/frontend/VariableDeclaration.jrag:53") public Constant constant() { ASTState state = state(); if (constant_computed == ASTState.NON_CYCLE || constant_computed == state().cycle()) { return constant_value; } constant_value = type().cast(getInit().constant()); if (state().inCircle()) { constant_computed = state().cycle(); } else { constant_computed = ASTState.NON_CYCLE; } return constant_value; } /** @return {@code true} if this declarator declares a local variable with the given name. * @attribute syn * @aspect VariableScope * @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:238 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="VariableScope", declaredAt="/home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:238") public boolean declaresVariable(String name) { boolean declaresVariable_String_value = getID().equals(name); return declaresVariable_String_value; } /** @apilevel internal */ private void localSize_reset() { localSize_computed = null; } /** @apilevel internal */ protected ASTState.Cycle localSize_computed = null; /** @apilevel internal */ protected int localSize_value; /** * @attribute syn * @aspect LocalNum * @declaredat /home/jesper/git/extendj/java4/backend/LocalNum.jrag:48 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.SYN) @ASTNodeAnnotation.Source(aspect="LocalNum", declaredAt="/home/jesper/git/extendj/java4/backend/LocalNum.jrag:48") public int localSize() { ASTState state = state(); if (localSize_computed == ASTState.NON_CYCLE || localSize_computed == state().cycle()) { return localSize_value; } localSize_value = type().variableSize(); if (state().inCircle()) { localSize_computed = state().cycle(); } else { localSize_computed = ASTState.NON_CYCLE; } return localSize_value; } /** * @attribute inh * @aspect NameCheck * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:441 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="NameCheck", declaredAt="/home/jesper/git/extendj/java4/frontend/NameCheck.jrag:441") public VariableScope outerScope() { VariableScope outerScope_value = getParent().Define_outerScope(this, null); return outerScope_value; } /** * @attribute inh * @aspect NestedTypes * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:574 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="NestedTypes", declaredAt="/home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:574") public BodyDecl enclosingBodyDecl() { BodyDecl enclosingBodyDecl_value = getParent().Define_enclosingBodyDecl(this, null); return enclosingBodyDecl_value; } /** * @attribute inh * @aspect DeclareBeforeUse * @declaredat /home/jesper/git/extendj/java4/frontend/DeclareBeforeUse.jrag:35 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="DeclareBeforeUse", declaredAt="/home/jesper/git/extendj/java4/frontend/DeclareBeforeUse.jrag:35") public int blockIndex() { ASTState state = state(); if (blockIndex_computed == ASTState.NON_CYCLE || blockIndex_computed == state().cycle()) { return blockIndex_value; } blockIndex_value = getParent().Define_blockIndex(this, null); if (state().inCircle()) { blockIndex_computed = state().cycle(); } else { blockIndex_computed = ASTState.NON_CYCLE; } return blockIndex_value; } /** @apilevel internal */ private void blockIndex_reset() { blockIndex_computed = null; } /** @apilevel internal */ protected ASTState.Cycle blockIndex_computed = null; /** @apilevel internal */ protected int blockIndex_value; /** * @attribute inh * @aspect LocalNum * @declaredat /home/jesper/git/extendj/java4/backend/LocalNum.jrag:50 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="LocalNum", declaredAt="/home/jesper/git/extendj/java4/backend/LocalNum.jrag:50") public int localNum() { ASTState state = state(); if (localNum_computed == ASTState.NON_CYCLE || localNum_computed == state().cycle()) { return localNum_value; } localNum_value = getParent().Define_localNum(this, null); if (state().inCircle()) { localNum_computed = state().cycle(); } else { localNum_computed = ASTState.NON_CYCLE; } return localNum_value; } /** @apilevel internal */ private void localNum_reset() { localNum_computed = null; } /** @apilevel internal */ protected ASTState.Cycle localNum_computed = null; /** @apilevel internal */ protected int localNum_value; /** * @attribute inh * @aspect CodeGeneration * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:71 */ @ASTNodeAnnotation.Attribute(kind=ASTNodeAnnotation.Kind.INH) @ASTNodeAnnotation.Source(aspect="CodeGeneration", declaredAt="/home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:71") public int variableScopeEndLabel(CodeGeneration gen) { int variableScopeEndLabel_CodeGeneration_value = getParent().Define_variableScopeEndLabel(this, null, gen); return variableScopeEndLabel_CodeGeneration_value; } /** * @declaredat /home/jesper/git/extendj/java5/frontend/EnhancedFor.jrag:138 * @apilevel internal */ public SimpleSet Define_lookupVariable(ASTNode _callerNode, ASTNode _childNode, String name) { if (_callerNode == getInitOptNoTransform()) { // @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:230 { if (declaresVariable(name)) { return this; } return lookupVariable(name); } } else { return getParent().Define_lookupVariable(this, _callerNode, name); } } /** * @declaredat /home/jesper/git/extendj/java5/frontend/EnhancedFor.jrag:138 * @apilevel internal * @return {@code true} if this node has an equation for the inherited attribute lookupVariable */ protected boolean canDefine_lookupVariable(ASTNode _callerNode, ASTNode _childNode, String name) { return true; } /** @apilevel internal */ public ASTNode rewriteTo() { return super.rewriteTo(); } /** @apilevel internal */ public boolean canRewrite() { return false; } /** @apilevel internal */ protected void collect_contributors_CompilationUnit_problems(CompilationUnit _root, java.util.Map> _map) { // @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:457 { java.util.Set contributors = _map.get(_root); if (contributors == null) { contributors = new java.util.LinkedHashSet(); _map.put((ASTNode) _root, contributors); } contributors.add(this); } // @declaredat /home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:40 if (hasInit() && !getInit().type().assignConversionTo(type(), getInit())) { { java.util.Set contributors = _map.get(_root); if (contributors == null) { contributors = new java.util.LinkedHashSet(); _map.put((ASTNode) _root, contributors); } contributors.add(this); } } super.collect_contributors_CompilationUnit_problems(_root, _map); } /** @apilevel internal */ protected void contributeTo_CompilationUnit_problems(LinkedList collection) { super.contributeTo_CompilationUnit_problems(collection); for (Problem value : nameProblems()) { collection.add(value); } if (hasInit() && !getInit().type().assignConversionTo(type(), getInit())) { collection.add(errorf("can not assign variable %s of type %s a value of type %s", name(), type().typeName(), getInit().type().typeName())); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy