Giter Site home page Giter Site logo

Comments (7)

bryanjos avatar bryanjos commented on May 1, 2024

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.

bryanjos avatar bryanjos commented on May 1, 2024

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.

olgeni avatar olgeni commented on May 1, 2024

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.

bryanjos avatar bryanjos commented on May 1, 2024

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.

olgeni avatar olgeni commented on May 1, 2024

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.

olgeni avatar olgeni commented on May 1, 2024

Fixed - code path issues on my side, while building the escript part. Everything's ok now - thanks!

from elixirscript.

bryanjos avatar bryanjos commented on May 1, 2024

Awesome!

from elixirscript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.