From afbd5dbc90cb3f648ebd5b78937af6e8b4aa25cb Mon Sep 17 00:00:00 2001 From: vladar Date: Mon, 7 Nov 2016 16:26:02 +0700 Subject: [PATCH] Removed last traces of field memoization --- src/Executor/ExecutionContext.php | 5 ---- src/Executor/Executor.php | 38 ++++++++----------------------- 2 files changed, 9 insertions(+), 34 deletions(-) diff --git a/src/Executor/ExecutionContext.php b/src/Executor/ExecutionContext.php index 7aa3a0d..10faeaf 100644 --- a/src/Executor/ExecutionContext.php +++ b/src/Executor/ExecutionContext.php @@ -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; diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index 3872fd8..f767b98 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -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 + ); } }