ast
Class DeclStmt

java.lang.Object
  extended by ast.ASTNode
      extended by ast.Stmt
          extended by ast.DeclStmt

public class DeclStmt
extends Stmt

The DeclStmt class represents a variable declaration statement appearing in a method declaration. It contains a variable type (type ), a name (name), and an (non-optional) initialization expression (init).

See Also:
ASTNode, Stmt

Field Summary
protected  Expr init
          The (non-optional) initialization expression for the variable being declared
protected  java.lang.String name
          The name of the variable being declared
protected  java.lang.String type
          The type of the variable being declared
 
Fields inherited from class ast.ASTNode
charNum, lineNum, lineStr
 
Constructor Summary
DeclStmt(int lineNum, java.lang.String type, java.lang.String name, Expr init)
          DeclStmt constructor
 
Method Summary
 java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
          Visitor method
 Expr getInit()
          Get the initialization expression for the declared variable
 java.lang.String getName()
          Get the name of the declared variable
 java.lang.String getType()
          Get the type of the declared variable
 
Methods inherited from class ast.ASTNode
getLineNum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected java.lang.String type
The type of the variable being declared


name

protected java.lang.String name
The name of the variable being declared


init

protected Expr init
The (non-optional) initialization expression for the variable being declared

Constructor Detail

DeclStmt

public DeclStmt(int lineNum,
                java.lang.String type,
                java.lang.String name,
                Expr init)
DeclStmt constructor

Parameters:
lineNum - source line number corresponding to this AST node
type - the symbol representing the type of the variable being declared
name - the symbol representing the name of the variable being declared
init - the (non-optional) initialization expression for the declared variable
Method Detail

getType

public java.lang.String getType()
Get the type of the declared variable

Returns:
declared variable type

getName

public java.lang.String getName()
Get the name of the declared variable

Returns:
declared variable name

getInit

public Expr getInit()
Get the initialization expression for the declared variable

Returns:
initialization expression

accept

public java.lang.Object accept(visitor.Visitor v,
                               java.lang.Object o)
Visitor method

Specified by:
accept in class Stmt
Parameters:
v - visitor object
o - object to pass down
Returns:
result of visiting this node
See Also:
Visitor