brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 110 forks source link

Cannot run code from a local npm install #1581

Open martindemello opened 3 years ago

martindemello commented 3 years ago

I succesfully ran make; make test and everything up to make new-bootstrap, but both before and after regenerating the bootstrap I get the following error:

$ ./src/scripts/phase0 test.arr 
The run ended in error:
Evaluating the field lookup expression at file:///home/mdemello/github/pyret-lang/src/arr/compiler/cli-module-loader.arr:391:6-391:27 errored. The left side was an object that did not have a field named `add-profiling`: {standalone-file: src/js/base/handalone.js, display-progress: false, check-all: false, this-pyret-dir: ., check-mode: true, type-check: false, enable-spies: true, allow-shadowed: false, collect-all: false, collect-times: false, ignore-unbound: false, proper-tail-calls: true, inline-case-body-limit: 5, module-eval: true, compiled-cache: compiled, should-profile: <method:anonymous>, log: <function:anonymous>, log-error: <function:anonymous>, on-compile: <method:on-compile>, before-compile: <method:before-compile>, html-file: none, deps-file: build/bundled-node-deps.js}
Pyret stack:
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/cli-module-loader.arr: line 391, column 6
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/compile-lib.arr: line 444, column 54
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/compile-lib.arr: line 351, column 4
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/compile-lib.arr: line 305, column 46
  builtin://lists: line 510, column 36
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/compile-lib.arr: line 297, column 14
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/compile-lib.arr: line 537, column 13
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/cli-module-loader.arr: line 336, column 18
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/pyret.arr: line 207, column 19
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/pyret.arr: line 92, column 4
  file:///home/mdemello/github/pyret-lang/src/arr/compiler/pyret.arr: line 231, column 12

(also pre-bootstrap the error referred to file:///Users/joe/src/pyret-lang/src/arr/compiler/compile-lib.arr which is less than ideal :))

martindemello commented 3 years ago

adding the key to the CLI.run invocation fixed it:

diff --git a/src/arr/compiler/pyret.arr b/src/arr/compiler/pyret.arr
index 84e6b2ce7..82767dc86 100644
--- a/src/arr/compiler/pyret.arr
+++ b/src/arr/compiler/pyret.arr
@@ -207,6 +207,7 @@ fun main(args :: List<String>) -> Number block:
           result = CLI.run(r.get-value("run"), CS.default-compile-options.{
               standalone-file: standalone-file,
               display-progress: display-progress,
+              add-profiling: add-profiling,
               check-all: check-all
             }, run-args)
           _ = print(result.message + "\n")