Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 37f202b25a0a
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 880977e343db
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 25, 2013

  1. Copy the full SHA
    e2a562b View commit details
  2. Copy the full SHA
    880977e View commit details
Showing with 8 additions and 2 deletions.
  1. +2 −2 lib/opal/nodes/class.rb
  2. +6 −0 spec/cli/compiler_spec.rb
4 changes: 2 additions & 2 deletions lib/opal/nodes/class.rb
Original file line number Diff line number Diff line change
@@ -17,8 +17,8 @@ def compile

in_scope do
scope.name = name
add_temp "#{scope.proto} = $#{name}._proto"
add_temp "$scope = $#{name}._scope"
add_temp "#{scope.proto} = self._proto"
add_temp "$scope = self._scope"

body_code = self.body_code
empty_line
6 changes: 6 additions & 0 deletions spec/cli/compiler_spec.rb
Original file line number Diff line number Diff line change
@@ -25,6 +25,12 @@
expect_compiled("Array").to include("scope.Array")
end

describe "class names" do
it "generates a named function for class using $ prefix" do
expect_compiled("class Foo; end").to include("function $Foo")
end
end

def expect_compiled(source)
expect(Opal::Compiler.new.compile source)
end