Permalink
Browse files

something is horribly broken here

  • Loading branch information...
1 parent 866efa9 commit c1ceff0d690ea23b5ed1f795eec5446fe32e7491 Danny Yoo committed Oct 5, 2011
Showing with 42 additions and 24 deletions.
  1. +20 −13 js-assembler/package.rkt
  2. +15 −10 lang/js/js.rkt
  3. +4 −1 lang/js/query.rkt
  4. +3 −0 lang/js/record.rkt
View
@@ -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
@@ -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
@@ -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
@@ -35,13 +35,16 @@
;; 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)
#f]
[(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))])))

0 comments on commit c1ceff0

Please sign in to comment.