Comments (7)
That's correct that only identifier/2 exists. The second parameter is optional. I haven't been able to reproduce it, but I'll give it a shot when I get a chance to later in the day.
from elixirscript.
I still haven't been able to reproduce the issue. Could you share the elixir code you are trying to transpile so that I can see if I can reproduce it with that?
from elixirscript.
It goes like this, with the example code:
$ cat hello.ex
defmodule Hello do
Lions.Tigers.Bears.oh_my(true)
end
$ ex2js -o hello.js hello.ex
** (UndefinedFunctionError) undefined function: ESTree.Tools.Builder.identifier/1 (module ESTree.Tools.Builder is not available)
ESTree.Tools.Builder.identifier(:Bears)
(elixir_script) lib/elixir_script/translator/utils.ex:102: ElixirScript.Translator.Utils.make_member_expression/3
(elixir_script) lib/elixir_script/translator/utils.ex:67: ElixirScript.Translator.Utils.make_call_expression/3
(elixir_script) lib/elixir_script/translator/module.ex:59: ElixirScript.Translator.Module.make_module/2
(elixir) lib/enum.ex:977: anonymous fn/3 in Enum.map/2
(elixir) lib/enum.ex:1261: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:977: Enum.map/2
(elixir_script) lib/elixir_script.ex:65: ElixirScript.transpile_path/2
First time I'm trying this out, so maybe I'm missing some step?
from elixirscript.
I just tried with the version from master, the release one, and using it via the version in hex and it transpiled hello.ex successfully each time.
Looking at that error though makes me think it has something to do with the version of ESTree. But if it's 2.0.0 then it should work.
If you are using it in an Elixir project, you can try the following below in iex and see if you get the same result
ElixirScript.transpile("""
defmodule Hello do
Lions.Tigers.Bears.oh_my(true)
end
""")
from elixirscript.
This seems to work just fine:
Interactive Elixir (1.0.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> ElixirScript.transpile("""
...(1)> defmodule Hello do
...(1)> Lions.Tigers.Bears.oh_my(true)
...(1)> end
...(1)> """)
["import Erlang from '__lib/erlang';\nimport Kernel from '__lib/kernel';\nimport Bears from 'lions/tigers/bears';\nconst __MODULE__ = Erlang.atom('Hello');\nBears.oh_my(true);\nexport default {};"]
iex(2)>
Maybe there's something weird on my JavaScript side - I'll try to look into it.
from elixirscript.
Fixed - code path issues on my side, while building the escript part. Everything's ok now - thanks!
from elixirscript.
Awesome!
from elixirscript.
Related Issues (20)
- Track the modules a module uses
- Build failure with macOS 10.13 and Xcode 9 HOT 2
- ElixirScript Test Assertions HOT 1
- Create compiler manifest HOT 2
- Create manifests function in Mix compiler
- Create clean function in mix compiler HOT 1
- Use manifest to see if a module should be compiled or not HOT 1
- Regex functions throw errors HOT 3
- Is it possible to compile quoted or string? HOT 3
- Enum.map does not work in 0.32 HOT 2
- comprehensions/generators HOT 1
- in-browser Elixir parser / interpreter HOT 3
- Beginner Tutorial HOT 2
- FFI - Support npm modules directly
- Elixir + Wasm HOT 9
- Pragmatic question: working with JS Object HOT 3
- Elixir Script as ClientLibrary Framework to Interface with Elixir/Phoenix
- Still alive? HOT 2
- String.slice(str, 0, -1) raises FunctionClauseError HOT 1
- Inactive project HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elixirscript.