aboutsummaryrefslogtreecommitdiff
path: root/lib/compatibility/2.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-03-22 14:25:18 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-03-22 14:25:18 -0700
commit7f30fb293f11744eaab6935e791c5aa993411722 (patch)
treebe8bf8845583b89c0502dd32c2a8d2d1b65924cc /lib/compatibility/2.nom
parentbe9a86d639d0f676f63a5c540d4a0d0d2b2d3c6e (diff)
Fixed a bunch of compatibility issues that made upgrading really slow,
especially when upgrading across many versions.
Diffstat (limited to 'lib/compatibility/2.nom')
-rw-r--r--lib/compatibility/2.nom10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/compatibility/2.nom b/lib/compatibility/2.nom
index 69f2d41..17ead58 100644
--- a/lib/compatibility/2.nom
+++ b/lib/compatibility/2.nom
@@ -9,13 +9,13 @@ use "compatibility/compatibility"
upgrade $tree to "2" as:
unless ($tree is "Action" syntax tree): return
if ($tree.stub == "if 1 2 else"):
- $true_body = ($tree.3 upgraded)
+ $true_body = $tree.3
unless ($true_body is "Block" syntax tree):
$true_body = ("Block" tree with $true_body)
- $false_body = ($tree.5 upgraded)
+ $false_body = $tree.5
unless ($false_body is "Block" syntax tree):
$false_body = (=lua "Block(\$false_body.source, \$false_body)")
- return \(if \($tree.2 upgraded) \$true_body else \$false_body)
+ return \(if \($tree.2) \$true_body else \$false_body)
$need_blocks = [
"if", "unless", "for 1 in", "for 1 = 2 in", "repeat while 1", "repeat 1 times"
@@ -26,8 +26,8 @@ upgrade $tree to "2" as:
for $n in $need_blocks:
if ($tree.stub == $n):
- $bits = [: for $ in $tree: add (($ upgraded) if ($ is syntax tree) else $)]
+ $bits = [: for $ in $tree: add ($ if ($ is syntax tree) else $)]
unless (($bits, last) is "Block" syntax tree):
$body = ($bits, last)
$bits.(#$bits) = (=lua "SyntaxTree{type='Block', source=\$body.source, \$body}")
- return (=lua "SyntaxTree{type='Action', source=\$tree.source, unpack(\$bits)}") \ No newline at end of file
+ return (=lua "SyntaxTree{type='Action', source=\$tree.source, unpack(\$bits)}")