refactoring modprovide

This commit is contained in:
Danny Yoo 2012-02-27 16:26:22 -05:00
parent 73f62ef36c
commit c7a5bf9658
3 changed files with 21 additions and 11 deletions

View File

@ -9,6 +9,7 @@
"../compiler/expression-structs.rkt"
"../parser/path-rewriter.rkt"
"../parser/parse-bytecode.rkt"
"../parser/modprovide.rkt"
"../resource/structs.rkt"
"../promise.rkt"
"check-valid-module-source.rkt"
@ -166,16 +167,12 @@
(define (get-javascript-implementation src)
(define (get-provided-name-code bytecode)
(match bytecode
[(struct Top [_ (struct Module (name path prefix requires provides code))])
(apply string-append
(map (lambda (p)
(format "modrec.getNamespace().set(~s,exports[~s]);\n"
(symbol->string (ModuleProvide-internal-name p))
(symbol->string (ModuleProvide-external-name p))))
provides))]
[else
""]))
(get-provided-names bytecode))))
(define (get-implementation-from-path path)

13
parser/modprovide.rkt Normal file
View File

@ -0,0 +1,13 @@
#lang racket/base
(require racket/match
"../compiler/expression-structs.rkt")
(provide get-provided-names)
;; get-provided-names: bytecode -> (listof ModuleProvide)
(define (get-provided-names bytecode)
(match bytecode
[(struct Top [_ (struct Module (name path prefix requires provides code))])
provides]
[else
'()]))

View File

@ -7,4 +7,4 @@
(provide version)
(: version String)
(define version "1.175")
(define version "1.178")