001 // -*- mode: java -*-
002 /* Copyright 2000, 2001, Compaq Computer Corporation */
003
004 /* IF THIS IS A JAVA FILE, DO NOT EDIT IT!
005
006 Most Java files in this directory which are part of the Javafe AST
007 are automatically generated using the astgen comment (see
008 ESCTools/Javafe/astgen) from the input file 'hierarchy.h'. If you
009 wish to modify AST classes or introduce new ones, modify
010 'hierarchy.j.'
011 */
012
013 package escjava.ast;
014
015 import java.util.Hashtable;
016 import java.util.Set;
017 import java.util.ArrayList;
018
019 import javafe.ast.*;
020 import javafe.util.Assert;
021 import javafe.util.Location;
022 import escjava.ParsedRoutineSpecs;
023
024 // Convention: unless otherwise noted, integer fields named "loc" refer
025 // to the location of the first character of the syntactic unit
026
027 //# TagBase javafe.tc.TagConstants.LAST_TAG + 1
028 //# VisitorRoot javafe.ast.Visitor
029
030
031 public class SetCompExpr extends Expr
032 {
033 public /*@ non_null @*/ Type type;
034
035 public /*@ non_null @*/ FormalParaDecl fp;
036
037 public /*@ non_null @*/ Expr expr;
038
039
040 //@ public represents startLoc <- fp.getStartLoc();
041 public /*@ pure @*/ int getStartLoc() { return fp.getStartLoc(); }
042
043
044 // Generated boilerplate constructors:
045
046 //@ ensures this.type == type;
047 //@ ensures this.fp == fp;
048 //@ ensures this.expr == expr;
049 protected SetCompExpr(/*@ non_null @*/ Type type, /*@ non_null @*/ FormalParaDecl fp, /*@ non_null @*/ Expr expr) {
050 this.type = type;
051 this.fp = fp;
052 this.expr = expr;
053 }
054
055 // Generated boilerplate methods:
056
057 public final int childCount() {
058 return 3;
059 }
060
061 public final Object childAt(int index) {
062 /*throws IndexOutOfBoundsException*/
063 if (index < 0)
064 throw new IndexOutOfBoundsException("AST child index " + index);
065 int indexPre = index;
066
067 int sz;
068
069 if (index == 0) return this.type;
070 else index--;
071
072 if (index == 0) return this.fp;
073 else index--;
074
075 if (index == 0) return this.expr;
076 else index--;
077
078 throw new IndexOutOfBoundsException("AST child index " + indexPre);
079 } //@ nowarn Exception;
080
081 public final /*@non_null*/String toString() {
082 return "[SetCompExpr"
083 + " type = " + this.type
084 + " fp = " + this.fp
085 + " expr = " + this.expr
086 + "]";
087 }
088
089 public final int getTag() {
090 return TagConstants.SETCOMPEXPR;
091 }
092
093 public final void accept(javafe.ast.Visitor v) {
094 if (v instanceof Visitor) ((Visitor)v).visitSetCompExpr(this);
095 }
096
097 public final Object accept(javafe.ast.VisitorArgResult v, Object o) {
098 if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitSetCompExpr(this, o); else return null;
099 }
100
101 public void check() {
102 this.type.check();
103 this.fp.check();
104 this.expr.check();
105 }
106
107 //@ ensures \result != null;
108 public static SetCompExpr make(/*@ non_null @*/ Type type, /*@ non_null @*/ FormalParaDecl fp, /*@ non_null @*/ Expr expr) {
109 SetCompExpr result = new SetCompExpr(type, fp, expr);
110 return result;
111 }
112 }