You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
841 B
37 lines
841 B
4 years ago
|
package chocopy.common.astnodes;
|
||
|
|
||
|
import chocopy.common.analysis.NodeAnalyzer;
|
||
|
import java_cup.runtime.ComplexSymbolFactory.Location;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* Single and multiple assignments.
|
||
|
*/
|
||
|
public class AssignStmt extends Stmt {
|
||
|
/**
|
||
|
* List of left-hand sides.
|
||
|
*/
|
||
|
public final List<Expr> targets;
|
||
|
/**
|
||
|
* Right-hand-side value to be assigned.
|
||
|
*/
|
||
|
public final Expr value;
|
||
|
|
||
|
/**
|
||
|
* AST for TARGETS[0] = TARGETS[1] = ... = VALUE spanning source locations
|
||
|
* [LEFT..RIGHT].
|
||
|
*/
|
||
|
public AssignStmt(Location left, Location right,
|
||
|
List<Expr> targets, Expr value) {
|
||
|
super(left, right);
|
||
|
this.targets = targets;
|
||
|
this.value = value;
|
||
|
}
|
||
|
|
||
|
public <T> T dispatch(NodeAnalyzer<T> analyzer) {
|
||
|
return analyzer.analyze(this);
|
||
|
}
|
||
|
|
||
|
}
|