Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

something is horribly broken here

  • Loading branch information...
commit c1ceff0d690ea23b5ed1f795eec5446fe32e7491 1 parent 866efa9
Danny Yoo authored
View
33 js-assembler/package.rkt
@@ -117,19 +117,26 @@
;; source-is-javascript-module?: Source -> boolean
;; Returns true if the source looks like a Javascript-implemented module.
(define (source-is-javascript-module? src)
- (cond
- [(StatementsSource? src)
- #f]
- [(MainModuleSource? src)
- (query:has-javascript-implementation?
- `(file ,(path->string (MainModuleSource-path src))))]
- [(ModuleSource? src)
- (query:has-javascript-implementation?
- `(file ,(path->string (ModuleSource-path src))))]
- [(SexpSource? src)
- #f]
- [(UninterpretedSource? src)
- #f]))
+ (define answer
+ (cond
+ [(StatementsSource? src)
+ #f]
+ [(MainModuleSource? src)
+ (query:has-javascript-implementation?
+ `(file ,(path->string (MainModuleSource-path src))))]
+ [(ModuleSource? src)
+ (query:has-javascript-implementation?
+ `(file ,(path->string (ModuleSource-path src))))]
+ [(SexpSource? src)
+ #f]
+ [(UninterpretedSource? src)
+ #f]))
+ (fprintf (current-error-port) "source-is-javascript-module ~a: ~a\n"
+ src
+ answer)
+ answer)
+
+
(define (source-resources src)
(cond
View
25 lang/js/js.rkt
@@ -42,16 +42,21 @@
;; Also, record that any references to the racket-module name
;; should be redirected to this module.
(begin-for-syntax
- (let* ([this-module
- (variable-reference->resolved-module-path
- (#%variable-reference))]
- [key
- (resolved-module-path-name this-module)])
- (record-redirection! (#%datum . resolved-racket-module-name)
- key)
- (record-javascript-implementation! key (#%datum . impl))
- ;;(record-exported-name! key 'internal-name 'provided-name) ...
- ))
+ (printf "compile time code registering\n")
+ (let* ([this-module
+ (variable-reference->resolved-module-path
+ (#%variable-reference))]
+ [key
+ (let ([p (resolved-module-path-name this-module)])
+ (if (path? p)
+ (normalize-path p)
+ p))])
+ (record-redirection! (#%datum . resolved-racket-module-name)
+ key)
+ (printf "Registered ~s\n" key)
+ (record-javascript-implementation! key (#%datum . impl))
+ ;;(record-exported-name! key 'internal-name 'provided-name) ...
+ ))
(require racket-module-name)
(define internal-name provided-name) ...
View
5 lang/js/query.rkt
@@ -37,8 +37,11 @@
;; has-javascript-implementation?: module-path -> boolean
(define (has-javascript-implementation? a-module-path)
(let ([resolved-path (my-resolve-module-path a-module-path)])
+ (fprintf (current-error-port) "\nlooking at: ~s\n" resolved-path)
(parameterize ([current-namespace ns])
- (dynamic-require resolved-path (void)) ;; get the compile-time code running.
+ (fprintf (current-error-port) "Trying to visit\n")
+ (namespace-require/expansion-time resolved-path #;(void)) ;; get the compile-time code running.
+ (fprintf (current-error-port) "Done visiting compile-time code\n")
((dynamic-require-for-syntax record.rkt 'has-javascript-implementation?) resolved-path))))
View
3  lang/js/record.rkt
@@ -35,6 +35,8 @@
;; has-javascript-implementation?: path -> boolean
(define (has-javascript-implementation? a-path)
+ (printf "has-javascript-implementation: ~s\n"
+ records)
(let loop ([lst records])
(cond
[(null? lst)
@@ -42,6 +44,7 @@
[(equal? a-path (record-path (car lst)))
#t]
[else
+ (printf "not equal\n~s\n~s\n" a-path (record-path (car lst)))
(loop (cdr lst))])))
Please sign in to comment.
Something went wrong with that request. Please try again.