opened
Thermatix
username_0
I noticed that the parser doesn't like having a block directly followed by another block, like this:
```ruby
some_function do 
  some_code
end.some_other_function do
  more_code
end
```
I think it's a precedence issue, it thinks the second block is apart of the first one or somthing, not completely sure I only think it has to do with precedence because `{}` has higher precedence then `do;end` and changing the first block like so:


```ruby
some_function {
  some_code
}.some_other_function do
  more_code
end
```

fixes the issue.

It kind of makes it a little hard to chain blocks together and the error that the parser generates doesn't really explain anything, if I hadn't had prior experience I wouldn't have worked it out.
precedence issue(?) with blocks
issue
created
iliabylich
username_1
What is your opal version? Could you paste an executable example?

I'm testing:
``` ruby
class MyClass
  def method1
    puts 'method1'
    yield
    self
  end

  def method2
    puts 'method2'
    yield
    self
  end
end

o = MyClass.new

o.method1 do
  puts 'block1'
end.method2 do
  puts 'block2'
end
```

And I'm getting the same output for opal master/mri:
```
method1
block1
method2
block2
```

Changing `do; ... end` to `{ ... }` doesn't bring any changes to the output
comment
created
mariusz-kowalski
username_2
I have error if method gets parameters.

when try to run this:

```ruby
class MyClass
  def method1(param)
    puts param
    yield
    self
  end

  def method2(param)
    puts param
    yield
    self
  end
end

o = MyClass.new

o.method1 'param1' do
  puts 'block1'
end.method2('param2') do
  puts 'block2'
end
```

I'm getting this error
```
Uncaught SyntaxError: An error occurred while compiling: (file)

parse error on value "do" (kDO) :(file):19
Source: (file):19:24
end.method2('param2') do
~~~~~~~~~~~~~~~~~~~~~~~^
```

As a workaround brackets can be used, like in `method2`.
comment
created
elia
username_3
@username_2 thanks for the additional example, just checked and it's fixed on master, until 0.11 comes out the best solution seems the one proposed by @Thematrix: using `{}` instead.
comment
closed
elia
username_3
issue