From e302015fc37fed922c9e6e63c73726d6d93fc977 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Mon, 4 Mar 2013 13:17:55 -0700 Subject: [PATCH] need to correct namespaces. --- whalesong/js-assembler/assemble-expression.rkt | 5 ++++- whalesong/repl-prototype/htdocs/repl.js | 5 ++++- whalesong/repl-prototype/server.rkt | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/whalesong/js-assembler/assemble-expression.rkt b/whalesong/js-assembler/assemble-expression.rkt index 211860c..507faa5 100644 --- a/whalesong/js-assembler/assemble-expression.rkt +++ b/whalesong/js-assembler/assemble-expression.rkt @@ -105,4 +105,7 @@ (format "M.primitives[~s]" (symbol->string (PrimitivesReference-name op)))] [(GlobalsReference? op) - (format "M.globals[~s]" (symbol->string (GlobalsReference-name op)))])) \ No newline at end of file + (format "(M.globals[~s]!==undefined?M.globals[~s]:M.params.currentNamespace.get(~s))" + (symbol->string (GlobalsReference-name op)) + (symbol->string (GlobalsReference-name op)) + (symbol->string (GlobalsReference-name op)))])) \ No newline at end of file diff --git a/whalesong/repl-prototype/htdocs/repl.js b/whalesong/repl-prototype/htdocs/repl.js index 090f96b..7d832e5 100644 --- a/whalesong/repl-prototype/htdocs/repl.js +++ b/whalesong/repl-prototype/htdocs/repl.js @@ -19,9 +19,12 @@ $(document).ready(function() { // We then want to initialize the language module. var initializeLanguage = function(afterLanguageInitialization) { // Load up the language. - M.modules['whalesong/wescheme/lang/semantics.rkt'].invoke( + var semanticsModule = + M.modules['whalesong/wescheme/lang/semantics.rkt']; + semanticsModule.invoke( M, function() { + M.params.currentNamespace = semanticsModule.getNamespace(); console.log("Environment initialized."); afterLanguageInitialization(); }, diff --git a/whalesong/repl-prototype/server.rkt b/whalesong/repl-prototype/server.rkt index 0df4a70..e61e742 100644 --- a/whalesong/repl-prototype/server.rkt +++ b/whalesong/repl-prototype/server.rkt @@ -103,7 +103,7 @@ -(write-repl-runtime-files) +;(write-repl-runtime-files) (serve/servlet start #:servlet-path "/compile" #:extra-files-paths (list htdocs)