Skip to content

Commit

Permalink
Fixed issues found during code review
Browse files Browse the repository at this point in the history
  • Loading branch information
redradist committed Jun 17, 2020
1 parent 6e65abb commit 233e168
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/node_bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ document.$debug = 0

self = {};
__BRYTHON__ = {}
__BRYTHON__.$js_module_path = {}
__BRYTHON__.$js_module_alias = {}
__BRYTHON__.$py_module_path = {}
__BRYTHON__.$py_module_alias = {}
__BRYTHON__.$py_next_hash = -Math.pow(2, 53)
Expand All @@ -51,9 +53,10 @@ function $import_hooks(mod_name, path, from_stdlib) {
module_contents = fs.readFileSync(path, 'utf8')
if (module_contents !== undefined) {
if (ext[j] === '.js') {
return $import_js_module(mod_name, alias, names, path, module_contents)
__BRYTHON__.$js_module_path[mod_name] = path
} else {
__BRYTHON__.$py_module_path[mod_name] = path
}
__BRYTHON__.$py_module_path[mod_name] = path
__BRYTHON__.imported[mod_name] = path
return module_contents
}
Expand All @@ -63,9 +66,9 @@ function $import_hooks(mod_name, path, from_stdlib) {
}
}
console.log("error time!");
res = Error()
var res = Error()
res.name = 'NotFoundError'
res.message = "No module named '" + module + "'"
res.message = "No module named '" + mod_name + "'"
throw res
}

Expand Down Expand Up @@ -148,6 +151,8 @@ function execute_python_script(filename) {
eval(js);
}

__BRYTHON__.$js_module_path = __BRYTHON__.$js_module_path || {}
__BRYTHON__.$js_module_alias = __BRYTHON__.$js_module_alias || {}
__BRYTHON__.$py_module_path = __BRYTHON__.$py_module_path || {}
__BRYTHON__.$py_module_alias = __BRYTHON__.$py_module_alias || {}
__BRYTHON__.exception_stack = __BRYTHON__.exception_stack || []
Expand Down
1 change: 1 addition & 0 deletions small_node_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from browser import console
import io
import math

print('Hello from Node !!')

0 comments on commit 233e168

Please sign in to comment.