
lt.compiler.syntactic.def.AnnotationDef Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of latte-compiler Show documentation
Show all versions of latte-compiler Show documentation
The latte-lang compiler project, which contains compiler and runtime required library.
The newest version!
package lt.compiler.syntactic.def;
import lt.compiler.CompileUtil;
import lt.compiler.LineCol;
import lt.compiler.syntactic.AST;
import lt.compiler.syntactic.Statement;
import lt.lang.function.Function2;
import java.util.List;
import java.util.Set;
/**
* annotation type def
*/
public class AnnotationDef implements Statement {
public final String name;
public final Set annos;
public final List stmts;
private final LineCol lineCol;
public AnnotationDef(String name, Set annos, List stmts, LineCol lineCol) {
this.name = name;
this.annos = annos;
this.stmts = stmts;
this.lineCol = lineCol;
}
@Override
public LineCol line_col() {
return lineCol;
}
@Override
public void foreachInnerStatements(Function2 f, T t) throws Exception {
CompileUtil.visitStmt(annos, f, t);
CompileUtil.visitStmt(stmts, f, t);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AnnotationDef that = (AnnotationDef) o;
if (!name.equals(that.name)) return false;
if (!annos.equals(that.annos)) return false;
//
return stmts.equals(that.stmts);
}
@Override
public int hashCode() {
int result = name.hashCode();
result = 31 * result + annos.hashCode();
result = 31 * result + stmts.hashCode();
return result;
}
@Override
public String toString() {
return "((" + annos + ") annotation " + name + "( " + stmts + " ))";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy