// we've evaluated receiver, lets evaluate the method return type now
// (using PHPDoc first):
if (state == STATE_GOT_RECEIVER) {
state = STATE_WAITING_FIELD_PHPDOC;
TypeContext typeContext = new TypeContext(
(ISourceModuleContext) goal.getContext(), receiverType);
if (goal.getContext() instanceof IModelCacheContext) {
typeContext.setCache(((IModelCacheContext) goal.getContext())
.getCache());
}
return new IGoal[] { new PHPDocClassVariableGoal(typeContext,
variableName, offset) };
}
if (state == STATE_WAITING_FIELD_PHPDOC) {
if (goalState != GoalState.PRUNED && previousResult != null
&& previousResult != UnknownType.INSTANCE) {
result = previousResult;
return null;
}
state = STATE_WAITING_FIELD;
TypeContext typeContext = new TypeContext(
(ISourceModuleContext) goal.getContext(), receiverType);
if (goal.getContext() instanceof IModelCacheContext) {
typeContext.setCache(((IModelCacheContext) goal.getContext())
.getCache());
}
return new IGoal[] { new ClassVariableDeclarationGoal(typeContext,
variableName) };
}