Skip to content

Commit

Permalink
[Truffle] Fixed translating procs with required keyword arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed May 8, 2015
1 parent 7dd17d2 commit 3462a65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 1 addition & 4 deletions spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ class MSpecScript
# "^spec/ruby/core/string/gsub_spec.rb",

# require etc, linux only spec
"^spec/ruby/core/io/advise_spec.rb",

# Problem parsing required kwargs in Proc#parameters
"^spec/ruby/core/proc/parameters_spec.rb"
"^spec/ruby/core/io/advise_spec.rb"
]

core += [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,13 @@ public RubyNode visitKeywordArgNode(org.jruby.ast.KeywordArgNode node) {

if (dAsgnNode.getValueNode() == null) {
defaultValue = new NilLiteralNode(context, sourceSection);
} else {
} else if (dAsgnNode.getValueNode() instanceof RequiredKeywordArgumentValueNode) {
/*
* This isn't a true default value - it's a marker to say there isn't one. This actually makes sense;
* the semantic action of executing this node is to report an error, and we do the same thing.
*/
defaultValue = new MissingKeywordArgumentNode(context, sourceSection, name);
}else {

This comment has been minimized.

Copy link
@eregon

eregon May 9, 2015

Member

Would it be easy to express this by having a visitRequiredKwargs so the special if is not needed?

This comment has been minimized.

Copy link
@nirvdrum

nirvdrum May 9, 2015

Author Contributor

We'd have to modify the parser. JRuby does something similar and there's a comment in the RequiredKeywordArgumentValueNode docs that suggests it's similar to what MRI does.

defaultValue = dAsgnNode.getValueNode().accept(this);
}
} else {
Expand Down

0 comments on commit 3462a65

Please sign in to comment.