trying to eliminate stupid blocks
This commit is contained in:
parent
8d54e85f14
commit
deb6c235ce
|
@ -47,6 +47,18 @@
|
||||||
(log-debug (format "merging label ~a and ~a" last-stmt next-stmt))
|
(log-debug (format "merging label ~a and ~a" last-stmt next-stmt))
|
||||||
(ufind:union-set a-forest last-stmt next-stmt)
|
(ufind:union-set a-forest last-stmt next-stmt)
|
||||||
(loop (rest stmts) next-stmt)]
|
(loop (rest stmts) next-stmt)]
|
||||||
|
|
||||||
|
;; If there's a label, immediately followed by a direct Goto jump,
|
||||||
|
;; just equate the label and the jump.
|
||||||
|
[(and (symbol? last-stmt) (GotoStatement? next-stmt))
|
||||||
|
(define goto-target (GotoStatement-target next-stmt))
|
||||||
|
(cond
|
||||||
|
[(Label? goto-target)
|
||||||
|
(ufind:union-set a-forest last-stmt (Label-name goto-target))
|
||||||
|
(loop (rest stmts) next-stmt)]
|
||||||
|
[else
|
||||||
|
(loop (rest stmts) next-stmt)])]
|
||||||
|
|
||||||
[else
|
[else
|
||||||
(loop (rest stmts) next-stmt)])]))
|
(loop (rest stmts) next-stmt)])]))
|
||||||
|
|
||||||
|
|
|
@ -256,10 +256,10 @@ MACHINE.modules[~s] =
|
||||||
;; package-standalone-xhtml: X output-port -> void
|
;; package-standalone-xhtml: X output-port -> void
|
||||||
(define (package-standalone-xhtml source-code op)
|
(define (package-standalone-xhtml source-code op)
|
||||||
(display *header* op)
|
(display *header* op)
|
||||||
(log-debug "writing the runtime")
|
(display (quote-cdata
|
||||||
(display (quote-cdata (get-runtime)) op)
|
(string-append (get-runtime)
|
||||||
(log-debug "writing the source code")
|
(get-code source-code)
|
||||||
(display (quote-cdata (get-code source-code)) op)
|
invoke-main-module-code)) op)
|
||||||
(display *footer* op))
|
(display *footer* op))
|
||||||
|
|
||||||
|
|
||||||
|
@ -330,10 +330,10 @@ MACHINE.modules[~s] =
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="initial-scale=1.0, width=device-width, height=device-height, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="initial-scale=1.0, width=device-width, height=device-height, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>Example</title>
|
<title></title>
|
||||||
</head>
|
</head>
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -367,10 +367,9 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define *footer*
|
|
||||||
#<<EOF
|
|
||||||
|
|
||||||
<![CDATA[
|
(define invoke-main-module-code
|
||||||
|
#<<EOF
|
||||||
var invokeMainModule = function() {
|
var invokeMainModule = function() {
|
||||||
var MACHINE = plt.runtime.currentMachine;
|
var MACHINE = plt.runtime.currentMachine;
|
||||||
invoke(MACHINE,
|
invoke(MACHINE,
|
||||||
|
@ -403,7 +402,11 @@ var invokeMainModule = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(invokeMainModule);
|
$(document).ready(invokeMainModule);
|
||||||
]]>
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
(define *footer*
|
||||||
|
#<<EOF
|
||||||
</script>
|
</script>
|
||||||
<body></body>
|
<body></body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
"use strict";
|
|
||||||
|
// The following contains the Whalesong runtime.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user