Support inherited member variables in setVarId (#4101)