-
-
Notifications
You must be signed in to change notification settings - Fork 330
Comparing changes
Open a pull request
base repository: opal/opal
base: 08c9b0ec4dca
head repository: opal/opal
compare: f7227ee833d8
- 12 commits
- 7 files changed
- 2 contributors
Commits on May 19, 2015
-
Support recv.JS.js_method syntax for calling javascript methods
This adds a way to call native javascript methods from ruby using valid ruby syntax, so it will work with existing tooling. This will only break working ruby code that defines a method named JS that will accept no arguments, and uses that method in a method chain. This makes it much easier to use javascript objects inside ruby code without wrapping them using Native(), and provides a work around for edge cases where Native(obj) returns obj, such as when using strings. This syntax will handle many cases where you currently need to drop down to raw javascript using backticks.
Configuration menu - View commit details
-
Copy full SHA for 50a0965 - Browse repository at this point
Copy the full SHA 50a0965View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6aa0169 - Browse repository at this point
Copy the full SHA 6aa0169View commit details
Commits on May 20, 2015
-
Make the recv.JS.js_method syntax optional and off by default
This adds js_prefix attributes to the lexer and parser, and uses a :js_prefix compiler option. It is supported in bin/opal using the --js_prefix flag. The lexer currently supports custom prefixes, in case people are already using a method named JS. This isn't currently supported by bin/opal, but can be enabled manually by using a string as the :js_prefix compiler option value.
Configuration menu - View commit details
-
Copy full SHA for ec105e5 - Browse repository at this point
Copy the full SHA ec105e5View commit details -
Revert "Make the recv.JS.js_method syntax optional and off by default"
This reverts commit ec105e5.
Configuration menu - View commit details
-
Copy full SHA for 75c07cb - Browse repository at this point
Copy the full SHA 75c07cbView commit details -
Support accessing javascript properties via foo.JS.prop
To call javascript functions with no arguments , you now need to use parentheses (e.g. foo.JS.func()).
Configuration menu - View commit details
-
Copy full SHA for 213039c - Browse repository at this point
Copy the full SHA 213039cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b072744 - Browse repository at this point
Copy the full SHA b072744View commit details
Commits on May 21, 2015
-
Configuration menu - View commit details
-
Copy full SHA for 5ccaf74 - Browse repository at this point
Copy the full SHA 5ccaf74View commit details -
Support direct javascript setters via .JS.prop = and .JS[arg] =
This causes 8 reduce/reduce conflicts in the grammar, but I haven't yet figured out how to eliminate that.
Configuration menu - View commit details
-
Copy full SHA for 607b78f - Browse repository at this point
Copy the full SHA 607b78fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 32bd3d3 - Browse repository at this point
Copy the full SHA 32bd3d3View commit details
Commits on May 28, 2015
-
Support calling javascript methods as commands
This changes the grammar to support calling javascript methods without parentheses: a.JS.b 1, 2 and with blocks: a.JS.b { |v| ...} a.JS.b(1) { |v| ...} a.JS.b do |v| ... end a.JS.b(1) do |v| ... end a.JS.b 1 do |v| ... end This changes the previous behavior for method calls without parentheses. Previously, they returned the javascript property instead of doing a method call. Now using .JS. always does a method call. If you want to return a property, use a.JS[:b] Similarly, you can no longer set properties via a.JS.b = 1, you now need to use a.JS[:b] = 1. This eliminates the reduce/reduce conflicts that the addition of property setters added. One thing this doesn't support is syntax like: foo.JS[:b] += 1 I had to specifically add support to the grammar to handle that syntax in order to eliminate the reduce/reduce conflicts, but now it just raises an error. I think raising an error is the correct behavior in this case. This would desugar to: foo.JS[:b] = foo.JS[:b].+(1) which would only make sense if foo was a javascript object with a property b that was a ruby object. That seems fairly unlikely in practice, but support could probably be added to handle that case. I think adding such support could confuse people, since they may expect it to operate the same as: `foo["b"] += 1` To support calling javascript methods with blocks, I had to copy the implementation of CallNode#default_compile to JsCallNode, and then modify it. It may be possible to refactor CallNode#default_compile to split it up into more methods, and reduce the duplication, but I'm not sure it is worth it.
Configuration menu - View commit details
-
Copy full SHA for 6d75196 - Browse repository at this point
Copy the full SHA 6d75196View commit details
Commits on May 29, 2015
-
Remove code related to removed recv.JS.prop = syntax
Since the javascript property setter syntax was limited to recv.JS['prop'] = , this code can be removed.
Configuration menu - View commit details
-
Copy full SHA for 4290c95 - Browse repository at this point
Copy the full SHA 4290c95View commit details
Commits on Jun 3, 2015
-
Merge pull request #879 from jeremyevans/jscall2
Support recv.JS.js_method syntax for calling javascript methods
Configuration menu - View commit details
-
Copy full SHA for f7227ee - Browse repository at this point
Copy the full SHA f7227eeView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 08c9b0ec4dca...f7227ee833d8