Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.core.isdl.ast
Class DeclStmt

    java.lang.Object
      avrora.core.isdl.ast.Stmt
          avrora.core.isdl.ast.DeclStmt

public class DeclStmt
extends Stmt

The `DeclStmt` represents a declaration of a local, temporary value in the IR. A named temporary is given a type and an initial value at declaration time, allowing typechecking and ensuring that every variable is initialized before it is used.

Field Summary
`Expr` | `init` The `init` field stores a reference to the expression which is evaluated to give an initial value to the local.
`Token` | `name` The `name` field stores a reference to the name of the local.
`Token` | `type` The `type` field stores a reference to a token representing the type of the local.

Constructor Summary
`DeclStmt(java.lang.String n, java.lang.String t, Expr i)` The constructor of the `DeclStmt` class initializes the references to the name, type, and initial value of the declared local.
`DeclStmt(java.lang.String n, Token t, Expr i)` The constructor of the `DeclStmt` class initializes the references to the name, type, and initial value of the declared local.
`DeclStmt(Token n, Token t, Expr i)` The constructor of the `DeclStmt` class initializes the references to the name, type, and initial value of the declared local.

Method Summary
`Stmt` | `accept(StmtRebuilder r, java.lang.Object env)` The `accept()` method implements one half of the visitor pattern for visiting the abstract syntax trees representing the code of a particular instruction or subroutine.
`void` | `accept(StmtVisitor v)` The `accept()` method implements one half of the visitor pattern for visiting the abstract syntax trees representing the code of a particular instruction or subroutine.
`java.lang.String` | `toString()` The `toString()` method recursively converts this statement to a string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### name

    public final Token name

  The `name` field stores a reference to the name of the local.

### type

    public final Token type

  The `type` field stores a reference to a token representing the type of the local.

### init

    public final Expr init

  The `init` field stores a reference to the expression which is evaluated to give an initial value to the local.

Constructor Detail

### DeclStmt

    public DeclStmt(Token n,
                    Token t,
                    Expr i)

  The constructor of the `DeclStmt` class initializes the references to the name, type, and initial value of the declared local.

Parameters:
  `n` - the name of the local as a token
  `t` - the type of the local as a token
  `i` - a reference to the expression evaluated to give the local an initial value

### DeclStmt

    public DeclStmt(java.lang.String n,
                    Token t,
                    Expr i)

  The constructor of the `DeclStmt` class initializes the references to the name, type, and initial value of the declared local.

Parameters:
  `n` - the name of the local as a string
  `t` - the type of the local as a token
  `i` - a reference to the expression evaluated to give the local an initial value

### DeclStmt

    public DeclStmt(java.lang.String n,
                    java.lang.String t,
                    Expr i)

  The constructor of the `DeclStmt` class initializes the references to the name, type, and initial value of the declared local.

Parameters:
  `n` - the name of the local as a string
  `t` - the type of the local as a token
  `i` - a reference to the expression evaluated to give the local an initial value

Method Detail

### accept

    public void accept(StmtVisitor v)

  The `accept()` method implements one half of the visitor pattern for visiting the abstract syntax trees representing the code of a particular instruction or subroutine.

  Specified by:
    `accept` in class `Stmt`
  Parameters:
    `v` - the visitor to accept

### toString

    public java.lang.String toString()

  The `toString()` method recursively converts this statement to a string.

  Returns:
    a string representation of this statement

### accept

    public Stmt accept(StmtRebuilder r,
                       java.lang.Object env)

  The `accept()` method implements one half of the visitor pattern for visiting the abstract syntax trees representing the code of a particular instruction or subroutine. The `StmtRebuilder` interface allows visitors to rearrange and rebuild the statements.

  Specified by:
    `accept` in class `Stmt`
  Parameters:
    `r` - the visitor to accept
  Returns:
    the result of calling the appropriate `visit()` of the rebuilder passed

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD