Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize compiled code for "set" tag #4333

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

fabpot
Copy link
Contributor

@fabpot fabpot commented Sep 24, 2024

No description provided.

src/Node/SetNode.php Outdated Show resolved Hide resolved
@fabpot fabpot force-pushed the set-node-optimization branch 2 times, most recently from be3a491 to f40624c Compare September 24, 2024 14:42
src/Node/SetNode.php Outdated Show resolved Hide resolved
@fabpot fabpot force-pushed the set-node-optimization branch from f40624c to 9855e35 Compare September 24, 2024 14:47
@@ -33,9 +33,15 @@ public function __construct(bool $capture, Node $names, Node $values, int $linen
$safe = false;
if ($capture) {
$safe = true;
if ($values instanceof TextNode) {
if (Node::class === get_class($values) && !count($values)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this makes me think we should really investigate having a dedicated node class for representing a statement list in 4.x (as suggested in #4292 (comment)), as we have this special case of Node::class === get_class($values) in more and more places

@fabpot fabpot merged commit efc527e into twigphp:3.x Sep 24, 2024
49 checks passed
@fabpot fabpot deleted the set-node-optimization branch September 24, 2024 15:04
fabpot added a commit that referenced this pull request Sep 27, 2024
…ode and Nodes (fabpot)

This PR was merged into the 3.x branch.

Discussion
----------

Deprecate instantiating Node directly, introduce EmptyNode and Nodes

Based on some comments from `@stof`:

See #4292 (comment)
See #4333 (comment)

First interesting usage here: 65ee72a

Commits
-------

8b27898 Deprecate using Node directly, introduce EmptyNode and Nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants