diff --git a/js-assembler/package.rkt b/js-assembler/package.rkt index f15521f..93b00a9 100644 --- a/js-assembler/package.rkt +++ b/js-assembler/package.rkt @@ -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 - ""])) + (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)))) + (get-provided-names bytecode)))) (define (get-implementation-from-path path) diff --git a/parser/modprovide.rkt b/parser/modprovide.rkt new file mode 100644 index 0000000..fae6f3a --- /dev/null +++ b/parser/modprovide.rkt @@ -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 + '()])) diff --git a/version.rkt b/version.rkt index d09b023..a4d7469 100644 --- a/version.rkt +++ b/version.rkt @@ -7,4 +7,4 @@ (provide version) (: version String) -(define version "1.175") +(define version "1.178")