private function ParseAssignmentExpressions(Functional\IAST $AST) { $AST->SetPropertyMode(Functional\IAST::PropertiesAreGettersOrSetters); $Expressions = $AST->ParseNodes(); foreach ($Expressions as $Key => $Expression) { if (!$Expression instanceof AssignmentExpression) { unset($Expressions[$Key]); } } return $Expressions; }
private function ParseReturnExpression(Functional\IAST $AST) { if (!$AST->HasEntityMap() || $AST->GetEntityMap()->GetEntityType() !== $this->GetEntityType()) { throw new \Storm\Core\Object\TypeMismatchException('The supplied AST must be of entity type %s: %s given', $this->GetEntityType(), $AST->HasEntityMap() ? $AST->GetEntityMap()->GetEntityType() : 'null'); } if (!$AST->HasReturnNode()) { throw new FluentException('The supplied closure must contain a valid return statement'); } $ReturnNodes = $AST->GetReturnNodes(); if (count($ReturnNodes) > 1) { throw new FluentException('The supplied closure must contain a single return statement'); } $AST->SetPropertyMode(Functional\IAST::PropertiesAreGetters); return $AST->ParseNode($ReturnNodes[0]); }