Skip to content

Commit

Permalink
Fix builtin imports to bind to the correct const-id (rather than alwa…
Browse files Browse the repository at this point in the history
…ys the global import)
  • Loading branch information
InnPatron committed Jul 25, 2019
1 parent 8525be0 commit 929381e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/arr/compiler/direct-codegen.arr
Original file line number Diff line number Diff line change
Expand Up @@ -746,20 +746,20 @@ fun create-prelude(prog, provides, env, options, shadow import-flags) block:
global-names = AU.get-globals(prog)
uri-to-local-js-name = [D.mutable-string-dict:]

fun import-builtin(name :: String):
J.j-var(GLOBAL,
fun import-builtin(bind-name :: A.Name, name :: String):
J.j-var(bind-name,
j-app(j-id(const-id("require")),
[clist:
j-str( relative-path + runtime-builtin-relative-path + name)]))
end

global-import = import-builtin("global.arr.js")
global-import = import-builtin(GLOBAL, "global.arr.js")

nothing-import = J.j-var(NOTHING, j-undefined)

array-import = import-builtin("array.arr.js")
table-import = import-builtin("table.arr.js")
reactor-import = import-builtin("reactor.arr.js")
array-import = import-builtin(ARRAY, "array.arr.js")
table-import = import-builtin(TABLE, "table.arr.js")
reactor-import = import-builtin(REACTOR,"reactor.arr.js")

# Always emit global import
manual-imports = [clist: global-import, nothing-import]
Expand Down

0 comments on commit 929381e

Please sign in to comment.