From 7c70f5461d79d3ed578f55d0bbf2c11f014bc801 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sat, 1 Jun 2024 16:15:42 +0200 Subject: [PATCH 1/3] Added rule to simplify token matching --- rules/token-matching.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rules/token-matching.xml b/rules/token-matching.xml index 8b7823c05da..c1725e33e1e 100644 --- a/rules/token-matching.xml +++ b/rules/token-matching.xml @@ -40,4 +40,12 @@ Simplify 'Token :: Match ( expr , %var% ) && expr->variable()' to 'expr->variable()' + + + + TokenNext + error + Simplify 'tok->next()->next()' to 'tok->tokAt(2).' + + From cab08c5a77ab2a8ec38b1f3e7e2047aa7d1f3df1 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sat, 1 Jun 2024 17:59:51 +0200 Subject: [PATCH 2/3] Added another rule 'tok->next()->link() --> tok->linkAt(1)' --- rules/token-matching.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rules/token-matching.xml b/rules/token-matching.xml index c1725e33e1e..05ae0b3acce 100644 --- a/rules/token-matching.xml +++ b/rules/token-matching.xml @@ -48,4 +48,12 @@ Simplify 'tok->next()->next()' to 'tok->tokAt(2).' + + + + TokenNext + error + Simplify 'tok->next()->link()' to 'tok->linkAt(1).' + + From d417c54d77124b1b6be491529de995d75b26a0c2 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sat, 1 Jun 2024 18:00:23 +0200 Subject: [PATCH 3/3] Updated error id --- rules/token-matching.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/token-matching.xml b/rules/token-matching.xml index 05ae0b3acce..b376b3fad1c 100644 --- a/rules/token-matching.xml +++ b/rules/token-matching.xml @@ -51,7 +51,7 @@ - TokenNext + TokenLink error Simplify 'tok->next()->link()' to 'tok->linkAt(1).'