protected static void assertVariable(IBinding b, String qn, Class expType, String expTypeQN) { assertInstance(b, IVariable.class); IVariable variable = (IVariable) b; assertQNEquals(qn, variable); assertInstance(variable.getType(), expType); if (expTypeQN != null) { IType type = variable.getType(); assertInstance(type, IBinding.class); assertQNEquals(expTypeQN, (IBinding) type); } }
@Override public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException { if (newBinding instanceof IVariable) { final Database db = getDB(); IVariable var = (IVariable) newBinding; IType newType = var.getType(); setType(linkage, newType); setValue(db, var); db.putByte(record + ANNOTATIONS, encodeFlags(var)); } }
public PDOMCPPVariable( PDOMLinkage linkage, PDOMNode parent, IVariable variable, boolean setTypeAndValue) throws CoreException { super(linkage, parent, variable.getNameCharArray()); // Find the type record Database db = getDB(); db.putByte(record + ANNOTATIONS, encodeFlags(variable)); if (setTypeAndValue) { setType(parent.getLinkage(), variable.getType()); setValue(db, variable); } }
protected IType getPtrType(IBinding binding) throws DOMException { // assert binding is a variable IVariable v = (IVariable) binding; IPointerType ptr = (IPointerType) v.getType(); return ptr.getType(); }
private void setValue(Database db, IVariable variable) throws CoreException { IValue val = variable.getInitialValue(); getLinkage().storeValue(record + VALUE_OFFSET, val); }