/** * Constructor * * @param aInConst constant that has the indirection specified * @param aInConstName name of the target constant referenced */ public MIndirection(MConst aInConst, String aInConstName) { super(MY_CAT, aInConst, NAME); target = aInConstName; if (!aInConst.getAction().hasExplicitIndirection()) { Severity.DEATH.report( aInConst.toString(), "definition of target const", "can't specify target indirection", "can't specify target const " + target + " for constant with action: " + aInConst.getAction()); } }
/** * accessor of the target constant * * @return constant that this indirection references */ public MConst findTargetConst() { MConst lConst = null; Item lItem = getParent().getParent(); if (lItem instanceof MType) { lConst = ((MType) lItem).findConst(getTargetName(), true); } else { lConst = ((MProp) lItem).findConst(getTargetName(), true); } if (null == lConst) { Severity.DEATH.report( this.toString(), "retrieval of target const", "no constant found", "can't find target const " + target + " in context of " + lItem); } return lConst; }