refactoring modprovide
This commit is contained in:
parent
73f62ef36c
commit
c7a5bf9658
|
@ -9,6 +9,7 @@
|
||||||
"../compiler/expression-structs.rkt"
|
"../compiler/expression-structs.rkt"
|
||||||
"../parser/path-rewriter.rkt"
|
"../parser/path-rewriter.rkt"
|
||||||
"../parser/parse-bytecode.rkt"
|
"../parser/parse-bytecode.rkt"
|
||||||
|
"../parser/modprovide.rkt"
|
||||||
"../resource/structs.rkt"
|
"../resource/structs.rkt"
|
||||||
"../promise.rkt"
|
"../promise.rkt"
|
||||||
"check-valid-module-source.rkt"
|
"check-valid-module-source.rkt"
|
||||||
|
@ -166,16 +167,12 @@
|
||||||
(define (get-javascript-implementation src)
|
(define (get-javascript-implementation src)
|
||||||
|
|
||||||
(define (get-provided-name-code bytecode)
|
(define (get-provided-name-code bytecode)
|
||||||
(match bytecode
|
(apply string-append
|
||||||
[(struct Top [_ (struct Module (name path prefix requires provides code))])
|
(map (lambda (p)
|
||||||
(apply string-append
|
(format "modrec.getNamespace().set(~s,exports[~s]);\n"
|
||||||
(map (lambda (p)
|
(symbol->string (ModuleProvide-internal-name p))
|
||||||
(format "modrec.getNamespace().set(~s,exports[~s]);\n"
|
(symbol->string (ModuleProvide-external-name p))))
|
||||||
(symbol->string (ModuleProvide-internal-name p))
|
(get-provided-names bytecode))))
|
||||||
(symbol->string (ModuleProvide-external-name p))))
|
|
||||||
provides))]
|
|
||||||
[else
|
|
||||||
""]))
|
|
||||||
|
|
||||||
|
|
||||||
(define (get-implementation-from-path path)
|
(define (get-implementation-from-path path)
|
||||||
|
|
13
parser/modprovide.rkt
Normal file
13
parser/modprovide.rkt
Normal 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
|
||||||
|
'()]))
|
|
@ -7,4 +7,4 @@
|
||||||
(provide version)
|
(provide version)
|
||||||
(: version String)
|
(: version String)
|
||||||
|
|
||||||
(define version "1.175")
|
(define version "1.178")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user