Skip to content

Commit 31e31dd

Browse files
Empty sequences: changes by Tobias compacted (#675)
* Empty sequence changes by Tobias * that empty line... * just handy. * Made p. 505 long by 1 Co-authored-by: Tobias Wrigstad <tobias.wrigstad@it.uu.se>
1 parent 10f8d9b commit 31e31dd

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

xml/chapter4/section1/subsection2.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,7 @@ null
567567
and omit their declarations if they just access the obvious list elements.
568568
</TEXT>
569569
<TEXT>
570-
We provide a constructor for literals, which will come in handy in
571-
section<SPACE/><REF NAME="sec:query-syntax"/>.
570+
We provide a constructor for literals, which will come in handy.
572571
<SNIPPET PAGE="369" POSTPADDING="no">
573572
<INDEX><DECLARATION>make_literal</DECLARATION></INDEX>
574573
<NAME>make_literal</NAME>

xml/chapter5/section4/subsection1.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ compound-apply
738738
statements is kept in <JAVASCRIPTINLINE>unev</JAVASCRIPTINLINE>.
739739
At <JAVASCRIPTINLINE>ev_sequence</JAVASCRIPTINLINE> we place the sequence of
740740
statements to be evaluated in <JAVASCRIPTINLINE>unev</JAVASCRIPTINLINE>. If the
741-
sequence is empty, we jump straight to
741+
sequence is empty, we set <JAVASCRIPTINLINE>val</JAVASCRIPTINLINE> to <JAVASCRIPTINLINE>undefined</JAVASCRIPTINLINE> and jump to
742742
<JAVASCRIPTINLINE>continue</JAVASCRIPTINLINE> via
743743
<JAVASCRIPTINLINE>ev_sequence_empty</JAVASCRIPTINLINE>. Otherwise we start the
744744
sequence-evaluation loop, first saving the value of <JAVASCRIPTINLINE>continue</JAVASCRIPTINLINE> on the stack, because
@@ -801,10 +801,12 @@ compound-apply
801801
go_to(label("eval_dispatch")),
802802

803803
"ev_sequence_empty",
804+
assign("val", constant(undefined)),
804805
go_to(reg("continue")),
805806
</JAVASCRIPT>
806807
</SNIPPET>
807808

809+
<LONG_PAGE lines="1"/>
808810
<TEXT>
809811
Unlike <JAVASCRIPTINLINE>eval_sequence</JAVASCRIPTINLINE> in the metacircular
810812
evaluator, <JAVASCRIPTINLINE>ev_sequence</JAVASCRIPTINLINE> does not need to check whether a return statement was

xml/chapter5/section5/subsection2.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,11 @@ function compile_conditional(component, target, linkage) {
756756
<JAVASCRIPT>
757757
function compile_sequence(seq, target, linkage) {
758758
return is_empty_sequence(seq)
759-
? empty_instruction_sequence()
759+
? compile_literal(make_literal(undefined), target, linkage)
760760
: is_last_statement(seq) ||
761761
is_return_statement(first_statement(seq))
762762
? compile(first_statement(seq), target, linkage)
763-
: preserving(list("env"),
763+
: preserving(list("env", "continue"),
764764
compile(first_statement(seq), target, "next"),
765765
compile_sequence(rest_statements(seq),
766766
target, linkage));

0 commit comments

Comments
 (0)