Removed last traces of field memoization

This commit is contained in:
vladar 2016-11-07 16:26:02 +07:00
parent ca01900e9d
commit afbd5dbc90
2 changed files with 9 additions and 34 deletions

View File

@ -48,11 +48,6 @@ class ExecutionContext
*/
public $errors;
/**
* @var array
*/
public $memoized = [];
public function __construct($schema, $fragments, $root, $contextValue, $operation, $variables, $errors)
{
$this->schema = $schema;

View File

@ -707,17 +707,6 @@ class Executor
return isset($tmp[$fieldName]) ? $tmp[$fieldName] : null;
}
/**
* Get an unique identifier for a FieldAST.
*
* @param object $fieldAST
* @return string
*/
private static function getFieldUid($fieldAST, ObjectType $fieldType)
{
return $fieldAST->loc->start . '-' . $fieldAST->loc->end . '-' . $fieldType->name;
}
/**
* Complete a value of an abstract type by determining the runtime object type
* of that value, then complete the value for that type.
@ -846,24 +835,15 @@ class Executor
$subFieldASTs = new \ArrayObject();
$visitedFragmentNames = new \ArrayObject();
$fieldsCount = count($fieldASTs);
for ($i = 0; $i < $fieldsCount; $i++) {
// Get memoized value if it exists
$uid = self::getFieldUid($fieldASTs[$i], $returnType);
if (isset($exeContext->memoized['collectSubFields'][$uid])) {
$subFieldASTs = $exeContext->memoized['collectSubFields'][$uid];
} else {
$selectionSet = $fieldASTs[$i]->selectionSet;
if ($selectionSet) {
$subFieldASTs = self::collectFields(
$exeContext,
$returnType,
$selectionSet,
$subFieldASTs,
$visitedFragmentNames
);
$exeContext->memoized['collectSubFields'][$uid] = $subFieldASTs;
}
foreach ($fieldASTs as $fieldAST) {
if (isset($fieldAST->selectionSet)) {
$subFieldASTs = self::collectFields(
$exeContext,
$returnType,
$fieldAST->selectionSet,
$subFieldASTs,
$visitedFragmentNames
);
}
}