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]); }
public function __construct(Functional\IAST $AST, \Storm\Core\Object\ICriterion $Criterion = null) { $EntityType = $AST->GetEntityMap()->GetEntityType(); parent::__construct($EntityType, $this->ParseAssignmentExpressions($AST), $Criterion ?: new Criterion($EntityType)); }