Genericizing.
This commit is contained in:
parent
328f5cd3bb
commit
acb86f78c3
@ -5,16 +5,16 @@ use "compatibility/compatibility.nom"
|
|||||||
upgrade %tree to "2" as:
|
upgrade %tree to "2" as:
|
||||||
unless (%tree is "Action" syntax tree): return
|
unless (%tree is "Action" syntax tree): return
|
||||||
if (all[%tree.stub is "if % % else %", not (%tree.3 is "Var" syntax tree), not (%tree.5 is "Var" syntax tree)]):
|
if (all[%tree.stub is "if % % else %", not (%tree.3 is "Var" syntax tree), not (%tree.5 is "Var" syntax tree)]):
|
||||||
%true_body = (%tree.3 upgraded from "1.2")
|
%true_body = (%tree.3 upgraded)
|
||||||
unless (%true_body is "Block" syntax tree):
|
unless (%true_body is "Block" syntax tree):
|
||||||
%true_body = (=lua "Block(\%true_body.source, \%true_body)")
|
%true_body = (=lua "Block(\%true_body.source, \%true_body)")
|
||||||
%false_body = (%tree.5 upgraded from "1.2")
|
%false_body = (%tree.5 upgraded)
|
||||||
unless (%false_body is "Block" syntax tree):
|
unless (%false_body is "Block" syntax tree):
|
||||||
%false_body = (=lua "Block(\%false_body.source, \%false_body)")
|
%false_body = (=lua "Block(\%false_body.source, \%false_body)")
|
||||||
return (..)
|
return (..)
|
||||||
\(if %cond %true_body else %false_body)
|
\(if %cond %true_body else %false_body)
|
||||||
..with vars {..}
|
..with vars {..}
|
||||||
cond:%tree.2 upgraded from "1.2", true_body:%true_body, false_body:%false_body
|
cond:%tree.2 upgraded, true_body:%true_body, false_body:%false_body
|
||||||
|
|
||||||
%need_blocks = [..]
|
%need_blocks = [..]
|
||||||
"if % %", "unless % %", "for % in % %", "for % = % in % %", "repeat while % %"
|
"if % %", "unless % %", "for % in % %", "for % = % in % %", "repeat while % %"
|
||||||
@ -23,7 +23,7 @@ upgrade %tree to "2" as:
|
|||||||
"for % in recursive % %", "test %", "with % %", "result of %"
|
"for % in recursive % %", "test %", "with % %", "result of %"
|
||||||
for %n in %need_blocks:
|
for %n in %need_blocks:
|
||||||
if ((%tree.stub is %n) and (not ((last in %tree) is "Var" syntax tree))):
|
if ((%tree.stub is %n) and (not ((last in %tree) is "Var" syntax tree))):
|
||||||
%bits = (((% upgraded from "1.2") if (% is syntax tree) else %) for % in %tree)
|
%bits = (((% upgraded) if (% is syntax tree) else %) for % in %tree)
|
||||||
unless ((last in %bits) is "Block" syntax tree):
|
unless ((last in %bits) is "Block" syntax tree):
|
||||||
%body = (last in %bits)
|
%body = (last in %bits)
|
||||||
%bits.(length of %bits) = (=lua "Block(\%body.source, \%body)")
|
%bits.(length of %bits) = (=lua "Block(\%body.source, \%body)")
|
||||||
|
Loading…
Reference in New Issue
Block a user