Merge pull request #3303 from bouk/empty-nil

Interpret argument in 'f ()' as nil instead of nothing
This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-11-30 02:52:39 +09:00
committed by GitHub
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -10,3 +10,12 @@ assert('Compiling multiple files without new line in last line. #2361') do
assert_equal "#{cmd('mrbc')}:#{a.path}:Syntax OK", result.chomp
assert_equal 0, $?.exitstatus
end
assert('parsing function with void argument') do
a, out = Tempfile.new('a.rb'), Tempfile.new('out.mrb')
a.write('f ()')
a.flush
result = `#{cmd('mrbc')} -c -o #{out.path} #{a.path} 2>&1`
assert_equal "#{cmd('mrbc')}:#{a.path}:Syntax OK", result.chomp
assert_equal 0, $?.exitstatus
end
+1 -1
View File
@@ -2109,7 +2109,7 @@ primary : literal
}
| tLPAREN_ARG {p->lstate = EXPR_ENDARG;} rparen
{
$$ = 0;
$$ = new_nil(p);
}
| tLPAREN compstmt ')'
{