[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 06/99: Get rid of comments and dead branches
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 06/99: Get rid of comments and dead branches |
Date: |
Sun, 10 Oct 2021 21:50:41 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit d1a663baec8a631b3d1e72fd53c4056c1b73cea7
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Sat Jun 6 20:15:25 2015 +0100
Get rid of comments and dead branches
---
module/language/cps/compile-js.scm | 17 ++++-------------
module/language/javascript.scm | 6 ------
module/language/js-il.scm | 10 ++--------
module/language/js-il/spec.scm | 3 +--
4 files changed, 7 insertions(+), 29 deletions(-)
diff --git a/module/language/cps/compile-js.scm
b/module/language/cps/compile-js.scm
index 1d50c89..3b5e35e 100644
--- a/module/language/cps/compile-js.scm
+++ b/module/language/cps/compile-js.scm
@@ -16,7 +16,6 @@
;; first-order optimization should go here
(set! exp (reify-primitives exp))
(set! exp (renumber exp))
- ;; (values exp env env)
(match exp
(($ $program funs)
;; TODO: I should special case the compilation for the initial fun,
@@ -27,16 +26,12 @@
(values (make-program (compile-fun (car funs))
(map compile-fun (cdr funs)))
env
- env)))
- )
+ env))))
(define (compile-fun fun)
- ;; meta
(match fun
(($ $cont k ($ $kfun src meta self ($ $cont tail ($ $ktail)) clause))
- (make-var k (compile-clause clause self tail)))
- (_
- `(fun:todo: ,fun))))
+ (make-var k (compile-clause clause self tail)))))
(define (compile-clause clause self tail)
(match clause
@@ -58,9 +53,7 @@
(compile-term exp))
(($ $cont k _)
(make-local (list (compile-cont body))
- (make-continue k (map make-id req)))))))
- (_
- `(clause:todo: ,clause))))
+ (make-continue k (map make-id req)))))))))
(define (not-supported msg clause)
(error 'not-supported msg clause))
@@ -115,9 +108,7 @@
;; FIXME:
;; may happen if a test branch of a conditional compiles to values
;; placeholder till I learn if multiple values could be returned.
- (make-id val))
- (_
- `(exp:todo: ,exp))))
+ (make-id val))))
(define (compile-test exp kt kf)
;; TODO: find out if the expression is always simple enough that I
diff --git a/module/language/javascript.scm b/module/language/javascript.scm
index 0a0b20e..18ce0f0 100644
--- a/module/language/javascript.scm
+++ b/module/language/javascript.scm
@@ -182,9 +182,3 @@
(display separator port)
(printer x port))
rest))))
-
-(define (print-terminated args printer terminator port)
- (for-each (lambda (x)
- (printer x port)
- (display terminator port))
- args))
diff --git a/module/language/js-il.scm b/module/language/js-il.scm
index 02a99d5..921bac6 100644
--- a/module/language/js-il.scm
+++ b/module/language/js-il.scm
@@ -7,13 +7,12 @@
make-continuation continuation
make-local local
make-var var
- make-continue continue ; differ from conts
+ make-continue continue
make-const const
make-primcall primcall
make-call call
make-closure closure
make-branch branch
- ; print-js
make-return return
make-id id
))
@@ -78,7 +77,6 @@
`(continue ,k ,(map unparse-js args)))
(($ branch test then else)
`(if ,(unparse-js test) ,(unparse-js then) ,(unparse-js else)))
- ;; values
(($ const c)
`(const ,c))
(($ primcall name args)
@@ -90,8 +88,4 @@
(($ return val)
`(return . ,(unparse-js val)))
(($ id name)
- `(id . ,name))
- (_
- ;(error "unexpected js" exp)
- (pk 'unexpected exp)
- exp)))
+ `(id . ,name))))
diff --git a/module/language/js-il/spec.scm b/module/language/js-il/spec.scm
index 81ca5da..fa4dc8e 100644
--- a/module/language/js-il/spec.scm
+++ b/module/language/js-il/spec.scm
@@ -1,6 +1,5 @@
(define-module (language js-il spec)
#:use-module (system base language)
- ; #:use-module (language js-il)
#:use-module (language js-il compile-javascript)
#:export (js-il))
@@ -8,5 +7,5 @@
#:title "Javascript Intermediate Language"
#:reader #f
#:compilers `((javascript . ,compile-javascript))
- #:printer #f ; print-js
+ #:printer #f
#:for-humans? #f)
- [Guile-commits] branch compile-to-js-merge created (now 6f112d5), Christopher Allan Webber, 2021/10/10
- [Guile-commits] 02/99: Replace values object with values passed as continuation arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 01/99: Temp commit, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 09/99: get rid of unused match case, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 03/99: Remove jscall type, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 04/99: fix makefile, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 05/99: separate js-il functions into actual functions and those for continuations, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 06/99: Get rid of comments and dead branches,
Christopher Allan Webber <=
- [Guile-commits] 07/99: Simple inlining of immediate calls, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 08/99: conditional->branch, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 10/99: fix makefile, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 11/99: Compile rest args, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 16/99: Remove superfluous space, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 20/99: Implement keyword argument parsing, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 12/99: Compile string constants, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 13/99: Mangle js identifiers, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 15/99: Handle case-lambda via a jump table, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 19/99: Simplify output Javascript, Christopher Allan Webber, 2021/10/10