001 /* Copyright 2000, 2001, Compaq Computer Corporation */ 002 003 /* IF THIS IS A JAVA FILE, DO NOT EDIT IT! 004 005 Most Java files in this directory which are part of the Javafe AST 006 are automatically generated using the astgen comment (see 007 ESCTools/Javafe/astgen) from the input file 'hierarchy.h'. If you 008 wish to modify AST classes or introduce new ones, modify 009 'hierarchy.j.' 010 */ 011 012 package escjava.ast; 013 014 import java.util.Hashtable; 015 import java.util.Set; 016 import java.util.ArrayList; 017 018 import javafe.ast.*; 019 import javafe.util.Assert; 020 import javafe.util.Location; 021 import escjava.ParsedRoutineSpecs; 022 023 // Convention: unless otherwise noted, integer fields named "loc" refer 024 // to the location of the first character of the syntactic unit 025 026 //# TagBase javafe.tc.TagConstants.LAST_TAG + 1 027 //# VisitorRoot javafe.ast.Visitor 028 029 030 public class GhostDeclPragma extends TypeDeclElemPragma 031 { 032 public /*@ non_null @*/ FieldDecl decl; 033 034 public int loc; 035 036 037 public void setParent(TypeDecl p) { 038 super.setParent(p); 039 if (decl != null) 040 decl.setParent(p); 041 } 042 043 public int getStartLoc() { return loc; } 044 public int getEndLoc() { return decl.getEndLoc(); } 045 public void decorate(ModifierPragmaVec modifierPragmas) { 046 if (decl.pmodifiers == null) { 047 decl.pmodifiers = modifierPragmas; 048 } else if (modifierPragmas != null) { 049 // FIXME - should be prepen??? 050 decl.pmodifiers.append(modifierPragmas); 051 } 052 } 053 public ModifierPragmaVec getPModifiers() { return decl.pmodifiers; } 054 055 056 // Generated boilerplate constructors: 057 058 /** 059 * Construct a raw GhostDeclPragma whose class invariant(s) have not 060 * yet been established. It is the caller's job to 061 * initialize the returned node's fields so that any 062 * class invariants hold. 063 */ 064 //@ requires I_will_establish_invariants_afterwards; 065 protected GhostDeclPragma() {} //@ nowarn Invariant,NonNullInit; 066 067 068 // Generated boilerplate methods: 069 070 public final int childCount() { 071 return 1; 072 } 073 074 public final Object childAt(int index) { 075 /*throws IndexOutOfBoundsException*/ 076 if (index < 0) 077 throw new IndexOutOfBoundsException("AST child index " + index); 078 int indexPre = index; 079 080 int sz; 081 082 if (index == 0) return this.decl; 083 else index--; 084 085 throw new IndexOutOfBoundsException("AST child index " + indexPre); 086 } //@ nowarn Exception; 087 088 public final String toString() { 089 return "[GhostDeclPragma" 090 + " decl = " + this.decl 091 + " loc = " + this.loc 092 + "]"; 093 } 094 095 public final int getTag() { 096 return TagConstants.GHOSTDECLPRAGMA; 097 } 098 099 public final void accept(javafe.ast.Visitor v) { 100 if (v instanceof Visitor) ((Visitor)v).visitGhostDeclPragma(this); 101 } 102 103 public final Object accept(javafe.ast.VisitorArgResult v, Object o) { 104 if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitGhostDeclPragma(this, o); else return null; 105 } 106 107 public void check() { 108 this.decl.check(); 109 } 110 111 //@ ensures \result != null; 112 public static GhostDeclPragma make(/*@ non_null @*/ FieldDecl decl, int loc) { 113 //@ set I_will_establish_invariants_afterwards = true; 114 GhostDeclPragma result = new GhostDeclPragma(); 115 result.decl = decl; 116 result.loc = loc; 117 return result; 118 } 119 }