diff --git a/spec/tags/truffle/parsing/parsing_tags.txt b/spec/tags/truffle/parsing/parsing_tags.txt index 22e784a0f6db..c7c01b9b0b85 100644 --- a/spec/tags/truffle/parsing/parsing_tags.txt +++ b/spec/tags/truffle/parsing/parsing_tags.txt @@ -2,31 +2,13 @@ fails:Parsing a BEGIN block (BEGIN { ... }) case is parsed correctly fails:Parsing a END block (END { ... }) case is parsed correctly fails:Parsing a Encoding keyword (__ENCODING__ keyword) case is parsed correctly fails:Parsing a begin ... end block (with multiple expressions inside a block) case is parsed correctly - # issue with implicit rest parameters is tracked here: # - https://bugs.ruby-lang.org/issues/19971 # - https://github.com/ruby/prism/issues/1722 fails:Parsing a Block (Argument descriptors / with implicit rest parameter (|a,|)) case is parsed correctly fails:Parsing a Block (Arity / with implicit rest parameter (|a,|)) case is parsed correctly - -fails:Parsing a class << (reopen an object singleton class) case is parsed correctly fails:Parsing a Complex number (Complex literal `bri` (without real part) where b is Float is represented as `Complext.convert(0, Rational.convert(b*100, 100))` where 100 is some power of 10 to convert b to Integer) case is parsed correctly -fails:Parsing a Complex number (Complex literal `bri` (without real part) where b is Integer is represented as `Complext.convert(0, Rational.convert(b, 1))`) case is parsed correctly -fails:Parsing a Complex number (Complex literal in format of a + bi is represented as `a + Complex.convert(0, b)`) case is parsed correctly -fails:Parsing a Def (Name / Non singleton / in an anonymous module) case is parsed correctly -fails:Parsing a Def (Name / Singleton / in an anonymous module) case is parsed correctly -fails:Parsing a defined? (with yield in a method body (defined? yield)) case is parsed correctly -fails:Parsing a Ensure keyword (ensure in a method) case is parsed correctly fails:Parsing a For operator (for ... in ... operator) case is parsed correctly -fails:Parsing a Integer (when doesn't fit into Java Long (>= 64 bits)) case is parsed correctly -fails:Parsing a Method call (super / in a method body with explicit arguments) case is parsed correctly -fails:Parsing a Method call (super / in a method body without explicit arguments) case is parsed correctly -fails:Parsing a Method call (super / outside a method body with explicit arguments) case is parsed correctly -fails:Parsing a Method call (super / outside a method body without explicit arguments) case is parsed correctly -fails:Parsing a Method call (super / in a method body with explicit arguments) case is parsed correctly -fails:Parsing a Method call (super / in a method body without explicit arguments) case is parsed correctly -fails:Parsing a Method call (super / outside a method body with explicit arguments) case is parsed correctly -fails:Parsing a Method call (super / outside a method body without explicit arguments) case is parsed correctly fails:Parsing a &&= (Assign an attribute local variable (a.b &&= c)) case is parsed correctly fails:Parsing a &&= (Assign an referenced element (a[b] &&= c)) case is parsed correctly fails:Parsing a &&= (Assign an element referenced with multiple indexes (a[b, c, d] &&= e)) case is parsed correctly @@ -36,9 +18,6 @@ fails:Parsing a &&= (Variable assignment/fully qualified constant (::A &&= b)) c fails:Parsing a &&= (Variable assignment/global variable ($a &&= b)) case is parsed correctly fails:Parsing a &&= (Variable assignment/instance variable (@a &&= b)) case is parsed correctly fails:Parsing a &&= (Variable assignment/local variable (a &&= b)) case is parsed correctly -fails:Parsing a Match (=~ operator) case is parsed correctly -fails:Parsing a Match (=~ operator/with Regexp literal as a RHS) case is parsed correctly -fails:Parsing a Match (=~ operator/with Regexp literal as a LHS (without named capture groups)) case is parsed correctly fails:Parsing a Match (=~ operator/with Regexp literal as a LHS without interpolation and with named capture groups) case is parsed correctly fails:Parsing a Parentheses operator (empty) case is parsed correctly fails:Parsing a Parentheses operator (with multiple expressions, e.g. (1; 2; 3)) case is parsed correctly @@ -46,34 +25,15 @@ fails:Parsing a Parentheses operator (with single expression) case is parsed cor fails:Parsing a ||= (Assign an attribute of a local variable (a.b ||= c)) case is parsed correctly fails:Parsing a ||= (Assign an referenced element (a[b] ||= c)) case is parsed correctly fails:Parsing a ||= (Assign an element referenced with multiple indexes (a[b, c, d] ||= e)) case is parsed correctly -fails:Parsing a ||= (Variable assignment/class variable (@@a ||= b)) case is parsed correctly fails:Parsing a ||= (Variable assignment/constant (A ||= b)) case is parsed correctly fails:Parsing a ||= (Variable assignment/fully qualified constant (::A ||= b)) case is parsed correctly -fails:Parsing a ||= (Variable assignment/global variable ($a ||= b)) case is parsed correctly -fails:Parsing a ||= (Variable assignment/instance variable (@a ||= b)) case is parsed correctly -fails:Parsing a ||= (Variable assignment/local variable (a ||= b)) case is parsed correctly -fails:Parsing a Range (Beginningless Range literal ..b) case is parsed correctly -fails:Parsing a Range (Endless Range literal a..) case is parsed correctly -fails:Parsing a Range (Range literal a...b (with excluded end)) case is parsed correctly -fails:Parsing a Range (Range literal a..b (with included end)) case is parsed correctly -fails:Parsing a Range (When Range boundaries are Integer values) case is parsed correctly -fails:Parsing a Range (When Range boundaries are big Integer values (that don't fit into Java int, so > 2**32)) case is parsed correctly fails:Parsing a Rational number (with big Integer value (>= 2^64).) case is parsed correctly fails:Parsing a Rational number (with Float value) case is parsed correctly -fails:Parsing a Rational number (with Integer value) case is parsed correctly -fails:Parsing a Rational number (with negative value) case is parsed correctly fails:Parsing a Regexp (Regexp literal in boolean context (e.g. condition in if, while, etc)) case is parsed correctly fails:Parsing a Regexp (Regexp literal in boolean context with interpolation (e.g. condition in if, while, etc)) case is parsed correctly -fails:Parsing a Regexp (a literal) case is parsed correctly -fails:Parsing a Regexp (a literal with interpolation (with #{...})) case is parsed correctly -fails:Parsing a Regexp (a literal with interpolation but without expression (#{})) case is parsed correctly -fails:Parsing a Regexp (a literal with options (e.g. i, x, m, o)) case is parsed correctly -fails:Parsing a Regexp (with named captured group (/(?b)/)) case is parsed correctly fails:Parsing a Rescue keyword (backtrace optimization / disabled / when rescue section is Range (... rescue 1..3)) case is parsed correctly fails:Parsing a Rescue keyword (backtrace optimization / disabled / when rescue section is Regexp (... rescue /a/)) case is parsed correctly fails:Parsing a Rescue keyword (backtrace optimization / enabled / when rescue section is __FILE__ constant (... rescue __FILE__)) case is parsed correctly -fails:Parsing a Rescue keyword (backtrace optimization / enabled / when rescue section is local variable defined in outer scope (... rescue a)) case is parsed correctly -fails:Parsing a Rescue keyword (rescue in a method) case is parsed correctly fails:Parsing a Rescue keyword (modifier / backtrace optimization / disabled / when rescue section is Range (... rescue 1..3)) case is parsed correctly fails:Parsing a Rescue keyword (modifier / backtrace optimization / disabled / when rescue section is Regexp (... rescue /a/)) case is parsed correctly fails:Parsing a Rescue keyword (modifier / backtrace optimization / enabled / when rescue section is __FILE__ constant (... rescue __FILE__)) case is parsed correctly @@ -87,14 +47,14 @@ fails:Parsing a String (Literal with interpolation when expressions are Strings) fails:Parsing a Symbol (Literal with interpolation when expressions are % String literals) case is parsed correctly fails:Parsing a Symbol (Literal with interpolation when expressions are Strings) case is parsed correctly fails:Parsing a Undef (with multiple Symbols) case is parsed correctly -fails:Parsing a Yield (yield operator with arguments) case is parsed correctly -fails:Parsing a Yield (yield operator with keyword arguments) case is parsed correctly -fails:Parsing a Yield (yield operator with double splat operator (yield **a)) case is parsed correctly fails:Parsing a Yield (yield operator with splat operator (yield *a)) case is parsed correctly fails:Parsing a Yield (yield operator with splat operator with multiple following positional arguments (yield *a, b, c)) case is parsed correctly fails:Parsing a Yield (yield operator with splat operator with multiple preceding and following positional arguments (yield a, *b, c)) case is parsed correctly -fails:Parsing a Yield (yield operator with splat operator with multiple preceding positional arguments (yield a, b, *c)) case is parsed correctly fails:Parsing a Yield (yield operator with splat operator with a single following positional argument (yield *a, b)) case is parsed correctly fails:Parsing a Yield (yield operator with splat operator with a single preceding and following positional argument (yield a, *b, c)) case is parsed correctly -fails:Parsing a Yield (yield operator with splat operator with a single preceding positional argument (yield a, *b)) case is parsed correctly -fails:Parsing a Yield (yield operator without arguments) case is parsed correctly +fails:Parsing a Method call (super / outside a method body without explicit arguments) case is parsed correctly +fails:Parsing a += (Assign an attribute local variable (a.b += c)) case is parsed correctly +fails:Parsing a += (Assign an referenced element (a[b] += c)) case is parsed correctly +fails:Parsing a += (Assign an element referenced with multiple indexes (a[b, c, d] += e)) case is parsed correctly +fails:Parsing a += (Variable assignment/constant (A += b)) case is parsed correctly +fails:Parsing a += (Variable assignment/fully qualified constant (::A += b)) case is parsed correctly diff --git a/spec/truffle/parsing/fixtures/BEGIN.yaml b/spec/truffle/parsing/fixtures/BEGIN.yaml index 0991667c1c3e..499db7279638 100644 --- a/spec/truffle/parsing/fixtures/BEGIN.yaml +++ b/spec/truffle/parsing/fixtures/BEGIN.yaml @@ -19,7 +19,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/END.yaml b/spec/truffle/parsing/fixtures/END.yaml index fd12788493b5..28f7cf811614 100644 --- a/spec/truffle/parsing/fixtures/END.yaml +++ b/spec/truffle/parsing/fixtures/END.yaml @@ -30,7 +30,7 @@ ast: | child = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -82,7 +82,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/begin_end_block.yaml b/spec/truffle/parsing/fixtures/begin_end_block.yaml index 75d838f6f5d5..fc4fbfb86237 100644 --- a/spec/truffle/parsing/fixtures/begin_end_block.yaml +++ b/spec/truffle/parsing/fixtures/begin_end_block.yaml @@ -21,7 +21,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/block/argument_descriptors/with_implicit_rest_parameter.yaml b/spec/truffle/parsing/fixtures/block/argument_descriptors/with_implicit_rest_parameter.yaml index 702661c544fb..305e872a6f75 100644 --- a/spec/truffle/parsing/fixtures/block/argument_descriptors/with_implicit_rest_parameter.yaml +++ b/spec/truffle/parsing/fixtures/block/argument_descriptors/with_implicit_rest_parameter.yaml @@ -59,7 +59,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %destructure_1 children: valueNode = SplatCastNodeGen @@ -94,7 +94,7 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %destructure_1 type = FRAME_LOCAL ] elseBody = @@ -106,7 +106,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -120,7 +120,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 1 + frameSlot = 1 # a children: valueNode = ProfileArgumentNodeGen @@ -137,7 +137,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %anonymous_rest children: valueNode = ReadRestArgumentNode @@ -157,7 +157,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -171,7 +171,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 1 + frameSlot = 1 # a children: valueNode = ArrayIndexNodesFactory$ReadConstantIndexNodeGen @@ -183,12 +183,12 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %destructure_1 type = FRAME_LOCAL WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %anonymous_rest children: valueNode = ArraySliceNodeGen @@ -201,7 +201,7 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %destructure_1 type = FRAME_LOCAL ] NilLiteralNode diff --git a/spec/truffle/parsing/fixtures/block/arity/with_implicit_rest_parameter.yaml b/spec/truffle/parsing/fixtures/block/arity/with_implicit_rest_parameter.yaml index 04a82a8a3b82..bb1dab0bd6c1 100644 --- a/spec/truffle/parsing/fixtures/block/arity/with_implicit_rest_parameter.yaml +++ b/spec/truffle/parsing/fixtures/block/arity/with_implicit_rest_parameter.yaml @@ -59,7 +59,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %destructure_1 children: valueNode = SplatCastNodeGen @@ -94,7 +94,7 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %destructure_1 type = FRAME_LOCAL ] elseBody = @@ -106,7 +106,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -120,7 +120,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 1 + frameSlot = 1 # a children: valueNode = ProfileArgumentNodeGen @@ -137,7 +137,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %anonymous_rest children: valueNode = ReadRestArgumentNode @@ -157,7 +157,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -171,7 +171,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 1 + frameSlot = 1 # a children: valueNode = ArrayIndexNodesFactory$ReadConstantIndexNodeGen @@ -183,12 +183,12 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %destructure_1 type = FRAME_LOCAL WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %anonymous_rest children: valueNode = ArraySliceNodeGen @@ -201,7 +201,7 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %destructure_1 type = FRAME_LOCAL ] NilLiteralNode diff --git a/spec/truffle/parsing/fixtures/block/name/in_block.yaml b/spec/truffle/parsing/fixtures/block/name/in_block.yaml index 6af678081658..55db8aae9960 100644 --- a/spec/truffle/parsing/fixtures/block/name/in_block.yaml +++ b/spec/truffle/parsing/fixtures/block/name/in_block.yaml @@ -68,7 +68,7 @@ ast: | child = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/block/name/in_method.yaml b/spec/truffle/parsing/fixtures/block/name/in_method.yaml index 21a817112f9f..610e8c54a6f3 100644 --- a/spec/truffle/parsing/fixtures/block/name/in_method.yaml +++ b/spec/truffle/parsing/fixtures/block/name/in_method.yaml @@ -75,7 +75,7 @@ ast: | child = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_argument.yaml b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_argument.yaml index f0fb9e525f77..9e8021aaa879 100644 --- a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_argument.yaml +++ b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_argument.yaml @@ -35,7 +35,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_arguments.yaml b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_arguments.yaml index a76a67692293..bb9d292226d6 100644 --- a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_arguments.yaml +++ b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_following_arguments.yaml @@ -36,7 +36,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_and_following_arguments.yaml b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_and_following_arguments.yaml index 1ff2ee864177..cd514b7f12e8 100644 --- a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_and_following_arguments.yaml +++ b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_and_following_arguments.yaml @@ -51,7 +51,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_argument.yaml b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_argument.yaml index 04dcd4ef3df4..50ec05995088 100644 --- a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_argument.yaml +++ b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_argument.yaml @@ -45,7 +45,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_arguments.yaml b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_arguments.yaml index f2266f091a50..91fb78650082 100644 --- a/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_arguments.yaml +++ b/spec/truffle/parsing/fixtures/break/with_splat_operator_and_preceding_arguments.yaml @@ -49,7 +49,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_else_branch.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_else_branch.yaml index 34f9b3adcc9e..b12fa8df1fe4 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_else_branch.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_else_branch.yaml @@ -65,7 +65,7 @@ ast: | assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 integerCaseEqualAssumption = Assumption(valid, name=inlined Integer#===) - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='===', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode @@ -89,7 +89,7 @@ ast: | assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 integerCaseEqualAssumption = Assumption(valid, name=inlined Integer#===) - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='===', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_multiple_values.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_multiple_values.yaml index a7293b856fc8..f123efda8b02 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_multiple_values.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_multiple_values.yaml @@ -64,7 +64,7 @@ ast: | assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 integerCaseEqualAssumption = Assumption(valid, name=inlined Integer#===) - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='===', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode @@ -83,7 +83,7 @@ ast: | assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 integerCaseEqualAssumption = Assumption(valid, name=inlined Integer#===) - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='===', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = FloatLiteralNode diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_single_value.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_single_value.yaml index ede9505b0f3c..5df7fe6fedc2 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_single_value.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_single_value.yaml @@ -64,7 +64,7 @@ ast: | assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 integerCaseEqualAssumption = Assumption(valid, name=inlined Integer#===) - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='===', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode @@ -88,7 +88,7 @@ ast: | assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 integerCaseEqualAssumption = Assumption(valid, name=inlined Integer#===) - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='===', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator.yaml index 300a21aa14b6..b5d8e513a2ac 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator.yaml @@ -16,7 +16,7 @@ ast: | condition = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -40,7 +40,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_element.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_element.yaml index f0aeeb64493a..aa9b79c8d10f 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_element.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_element.yaml @@ -17,7 +17,7 @@ ast: | condition = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -46,7 +46,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_elements.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_elements.yaml index 4bb60d89ca7d..92cf070d005d 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_elements.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_following_elements.yaml @@ -18,7 +18,7 @@ ast: | condition = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -47,7 +47,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_element.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_element.yaml index 77981cb7420c..cf951bb07b5e 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_element.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_element.yaml @@ -17,7 +17,7 @@ ast: | condition = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -57,7 +57,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_elements.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_elements.yaml index 83f393f93344..00d3192a9882 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_elements.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_and_following_elements.yaml @@ -18,7 +18,7 @@ ast: | condition = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -62,7 +62,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_element.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_element.yaml index 067a25594d28..1ecf3a065d38 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_element.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_element.yaml @@ -16,7 +16,7 @@ ast: | condition = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -56,7 +56,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_elements.yaml b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_elements.yaml index 928d411d69bc..1a0898bdb5dd 100644 --- a/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_elements.yaml +++ b/spec/truffle/parsing/fixtures/case/with_expression_and_when/with_splat_operator_and_preceding_elements.yaml @@ -16,7 +16,7 @@ ast: | condition = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -60,7 +60,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/case/without_expression_and_when/with_splat_operator.yaml b/spec/truffle/parsing/fixtures/case/without_expression_and_when/with_splat_operator.yaml index 02623963979f..cb2d91c47767 100644 --- a/spec/truffle/parsing/fixtures/case/without_expression_and_when/with_splat_operator.yaml +++ b/spec/truffle/parsing/fixtures/case/without_expression_and_when/with_splat_operator.yaml @@ -17,7 +17,7 @@ ast: | condition = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -57,7 +57,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/class <<.yaml b/spec/truffle/parsing/fixtures/class<<.yaml similarity index 98% rename from spec/truffle/parsing/fixtures/class <<.yaml rename to spec/truffle/parsing/fixtures/class<<.yaml index 42ab4e909209..2e94596b30fc 100644 --- a/spec/truffle/parsing/fixtures/class <<.yaml +++ b/spec/truffle/parsing/fixtures/class<<.yaml @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/complex_numbers/with_float_imaginary_part.yaml b/spec/truffle/parsing/fixtures/complex_numbers/with_float_imaginary_part.yaml index 6d47bf9b7cf8..da77a7a18ac5 100644 --- a/spec/truffle/parsing/fixtures/complex_numbers/with_float_imaginary_part.yaml +++ b/spec/truffle/parsing/fixtures/complex_numbers/with_float_imaginary_part.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/complex_numbers/with_float_rational_imaginary_part.yaml b/spec/truffle/parsing/fixtures/complex_numbers/with_float_rational_imaginary_part.yaml index 8cda47c89375..21b689998d30 100644 --- a/spec/truffle/parsing/fixtures/complex_numbers/with_float_rational_imaginary_part.yaml +++ b/spec/truffle/parsing/fixtures/complex_numbers/with_float_rational_imaginary_part.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 @@ -29,7 +29,7 @@ ast: | value = 0 RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/complex_numbers/with_integer_imaginary_part.yaml b/spec/truffle/parsing/fixtures/complex_numbers/with_integer_imaginary_part.yaml index 55074370595d..5a352e06fa45 100644 --- a/spec/truffle/parsing/fixtures/complex_numbers/with_integer_imaginary_part.yaml +++ b/spec/truffle/parsing/fixtures/complex_numbers/with_integer_imaginary_part.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/complex_numbers/with_integer_rational_imaginary_part.yaml b/spec/truffle/parsing/fixtures/complex_numbers/with_integer_rational_imaginary_part.yaml index 76239a9a53b5..1a5098839714 100644 --- a/spec/truffle/parsing/fixtures/complex_numbers/with_integer_rational_imaginary_part.yaml +++ b/spec/truffle/parsing/fixtures/complex_numbers/with_integer_rational_imaginary_part.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 @@ -28,7 +28,7 @@ ast: | value = 0 RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/complex_numbers/with_rational_and_imaginary_parts.yaml b/spec/truffle/parsing/fixtures/complex_numbers/with_rational_and_imaginary_parts.yaml index 9f2bc04ca667..ced60ad1ea76 100644 --- a/spec/truffle/parsing/fixtures/complex_numbers/with_rational_and_imaginary_parts.yaml +++ b/spec/truffle/parsing/fixtures/complex_numbers/with_rational_and_imaginary_parts.yaml @@ -10,7 +10,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode @@ -20,7 +20,7 @@ ast: | rightNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/def/name/non_singleton/in_anonymous_module.yaml b/spec/truffle/parsing/fixtures/def/name/non_singleton/in_anonymous_module.yaml index cae5ed98d6ae..1152a0fced0d 100644 --- a/spec/truffle/parsing/fixtures/def/name/non_singleton/in_anonymous_module.yaml +++ b/spec/truffle/parsing/fixtures/def/name/non_singleton/in_anonymous_module.yaml @@ -43,7 +43,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -89,7 +89,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/def/name/singleton/in_anonymous_module.yaml b/spec/truffle/parsing/fixtures/def/name/singleton/in_anonymous_module.yaml index b337e1229a69..0129c64e678f 100644 --- a/spec/truffle/parsing/fixtures/def/name/singleton/in_anonymous_module.yaml +++ b/spec/truffle/parsing/fixtures/def/name/singleton/in_anonymous_module.yaml @@ -44,7 +44,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -58,7 +58,7 @@ ast: | WriteLocalVariableNode attributes: flags = 1 - frameSlot = 1 + frameSlot = 1 # bar children: valueNode = StringLiteralNode @@ -83,7 +83,7 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 1 + frameSlot = 1 # bar type = FRAME_LOCAL call targets: RubyMethodRootNode @@ -113,7 +113,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/defined/with_yield_in_method.yaml b/spec/truffle/parsing/fixtures/defined/with_yield_in_method.yaml index 7cfa6a5896f4..812581eb7254 100644 --- a/spec/truffle/parsing/fixtures/defined/with_yield_in_method.yaml +++ b/spec/truffle/parsing/fixtures/defined/with_yield_in_method.yaml @@ -46,7 +46,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -68,7 +68,7 @@ ast: | child = YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 0 isSplatted = false @@ -80,6 +80,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/ensure/in_begin_end_block.yaml b/spec/truffle/parsing/fixtures/ensure/in_begin_end_block.yaml index c565974278f2..3a5dc16b6424 100644 --- a/spec/truffle/parsing/fixtures/ensure/in_begin_end_block.yaml +++ b/spec/truffle/parsing/fixtures/ensure/in_begin_end_block.yaml @@ -38,7 +38,7 @@ ast: | ensurePart = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/ensure/in_do_end_block.yaml b/spec/truffle/parsing/fixtures/ensure/in_do_end_block.yaml index aa50b29d6494..c1f82bf457e6 100644 --- a/spec/truffle/parsing/fixtures/ensure/in_do_end_block.yaml +++ b/spec/truffle/parsing/fixtures/ensure/in_do_end_block.yaml @@ -62,7 +62,7 @@ ast: | ensurePart = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/ensure/in_method.yaml b/spec/truffle/parsing/fixtures/ensure/in_method.yaml index a8c262ee53fe..eb84373457ee 100644 --- a/spec/truffle/parsing/fixtures/ensure/in_method.yaml +++ b/spec/truffle/parsing/fixtures/ensure/in_method.yaml @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -69,7 +69,7 @@ ast: | ensurePart = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/ensure/in_module.yaml b/spec/truffle/parsing/fixtures/ensure/in_module.yaml index bf217d5a2fe9..cb99b0d61bc0 100644 --- a/spec/truffle/parsing/fixtures/ensure/in_module.yaml +++ b/spec/truffle/parsing/fixtures/ensure/in_module.yaml @@ -74,7 +74,7 @@ ast: | ensurePart = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/for_operator.yaml b/spec/truffle/parsing/fixtures/for_operator.yaml index 15a41cf606f3..5148cdee28c4 100644 --- a/spec/truffle/parsing/fixtures/for_operator.yaml +++ b/spec/truffle/parsing/fixtures/for_operator.yaml @@ -35,14 +35,17 @@ notes: > 1)) # frameSlot (NilLiteralNode) + + Note that both i and any local variable in the `for`'s body are declared in the outer scope. focused_on_node: "org.truffleruby.language.dispatch.RubyCallNode" ruby: | for i in [42, 100500] + inner = 1 end ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -88,7 +91,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -102,7 +105,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 1 + frameSlot = 1 # %for_0 children: valueNode = ProfileArgumentNodeGen @@ -126,11 +129,19 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 1 + frameSlot = 1 # %for_0 type = FRAME_LOCAL - NilLiteralNode + WriteDeclarationVariableNode attributes: - flags = 0 + flags = 1 + frameDepth = 1 + frameSlot = 5 + children: + valueNode = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 1 ] receiver = ArrayLiteralNode$UninitialisedArrayLiteralNode diff --git a/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_double_splat.yaml b/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_double_splat.yaml index a9dffe94d8a4..8d2787775285 100644 --- a/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_double_splat.yaml +++ b/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_double_splat.yaml @@ -13,7 +13,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_double_splat_and_key_value_pairs.yaml b/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_double_splat_and_key_value_pairs.yaml index 50eb39a2f9a9..16a773d24ead 100644 --- a/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_double_splat_and_key_value_pairs.yaml +++ b/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_double_splat_and_key_value_pairs.yaml @@ -20,7 +20,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_key_value_pairs_and_double_splat_operator.yaml b/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_key_value_pairs_and_double_splat_operator.yaml index 8e09305f7d9b..6262eda19f66 100644 --- a/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_key_value_pairs_and_double_splat_operator.yaml +++ b/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_key_value_pairs_and_double_splat_operator.yaml @@ -34,7 +34,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_key_value_pairs_double_splat_operator_and_key_value_pairs.yaml b/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_key_value_pairs_double_splat_operator_and_key_value_pairs.yaml index b1ad929fb9b0..8bd68283e18c 100644 --- a/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_key_value_pairs_double_splat_operator_and_key_value_pairs.yaml +++ b/spec/truffle/parsing/fixtures/hashes/with_double_splat_operator/with_key_value_pairs_double_splat_operator_and_key_value_pairs.yaml @@ -35,7 +35,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/method_calls/arguments/with_&_decontruction_to_block.yaml b/spec/truffle/parsing/fixtures/method_calls/arguments/with_&_decontruction_to_block.yaml index 9b8d0c098d23..0bd0a44ec767 100644 --- a/spec/truffle/parsing/fixtures/method_calls/arguments/with_&_decontruction_to_block.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/arguments/with_&_decontruction_to_block.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/method_calls/arguments/with_block_literal_argument.yaml b/spec/truffle/parsing/fixtures/method_calls/arguments/with_block_literal_argument.yaml index 4d5c4922c90a..0a9e8baa7d1e 100644 --- a/spec/truffle/parsing/fixtures/method_calls/arguments/with_block_literal_argument.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/arguments/with_block_literal_argument.yaml @@ -22,7 +22,7 @@ ast: | child = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/method_calls/arguments/with_double_splat_operator.yaml b/spec/truffle/parsing/fixtures/method_calls/arguments/with_double_splat_operator.yaml index b1326ae1d24f..3f71da6febfe 100644 --- a/spec/truffle/parsing/fixtures/method_calls/arguments/with_double_splat_operator.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/arguments/with_double_splat_operator.yaml @@ -29,7 +29,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/method_calls/arguments/with_positional_argument_and_splat_operator.yaml b/spec/truffle/parsing/fixtures/method_calls/arguments/with_positional_argument_and_splat_operator.yaml index aeba02e63049..3b5777c1a547 100644 --- a/spec/truffle/parsing/fixtures/method_calls/arguments/with_positional_argument_and_splat_operator.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/arguments/with_positional_argument_and_splat_operator.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 @@ -23,52 +23,65 @@ ast: | notRuby2KeywordsHashProfile = false children: arguments = [ - RubyCallNode + ArrayConcatNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... - dispatchConfig = PRIVATE - emptyKeywordsProfile = false flags = 0 - isAttrAssign = false - isSafeNavigation = false - isSplatted = false - isVCall = true - lastArgIsNotHashProfile = false - methodName = "bar" - notEmptyKeywordsProfile = false - notRuby2KeywordsHashProfile = false children: - receiver = - SelfNode + children = [ + ArrayLiteralNode$UninitialisedArrayLiteralNode attributes: flags = 0 - SplatCastNodeGen - attributes: - conversionMethod = :to_a - copy = true - flags = 0 - nilBehavior = CONVERT - children: - childNode_ = - RubyCallNode + language = org.truffleruby.RubyLanguage@... + children: + values = [ + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PRIVATE + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = true + lastArgIsNotHashProfile = false + methodName = "bar" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + receiver = + SelfNode + attributes: + flags = 0 + ] + SplatCastNodeGen attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... - dispatchConfig = PRIVATE - emptyKeywordsProfile = false + conversionMethod = :to_a + copy = true flags = 0 - isAttrAssign = false - isSafeNavigation = false - isSplatted = false - isVCall = true - lastArgIsNotHashProfile = false - methodName = "baz" - notEmptyKeywordsProfile = false - notRuby2KeywordsHashProfile = false + nilBehavior = CONVERT children: - receiver = - SelfNode + childNode_ = + RubyCallNode attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PRIVATE + emptyKeywordsProfile = false flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = true + lastArgIsNotHashProfile = false + methodName = "baz" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + receiver = + SelfNode + attributes: + flags = 0 + ] ] receiver = SelfNode diff --git a/spec/truffle/parsing/fixtures/method_calls/arguments/with_splat_operator.yaml b/spec/truffle/parsing/fixtures/method_calls/arguments/with_splat_operator.yaml index 3d5b1ebff0cc..3eee5c5ae118 100644 --- a/spec/truffle/parsing/fixtures/method_calls/arguments/with_splat_operator.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/arguments/with_splat_operator.yaml @@ -10,7 +10,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 @@ -34,7 +34,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/method_calls/arguments/with_splat_operator_and_positional_arguments.yaml b/spec/truffle/parsing/fixtures/method_calls/arguments/with_splat_operator_and_positional_arguments.yaml index ad2d5c4db01c..194743409346 100644 --- a/spec/truffle/parsing/fixtures/method_calls/arguments/with_splat_operator_and_positional_arguments.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/arguments/with_splat_operator_and_positional_arguments.yaml @@ -12,7 +12,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 @@ -26,52 +26,65 @@ ast: | notRuby2KeywordsHashProfile = false children: arguments = [ - SplatCastNodeGen + ArrayConcatNode attributes: - conversionMethod = :to_a - copy = true flags = 0 - nilBehavior = CONVERT children: - childNode_ = - RubyCallNode + children = [ + SplatCastNodeGen attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... - dispatchConfig = PRIVATE - emptyKeywordsProfile = false + conversionMethod = :to_a + copy = true flags = 0 - isAttrAssign = false - isSafeNavigation = false - isSplatted = false - isVCall = true - lastArgIsNotHashProfile = false - methodName = "bar" - notEmptyKeywordsProfile = false - notRuby2KeywordsHashProfile = false + nilBehavior = CONVERT children: - receiver = - SelfNode + childNode_ = + RubyCallNode attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PRIVATE + emptyKeywordsProfile = false flags = 0 - RubyCallNode - attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... - dispatchConfig = PRIVATE - emptyKeywordsProfile = false - flags = 0 - isAttrAssign = false - isSafeNavigation = false - isSplatted = false - isVCall = true - lastArgIsNotHashProfile = false - methodName = "baz" - notEmptyKeywordsProfile = false - notRuby2KeywordsHashProfile = false - children: - receiver = - SelfNode + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = true + lastArgIsNotHashProfile = false + methodName = "bar" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + receiver = + SelfNode + attributes: + flags = 0 + ArrayLiteralNode$UninitialisedArrayLiteralNode attributes: flags = 0 + language = org.truffleruby.RubyLanguage@... + children: + values = [ + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PRIVATE + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = true + lastArgIsNotHashProfile = false + methodName = "baz" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + receiver = + SelfNode + attributes: + flags = 0 + ] + ] ] receiver = SelfNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_!.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_!.yaml index 6c7da1518e24..dec7e78a9ca8 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_!.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_!.yaml @@ -9,7 +9,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='!', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: selfNode_ = ReadLocalVariableNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_%.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_%.yaml index 69b8a5a9821a..806958b6a3d2 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_%.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_%.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#%), Assumption(valid, name=inlined Float#%)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='%', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_&.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_&.yaml index 2816d041c271..2230d416888b 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_&.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_&.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#&)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='&', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_*.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_*.yaml index 51fc0a5d5f10..956971b1a10f 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_*.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_*.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#*), Assumption(valid, name=inlined Float#*)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='*', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_+.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_+.yaml index 7dff4268b5c8..3fd06fa7aab4 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_+.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_+.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_-.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_-.yaml index 3b971f843ad4..565bc445eb63 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_-.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_-.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#-), Assumption(valid, name=inlined Float#-)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='-', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_-@.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_-@.yaml index 443f6ceafe50..e05a44d39a8a 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_-@.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_-@.yaml @@ -9,7 +9,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#-@), Assumption(valid, name=inlined Float#-@)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='-@', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: selfNode_ = ReadLocalVariableNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<.yaml index c1042fb088d9..27865c23b197 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#<), Assumption(valid, name=inlined Float#<)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='<', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<<.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<<.yaml index 1e60198aafd1..1e6636a5c2e0 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<<.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<<.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#<<)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='<<', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<=.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<=.yaml index 3d3b1d3707c7..d18af8cc9814 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<=.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_<=.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#<=), Assumption(valid, name=inlined Float#<=)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='<=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_==.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_==.yaml index 603170fc10fd..6cafe14d73e8 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_==.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_==.yaml @@ -10,7 +10,7 @@ ast: | flags = 1 floatEqualAssumption = Assumption(valid, name=inlined Float#==) integerEqualAssumption = Assumption(valid, name=inlined Integer#==) - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='==', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_===.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_===.yaml index 8bf32209d10a..43d17628213f 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_===.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_===.yaml @@ -9,7 +9,7 @@ ast: | assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 1 integerCaseEqualAssumption = Assumption(valid, name=inlined Integer#===) - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='===', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>.yaml index 5b982c3ff7b5..54d34ffe36cd 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#>), Assumption(valid, name=inlined Float#>)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='>', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>=.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>=.yaml index ec75ca2ade10..8d5fa0b242e3 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>=.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>=.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#>=), Assumption(valid, name=inlined Float#>=)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='>=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>>.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>>.yaml index 0155171f4c1e..45a1d8a2312a 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>>.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_>>.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#>>)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='>>', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_[].yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_[].yaml index a731b64b1583..0c5b6ab629d7 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_[].yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_[].yaml @@ -9,7 +9,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = ReadLocalVariableNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_[]=.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_[]=.yaml index 47faa7167a04..f57715e66da2 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_[]=.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_[]=.yaml @@ -9,7 +9,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_at.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_at.yaml index 26b72d39d184..c198411bed26 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_at.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_at.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='at', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = ArrayLiteralNode$UninitialisedArrayLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_bytesize.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_bytesize.yaml index df9e8f3b9bb9..ef26365ac736 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_bytesize.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_bytesize.yaml @@ -9,7 +9,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='bytesize', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: selfNode_ = ReadLocalVariableNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_is_a?.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_is_a?.yaml index e4ad02063839..7a2de9487f8d 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_is_a?.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_is_a?.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='is_a?', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_kind_of?.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_kind_of?.yaml index 942f6da6e07c..c6ec0a7f3eaf 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_kind_of?.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_kind_of?.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='kind_of?', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_lambda.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_lambda.yaml index 8a115c2df2c5..e73b9cf9451c 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_lambda.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_lambda.yaml @@ -12,7 +12,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='lambda', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: block_ = BlockDefinitionNodeGen diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_lambda_not_kernel.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_lambda_not_kernel.yaml index 7e42484633eb..35f94e72a770 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_lambda_not_kernel.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_lambda_not_kernel.yaml @@ -14,7 +14,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_nil?.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_nil?.yaml index e72669243e92..4edb5f2f19dd 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_nil?.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_nil?.yaml @@ -9,7 +9,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Nil#nil?)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='nil?', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: selfNode_ = ReadLocalVariableNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_slash.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_slash.yaml index 745ed3be38a8..7e4d60756875 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_slash.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_slash.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#/), Assumption(valid, name=inlined Float#/)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='/', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_|.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_|.yaml index b7bfee82ca76..e6d6b2a63764 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/method_|.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/method_|.yaml @@ -8,7 +8,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#|)] flags = 1 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='|', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/method_calls/special_cases/property_assignment.yaml b/spec/truffle/parsing/fixtures/method_calls/special_cases/property_assignment.yaml index 9eb663bff2ad..ea5475063c65 100644 --- a/spec/truffle/parsing/fixtures/method_calls/special_cases/property_assignment.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/special_cases/property_assignment.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 1 @@ -30,7 +30,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/method_calls/super/in_method_body_with_explicit_arguments.yaml b/spec/truffle/parsing/fixtures/method_calls/super/in_method_body_with_explicit_arguments.yaml index e925fda80bc1..20db1a109793 100644 --- a/spec/truffle/parsing/fixtures/method_calls/super/in_method_body_with_explicit_arguments.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/super/in_method_body_with_explicit_arguments.yaml @@ -43,7 +43,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -60,9 +60,9 @@ ast: | slot = 2 SuperCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false - flags = 0 + flags = 1 isSplatted = false lastArgIsNotHashProfile = false notEmptyKeywordsProfile = false @@ -84,6 +84,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/method_calls/super/in_method_body_without_explicit_arguments.yaml b/spec/truffle/parsing/fixtures/method_calls/super/in_method_body_without_explicit_arguments.yaml index 0a0100f1a962..1e1f25526f51 100644 --- a/spec/truffle/parsing/fixtures/method_calls/super/in_method_body_without_explicit_arguments.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/super/in_method_body_without_explicit_arguments.yaml @@ -43,7 +43,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -60,9 +60,9 @@ ast: | slot = 2 SuperCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false - flags = 0 + flags = 1 isSplatted = false lastArgIsNotHashProfile = false notEmptyKeywordsProfile = false @@ -77,6 +77,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/method_calls/super/outside_method_body_with_explicit_arguments.yaml b/spec/truffle/parsing/fixtures/method_calls/super/outside_method_body_with_explicit_arguments.yaml index bdc37728bc20..abbbb136b38c 100644 --- a/spec/truffle/parsing/fixtures/method_calls/super/outside_method_body_with_explicit_arguments.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/super/outside_method_body_with_explicit_arguments.yaml @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -60,9 +60,9 @@ ast: | flags = 0 SuperCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false - flags = 0 + flags = 1 isSplatted = false lastArgIsNotHashProfile = false notEmptyKeywordsProfile = false diff --git a/spec/truffle/parsing/fixtures/method_calls/super/outside_method_body_without_explicit_arguments.yaml b/spec/truffle/parsing/fixtures/method_calls/super/outside_method_body_without_explicit_arguments.yaml index b3cab5c9f376..f83ff3b3fa51 100644 --- a/spec/truffle/parsing/fixtures/method_calls/super/outside_method_body_without_explicit_arguments.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/super/outside_method_body_without_explicit_arguments.yaml @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/method_calls/with_explicit_self_receiver.yaml b/spec/truffle/parsing/fixtures/method_calls/with_explicit_self_receiver.yaml index ec108613fb75..adc55e79fdab 100644 --- a/spec/truffle/parsing/fixtures/method_calls/with_explicit_self_receiver.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/with_explicit_self_receiver.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/method_calls/with_implicit_receiver.yaml b/spec/truffle/parsing/fixtures/method_calls/with_implicit_receiver.yaml index c42536f1445b..0b8c52881b7f 100644 --- a/spec/truffle/parsing/fixtures/method_calls/with_implicit_receiver.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/with_implicit_receiver.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/method_calls/with_safe_navigation.yaml b/spec/truffle/parsing/fixtures/method_calls/with_safe_navigation.yaml index 425aa4fed434..ac68dee55b3e 100644 --- a/spec/truffle/parsing/fixtures/method_calls/with_safe_navigation.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/with_safe_navigation.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/method_calls/without_arguments.yaml b/spec/truffle/parsing/fixtures/method_calls/without_arguments.yaml index a59f0da34b2a..a1e615a22b25 100644 --- a/spec/truffle/parsing/fixtures/method_calls/without_arguments.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/without_arguments.yaml @@ -6,7 +6,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/method_calls/without_arguments_with_paranthesis.yaml b/spec/truffle/parsing/fixtures/method_calls/without_arguments_with_paranthesis.yaml index bcc1edc7a1a8..2acbe1f3a69a 100644 --- a/spec/truffle/parsing/fixtures/method_calls/without_arguments_with_paranthesis.yaml +++ b/spec/truffle/parsing/fixtures/method_calls/without_arguments_with_paranthesis.yaml @@ -6,7 +6,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_following_argument.yaml b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_following_argument.yaml index 89f214e90617..cc1bb013fe33 100644 --- a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_following_argument.yaml +++ b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_following_argument.yaml @@ -33,7 +33,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_following_arguments.yaml b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_following_arguments.yaml index 59a2ba7a426a..d42d610f9cf6 100644 --- a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_following_arguments.yaml +++ b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_following_arguments.yaml @@ -34,7 +34,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_and_following_argument.yaml b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_and_following_argument.yaml index 7b32be5e0b99..fbb9844474a6 100644 --- a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_and_following_argument.yaml +++ b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_and_following_argument.yaml @@ -44,7 +44,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_and_following_arguments.yaml b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_and_following_arguments.yaml index 86209510eb49..bee8630acd9a 100644 --- a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_and_following_arguments.yaml +++ b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_and_following_arguments.yaml @@ -49,7 +49,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_argument.yaml b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_argument.yaml index 5c7c64b833cb..a9ea03e1425a 100644 --- a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_argument.yaml +++ b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_argument.yaml @@ -43,7 +43,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_arguments.yaml b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_arguments.yaml index 88fb51859c52..1f91f74603bd 100644 --- a/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_arguments.yaml +++ b/spec/truffle/parsing/fixtures/next/with_splat_operator_and_preceding_arguments.yaml @@ -47,7 +47,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/&&=/attribute_assignment.yaml b/spec/truffle/parsing/fixtures/operators/&&=/attribute_assignment.yaml index d4ca863277e4..f9cf252899b4 100644 --- a/spec/truffle/parsing/fixtures/operators/&&=/attribute_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/&&=/attribute_assignment.yaml @@ -25,12 +25,12 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %value_0 children: valueNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -54,7 +54,7 @@ ast: | left = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -71,12 +71,12 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %value_0 type = FRAME_LOCAL right = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -99,6 +99,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %value_0 type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/&&=/reference_assignment.yaml b/spec/truffle/parsing/fixtures/operators/&&=/reference_assignment.yaml index 2e131f555e10..adfa10915913 100644 --- a/spec/truffle/parsing/fixtures/operators/&&=/reference_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/&&=/reference_assignment.yaml @@ -21,7 +21,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -35,7 +35,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 children: valueNode = IntegerFixnumLiteralNode @@ -45,12 +45,12 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 children: valueNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -76,32 +76,32 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 type = FRAME_LOCAL rightNode_ = ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 type = FRAME_LOCAL right = InlinedIndexSetNodeGen attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 type = FRAME_LOCAL operand2Node_ = IntegerFixnumLiteralNode @@ -112,6 +112,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/&&=/reference_assignment_with_multiple_indexes.yaml b/spec/truffle/parsing/fixtures/operators/&&=/reference_assignment_with_multiple_indexes.yaml index 3cf1591f9eea..05965dcc8f95 100644 --- a/spec/truffle/parsing/fixtures/operators/&&=/reference_assignment_with_multiple_indexes.yaml +++ b/spec/truffle/parsing/fixtures/operators/&&=/reference_assignment_with_multiple_indexes.yaml @@ -23,7 +23,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -37,7 +37,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 children: valueNode = IntegerFixnumLiteralNode @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 4 + frameSlot = 4 # %value_2 children: valueNode = IntegerFixnumLiteralNode @@ -57,7 +57,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 5 + frameSlot = 5 # %value_3 children: valueNode = IntegerFixnumLiteralNode @@ -67,12 +67,12 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 children: valueNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -96,7 +96,7 @@ ast: | left = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -113,29 +113,29 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 type = FRAME_LOCAL ReadLocalVariableNode attributes: flags = 0 - frameSlot = 4 + frameSlot = 4 # %value_2 type = FRAME_LOCAL ReadLocalVariableNode attributes: flags = 0 - frameSlot = 5 + frameSlot = 5 # %value_3 type = FRAME_LOCAL ] receiver = ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 type = FRAME_LOCAL right = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -152,17 +152,17 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 type = FRAME_LOCAL ReadLocalVariableNode attributes: flags = 0 - frameSlot = 4 + frameSlot = 4 # %value_2 type = FRAME_LOCAL ReadLocalVariableNode attributes: flags = 0 - frameSlot = 5 + frameSlot = 5 # %value_3 type = FRAME_LOCAL IntegerFixnumLiteralNode attributes: @@ -173,6 +173,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/&&=/variable_assignments/instance_variable.yaml b/spec/truffle/parsing/fixtures/operators/&&=/variable_assignments/instance_variable.yaml index 3430f86c9fc9..1e2bf6c5c3cc 100644 --- a/spec/truffle/parsing/fixtures/operators/&&=/variable_assignments/instance_variable.yaml +++ b/spec/truffle/parsing/fixtures/operators/&&=/variable_assignments/instance_variable.yaml @@ -25,7 +25,7 @@ ast: | readSelfSlotNode = ReadFrameSlotNodeGen attributes: - frameSlot = 0 + frameSlot = 0 # (self) right = WriteInstanceVariableNodeGen attributes: @@ -36,7 +36,7 @@ ast: | readSelfSlotNode = ReadFrameSlotNodeGen attributes: - frameSlot = 0 + frameSlot = 0 # (self) rhs = IntegerFixnumLiteralNode attributes: diff --git a/spec/truffle/parsing/fixtures/operators/&&=/variable_assignments/local_variable.yaml b/spec/truffle/parsing/fixtures/operators/&&=/variable_assignments/local_variable.yaml index 6e6a3d611197..2456d810c8a4 100644 --- a/spec/truffle/parsing/fixtures/operators/&&=/variable_assignments/local_variable.yaml +++ b/spec/truffle/parsing/fixtures/operators/&&=/variable_assignments/local_variable.yaml @@ -20,13 +20,13 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # foo type = FRAME_LOCAL right = WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # foo children: valueNode = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/operators/+=/attribute_assignment.yaml b/spec/truffle/parsing/fixtures/operators/+=/attribute_assignment.yaml new file mode 100644 index 000000000000..bc7951aa6772 --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/attribute_assignment.yaml @@ -0,0 +1,114 @@ +subject: "+=" +description: "Assign an attribute local variable (a.b += c)" +notes: > + `a.b += c` is translated into `a.b = a.b + c` in the following way: + + ```ruby + temp_receiver = a + temp_receiver.b = temp_receiver.b + c + ``` +focused_on_node: "org.truffleruby.language.control.SequenceNode" +ruby: | + a.foo += 42 +ast: | + SequenceNode + attributes: + flags = 12 + children: + body = [ + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 0 # (self) + children: + valueNode = + ProfileArgumentNodeGen + attributes: + flags = 0 + children: + childNode_ = + ReadSelfNode + attributes: + flags = 0 + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %value_0 + children: + valueNode = + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PRIVATE + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = true + lastArgIsNotHashProfile = false + methodName = "a" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + receiver = + SelfNode + attributes: + flags = 0 + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PROTECTED + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = false + lastArgIsNotHashProfile = false + methodName = "foo=" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + arguments = [ + InlinedAddNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] + flags = 0 + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PROTECTED + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = false + lastArgIsNotHashProfile = false + methodName = "foo" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + receiver = + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %value_0 + type = FRAME_LOCAL + rightNode_ = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 42 + ] + receiver = + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %value_0 + type = FRAME_LOCAL + ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/+=/reference_assignment.yaml b/spec/truffle/parsing/fixtures/operators/+=/reference_assignment.yaml new file mode 100644 index 000000000000..422ec2bce45f --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/reference_assignment.yaml @@ -0,0 +1,119 @@ +subject: "+=" +description: "Assign an referenced element (a[b] += c)" +notes: > + `a[b] += c` is translated into `a[b] = a[b] + c` in the following way: + + ```ruby + temp_arg1 = b + temp_receiver = a + + temp_receiver[temp_arg1] = temp_receiver[temp_arg1] + c + ``` +focused_on_node: "org.truffleruby.language.control.SequenceNode" +ruby: | + foo[42] += 100500 +ast: | + SequenceNode + attributes: + flags = 12 + children: + body = [ + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 0 # (self) + children: + valueNode = + ProfileArgumentNodeGen + attributes: + flags = 0 + children: + childNode_ = + ReadSelfNode + attributes: + flags = 0 + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 3 # %value_1 + children: + valueNode = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 42 + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %opelementassign_0 + children: + valueNode = + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PRIVATE + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = true + lastArgIsNotHashProfile = false + methodName = "foo" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + receiver = + SelfNode + attributes: + flags = 0 + InlinedIndexSetNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used)] + flags = 0 + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} + children: + operand1Node_ = + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 3 # %value_1 + type = FRAME_LOCAL + operand2Node_ = + InlinedAddNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] + flags = 1 + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + InlinedIndexGetNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used)] + flags = 0 + parameters = RubyCallNodeParameters{methodName='[]', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %opelementassign_0 + type = FRAME_LOCAL + rightNode_ = + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 3 # %value_1 + type = FRAME_LOCAL + rightNode_ = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 100500 + receiver_ = + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %opelementassign_0 + type = FRAME_LOCAL + ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/+=/reference_assignment_with_multiple_indexes.yaml b/spec/truffle/parsing/fixtures/operators/+=/reference_assignment_with_multiple_indexes.yaml new file mode 100644 index 000000000000..e3c658db70a4 --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/reference_assignment_with_multiple_indexes.yaml @@ -0,0 +1,180 @@ +subject: "+=" +description: "Assign an element referenced with multiple indexes (a[b, c, d] += e)" +notes: > + `a[b, c, d] += e` is translated into `a[b, c, d] = a[b, c, d] + e` in the following way: + + ```ruby + temp_arg1 = b + temp_arg2 = c + temp_arg3 = d + temp_receiver = a + + temp_receiver[temp_arg1] = temp_receiver[temp_arg1] + c + ``` +focused_on_node: "org.truffleruby.language.control.SequenceNode" +ruby: | + foo[42, 43, 44] += 100500 +ast: | + SequenceNode + attributes: + flags = 12 + children: + body = [ + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 0 # (self) + children: + valueNode = + ProfileArgumentNodeGen + attributes: + flags = 0 + children: + childNode_ = + ReadSelfNode + attributes: + flags = 0 + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 3 # %value_1 + children: + valueNode = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 42 + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 4 # %value_2 + children: + valueNode = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 43 + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 5 # %value_3 + children: + valueNode = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 44 + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %opelementassign_0 + children: + valueNode = + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PRIVATE + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = true + lastArgIsNotHashProfile = false + methodName = "foo" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + receiver = + SelfNode + attributes: + flags = 0 + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PROTECTED + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = true + isSafeNavigation = false + isSplatted = false + isVCall = false + lastArgIsNotHashProfile = false + methodName = "[]=" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + arguments = [ + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 3 # %value_1 + type = FRAME_LOCAL + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 4 # %value_2 + type = FRAME_LOCAL + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 5 # %value_3 + type = FRAME_LOCAL + InlinedAddNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] + flags = 1 + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + RubyCallNode + attributes: + descriptor = NoKeywordArgumentsDescriptor + dispatchConfig = PROTECTED + emptyKeywordsProfile = false + flags = 0 + isAttrAssign = false + isSafeNavigation = false + isSplatted = false + isVCall = false + lastArgIsNotHashProfile = false + methodName = "[]" + notEmptyKeywordsProfile = false + notRuby2KeywordsHashProfile = false + children: + arguments = [ + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 3 # %value_1 + type = FRAME_LOCAL + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 4 # %value_2 + type = FRAME_LOCAL + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 5 # %value_3 + type = FRAME_LOCAL + ] + receiver = + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %opelementassign_0 + type = FRAME_LOCAL + rightNode_ = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 100500 + ] + receiver = + ReadLocalVariableNode + attributes: + flags = 0 + frameSlot = 2 # %opelementassign_0 + type = FRAME_LOCAL + ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/class_variable.yaml b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/class_variable.yaml new file mode 100644 index 000000000000..1fa243d745ab --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/class_variable.yaml @@ -0,0 +1,49 @@ +subject: "+=" +description: "Variable assignment/class variable (@@a += b)" +notes: > + `@@a += b` is translated into `@@a = @@a + b` +focused_on_node: "org.truffleruby.language.objects.classvariables.WriteClassVariableNode" +ruby: | + @@foo += 42 +ast: | + WriteClassVariableNode + attributes: + flags = 0 + name = "@@foo" + children: + lexicalScopeNode = + ObjectLiteralNode + attributes: + flags = 0 + object = :: Object + resolveTargetModuleNode = + ResolveTargetModuleForClassVariablesNodeGen + rhs = + InlinedAddNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] + flags = 0 + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + ReadClassVariableNode + attributes: + flags = 0 + name = "@@foo" + children: + lexicalScopeNode = + ObjectLiteralNode + attributes: + flags = 0 + object = :: Object + lookupClassVariableNode = + LookupClassVariableNodeGen + resolveTargetModuleNode = + ResolveTargetModuleForClassVariablesNodeGen + rightNode_ = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 42 + setClassVariableNode = + SetClassVariableNodeGen \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/constant.yaml b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/constant.yaml new file mode 100644 index 000000000000..0bb4db22eea1 --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/constant.yaml @@ -0,0 +1,44 @@ +subject: "+=" +description: "Variable assignment/constant (A += b)" +notes: > + `A += b` is translated into `A = A + b` +focused_on_node: "org.truffleruby.language.constants.WriteConstantNode" +ruby: | + FOO += 42 +ast: | + WriteConstantNode + attributes: + flags = 1 + name = "FOO" + children: + moduleNode = + LexicalScopeNode + attributes: + flags = 0 + lexicalScope = :: Object + valueNode = + InlinedAddNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] + flags = 0 + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + ReadConstantWithLexicalScopeNode + attributes: + flags = 0 + lexicalScope = :: Object + name = "FOO" + children: + getConstantNode = + GetConstantNodeGen + lookupConstantNode = + LookupConstantWithLexicalScopeNodeGen + attributes: + lexicalScope = :: Object + name = "FOO" + rightNode_ = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 42 \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/constant_fully_qualified.yaml b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/constant_fully_qualified.yaml new file mode 100644 index 000000000000..227353a7af2f --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/constant_fully_qualified.yaml @@ -0,0 +1,49 @@ +subject: "+=" +description: "Variable assignment/fully qualified constant (::A += b)" +notes: > + `::A += b` is translated into `::A = ::A + b` +focused_on_node: "org.truffleruby.language.constants.WriteConstantNode" +ruby: | + ::FOO += 42 +ast: | + WriteConstantNode + attributes: + flags = 1 + name = "FOO" + children: + moduleNode = + ObjectClassLiteralNode + attributes: + flags = 0 + valueNode = + InlinedAddNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] + flags = 0 + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + ReadConstantNode + attributes: + flags = 0 + name = "FOO" + children: + moduleNode = + ObjectClassLiteralNode + attributes: + flags = 0 + rightNode_ = + WriteConstantNode + attributes: + flags = 0 + name = "FOO" + children: + moduleNode = + ObjectClassLiteralNode + attributes: + flags = 0 + valueNode = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 42 \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/global_variable.yaml b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/global_variable.yaml new file mode 100644 index 000000000000..815fb325414c --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/global_variable.yaml @@ -0,0 +1,41 @@ +subject: "+=" +description: "Variable assignment/global variable ($a += b)" +notes: > + `$a += b` is translated into `$a = $a + b` +focused_on_node: "org.truffleruby.language.globals.WriteGlobalVariableNodeGen" +ruby: | + $foo += 42 +ast: | + WriteGlobalVariableNodeGen + attributes: + flags = 0 + name = "$foo" + children: + lookupGlobalVariableStorageNode = + LookupGlobalVariableStorageNodeGen + attributes: + index = -1 + name = "$foo" + valueNode_ = + InlinedAddNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] + flags = 0 + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + ReadGlobalVariableNodeGen + attributes: + flags = 0 + name = "$foo" + children: + lookupGlobalVariableStorageNode = + LookupGlobalVariableStorageNodeGen + attributes: + index = -1 + name = "$foo" + rightNode_ = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 42 \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/instance_variable.yaml b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/instance_variable.yaml new file mode 100644 index 000000000000..444b009a5c49 --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/instance_variable.yaml @@ -0,0 +1,40 @@ +subject: "+=" +description: "Variable assignment/instance variable (@a += b)" +notes: > + `@a += b` is translated into `@a = @a + b` +focused_on_node: "org.truffleruby.language.objects.WriteInstanceVariableNodeGen" +ruby: | + @foo += 42 +ast: | + WriteInstanceVariableNodeGen + attributes: + flags = 0 + frozenProfile = false + name = "@foo" + children: + readSelfSlotNode = + ReadFrameSlotNodeGen + attributes: + frameSlot = 0 # (self) + rhs = + InlinedAddNodeGen + attributes: + assumptions = [Assumption(valid, name=set_trace_func is not used), Assumption(valid, name=inlined Integer#+), Assumption(valid, name=inlined Float#+)] + flags = 0 + parameters = RubyCallNodeParameters{methodName='+', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} + children: + leftNode_ = + ReadInstanceVariableNode + attributes: + flags = 0 + name = "@foo" + children: + readSelfSlotNode = + ReadFrameSlotNodeGen + attributes: + frameSlot = 0 # (self) + rightNode_ = + IntegerFixnumLiteralNode + attributes: + flags = 0 + value = 42 \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/local_variable.yaml b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/local_variable.yaml new file mode 100644 index 000000000000..cc54727ec30b --- /dev/null +++ b/spec/truffle/parsing/fixtures/operators/+=/variable_assignments/local_variable.yaml @@ -0,0 +1,22 @@ +subject: "+=" +description: "Variable assignment/local variable (a += b)" +notes: > + `a += b` is translated into `a = a + b` +focused_on_node: "org.truffleruby.language.locals.WriteLocalVariableNode" +ruby: | + foo += 42 +ast: | + WriteLocalVariableNode + attributes: + flags = 0 + frameSlot = 0 # (self) + children: + valueNode = + ProfileArgumentNodeGen + attributes: + flags = 0 + children: + childNode_ = + ReadSelfNode + attributes: + flags = 0 \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/flip_flop_operator/in_block.yaml b/spec/truffle/parsing/fixtures/operators/flip_flop_operator/in_block.yaml index fe076f3da640..dd4d3924ec47 100644 --- a/spec/truffle/parsing/fixtures/operators/flip_flop_operator/in_block.yaml +++ b/spec/truffle/parsing/fixtures/operators/flip_flop_operator/in_block.yaml @@ -81,7 +81,7 @@ ast: | child = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/match/=~.yaml b/spec/truffle/parsing/fixtures/operators/match/=~.yaml index c27419400dcb..24e9203daa6a 100644 --- a/spec/truffle/parsing/fixtures/operators/match/=~.yaml +++ b/spec/truffle/parsing/fixtures/operators/match/=~.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 1 @@ -24,7 +24,7 @@ ast: | arguments = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -45,7 +45,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_as_argument.yaml b/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_as_argument.yaml index 2c941c7acf4d..f948d33d05c1 100644 --- a/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_as_argument.yaml +++ b/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_as_argument.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 1 @@ -30,7 +30,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_as_receiver.yaml b/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_as_receiver.yaml index 5bf4d694cab8..6a9232d62815 100644 --- a/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_as_receiver.yaml +++ b/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_as_receiver.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 1 @@ -24,7 +24,7 @@ ast: | arguments = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_without_interpolation_with_named_capture_groups_as_receiver.yaml b/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_without_interpolation_with_named_capture_groups_as_receiver.yaml index bc503705c7b1..2f565b17f090 100644 --- a/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_without_interpolation_with_named_capture_groups_as_receiver.yaml +++ b/spec/truffle/parsing/fixtures/operators/match/=~_with_regexp_without_interpolation_with_named_capture_groups_as_receiver.yaml @@ -14,7 +14,7 @@ ast: | matchDataNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 1 @@ -43,7 +43,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # bar children: valueNode = NilLiteralNode @@ -54,7 +54,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %match_data_0 children: valueNode = ReadGlobalVariableNodeGen @@ -71,7 +71,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # bar children: valueNode = MatchDataNodes$GetFixedNameMatchNode @@ -88,6 +88,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %match_data_0 type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_attribute_assignment.yaml b/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_attribute_assignment.yaml index f5ff5145d6a3..546f6ff4b168 100644 --- a/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_attribute_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_attribute_assignment.yaml @@ -18,7 +18,7 @@ ast: | preNodes = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -39,7 +39,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_nested_reference_assignment.yaml b/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_nested_reference_assignment.yaml index a0b31797298e..623a583f1e8b 100644 --- a/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_nested_reference_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_nested_reference_assignment.yaml @@ -20,7 +20,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = ObjectLiteralNode @@ -36,12 +36,12 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_reference_assignment.yaml b/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_reference_assignment.yaml index b051de1b44ce..2043b6befea6 100644 --- a/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_reference_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_reference_assignment.yaml @@ -20,7 +20,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = ObjectLiteralNode @@ -34,7 +34,7 @@ ast: | receiver_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_reference_assignment_and_multiple_explicit_arguments.yaml b/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_reference_assignment_and_multiple_explicit_arguments.yaml index e485d48bbd71..66315b0336dc 100644 --- a/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_reference_assignment_and_multiple_explicit_arguments.yaml +++ b/spec/truffle/parsing/fixtures/operators/multi_assignments/nested_multi_assignment/when_reference_assignment_and_multiple_explicit_arguments.yaml @@ -18,7 +18,7 @@ ast: | preNodes = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -47,7 +47,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/multi_assignments/when_attribute_assignment.yaml b/spec/truffle/parsing/fixtures/operators/multi_assignments/when_attribute_assignment.yaml index 4a3c89a181eb..14881b6d1a77 100644 --- a/spec/truffle/parsing/fixtures/operators/multi_assignments/when_attribute_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/multi_assignments/when_attribute_assignment.yaml @@ -14,7 +14,7 @@ ast: | preNodes = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -35,7 +35,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/multi_assignments/when_nested_reference_assignment.yaml b/spec/truffle/parsing/fixtures/operators/multi_assignments/when_nested_reference_assignment.yaml index c53ffd99f96e..33f407e748cd 100644 --- a/spec/truffle/parsing/fixtures/operators/multi_assignments/when_nested_reference_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/multi_assignments/when_nested_reference_assignment.yaml @@ -16,7 +16,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = ObjectLiteralNode @@ -32,12 +32,12 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/multi_assignments/when_reference_assignment.yaml b/spec/truffle/parsing/fixtures/operators/multi_assignments/when_reference_assignment.yaml index 137ccc475842..1858f73ffd97 100644 --- a/spec/truffle/parsing/fixtures/operators/multi_assignments/when_reference_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/multi_assignments/when_reference_assignment.yaml @@ -16,7 +16,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = ObjectLiteralNode @@ -30,7 +30,7 @@ ast: | receiver_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/multi_assignments/when_reference_assignment_and_multiple_explicit_arguments.yaml b/spec/truffle/parsing/fixtures/operators/multi_assignments/when_reference_assignment_and_multiple_explicit_arguments.yaml index 296849be7da3..4a7e841e6794 100644 --- a/spec/truffle/parsing/fixtures/operators/multi_assignments/when_reference_assignment_and_multiple_explicit_arguments.yaml +++ b/spec/truffle/parsing/fixtures/operators/multi_assignments/when_reference_assignment_and_multiple_explicit_arguments.yaml @@ -14,7 +14,7 @@ ast: | preNodes = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -43,7 +43,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/operators/parentheses/empty.yaml b/spec/truffle/parsing/fixtures/operators/parentheses/empty.yaml index 77f40a1663a1..07635da1ce84 100644 --- a/spec/truffle/parsing/fixtures/operators/parentheses/empty.yaml +++ b/spec/truffle/parsing/fixtures/operators/parentheses/empty.yaml @@ -18,7 +18,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/operators/parentheses/with_multiple_expressions.yaml b/spec/truffle/parsing/fixtures/operators/parentheses/with_multiple_expressions.yaml index 7649fb58dfb8..87497f350468 100644 --- a/spec/truffle/parsing/fixtures/operators/parentheses/with_multiple_expressions.yaml +++ b/spec/truffle/parsing/fixtures/operators/parentheses/with_multiple_expressions.yaml @@ -18,7 +18,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/operators/parentheses/with_single_expression.yaml b/spec/truffle/parsing/fixtures/operators/parentheses/with_single_expression.yaml index ee90ef5e06c9..64aec0650f0f 100644 --- a/spec/truffle/parsing/fixtures/operators/parentheses/with_single_expression.yaml +++ b/spec/truffle/parsing/fixtures/operators/parentheses/with_single_expression.yaml @@ -18,7 +18,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/operators/||=/attribute_assignment.yaml b/spec/truffle/parsing/fixtures/operators/||=/attribute_assignment.yaml index 494e901be662..ab6b7a1048d5 100644 --- a/spec/truffle/parsing/fixtures/operators/||=/attribute_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/||=/attribute_assignment.yaml @@ -25,12 +25,12 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %value_0 children: valueNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -54,7 +54,7 @@ ast: | left = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -71,12 +71,12 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %value_0 type = FRAME_LOCAL right = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -99,6 +99,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %value_0 type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/||=/reference_assignment.yaml b/spec/truffle/parsing/fixtures/operators/||=/reference_assignment.yaml index 743e74b0c0dd..faed1541dd4b 100644 --- a/spec/truffle/parsing/fixtures/operators/||=/reference_assignment.yaml +++ b/spec/truffle/parsing/fixtures/operators/||=/reference_assignment.yaml @@ -21,7 +21,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -35,7 +35,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 children: valueNode = IntegerFixnumLiteralNode @@ -45,12 +45,12 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 children: valueNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -76,32 +76,32 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 type = FRAME_LOCAL rightNode_ = ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 type = FRAME_LOCAL right = InlinedIndexSetNodeGen attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 type = FRAME_LOCAL operand2Node_ = IntegerFixnumLiteralNode @@ -112,6 +112,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/||=/reference_assignment_with_multiple_indexes.yaml b/spec/truffle/parsing/fixtures/operators/||=/reference_assignment_with_multiple_indexes.yaml index 7ef267f03b61..9738cd182b68 100644 --- a/spec/truffle/parsing/fixtures/operators/||=/reference_assignment_with_multiple_indexes.yaml +++ b/spec/truffle/parsing/fixtures/operators/||=/reference_assignment_with_multiple_indexes.yaml @@ -23,7 +23,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -37,7 +37,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 children: valueNode = IntegerFixnumLiteralNode @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 4 + frameSlot = 4 # %value_2 children: valueNode = IntegerFixnumLiteralNode @@ -57,7 +57,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 5 + frameSlot = 5 # %value_3 children: valueNode = IntegerFixnumLiteralNode @@ -67,12 +67,12 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 children: valueNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -96,7 +96,7 @@ ast: | left = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -113,29 +113,29 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 type = FRAME_LOCAL ReadLocalVariableNode attributes: flags = 0 - frameSlot = 4 + frameSlot = 4 # %value_2 type = FRAME_LOCAL ReadLocalVariableNode attributes: flags = 0 - frameSlot = 5 + frameSlot = 5 # %value_3 type = FRAME_LOCAL ] receiver = ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 type = FRAME_LOCAL right = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -152,17 +152,17 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 3 + frameSlot = 3 # %value_1 type = FRAME_LOCAL ReadLocalVariableNode attributes: flags = 0 - frameSlot = 4 + frameSlot = 4 # %value_2 type = FRAME_LOCAL ReadLocalVariableNode attributes: flags = 0 - frameSlot = 5 + frameSlot = 5 # %value_3 type = FRAME_LOCAL IntegerFixnumLiteralNode attributes: @@ -173,6 +173,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %opelementassign_0 type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/operators/||=/variable_assignments/instance_variable.yaml b/spec/truffle/parsing/fixtures/operators/||=/variable_assignments/instance_variable.yaml index c517e0c5a87c..045a0fcfa493 100644 --- a/spec/truffle/parsing/fixtures/operators/||=/variable_assignments/instance_variable.yaml +++ b/spec/truffle/parsing/fixtures/operators/||=/variable_assignments/instance_variable.yaml @@ -20,7 +20,7 @@ ast: | readSelfSlotNode = ReadFrameSlotNodeGen attributes: - frameSlot = 0 + frameSlot = 0 # (self) right = WriteInstanceVariableNodeGen attributes: @@ -31,7 +31,7 @@ ast: | readSelfSlotNode = ReadFrameSlotNodeGen attributes: - frameSlot = 0 + frameSlot = 0 # (self) rhs = IntegerFixnumLiteralNode attributes: diff --git a/spec/truffle/parsing/fixtures/operators/||=/variable_assignments/local_variable.yaml b/spec/truffle/parsing/fixtures/operators/||=/variable_assignments/local_variable.yaml index f8dbf3dbd146..45233373b68c 100644 --- a/spec/truffle/parsing/fixtures/operators/||=/variable_assignments/local_variable.yaml +++ b/spec/truffle/parsing/fixtures/operators/||=/variable_assignments/local_variable.yaml @@ -15,13 +15,13 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # foo type = FRAME_LOCAL right = WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # foo children: valueNode = IntegerFixnumLiteralNode diff --git a/spec/truffle/parsing/fixtures/ranges/endless_range.yaml b/spec/truffle/parsing/fixtures/ranges/endless_range.yaml index 7eff7fadd5a0..bcdadafc2498 100644 --- a/spec/truffle/parsing/fixtures/ranges/endless_range.yaml +++ b/spec/truffle/parsing/fixtures/ranges/endless_range.yaml @@ -17,4 +17,4 @@ ast: | endNode_ = NilLiteralNode attributes: - flags = 0 + flags = 0 \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/rational_numbers/with_big_integer_value.yaml b/spec/truffle/parsing/fixtures/rational_numbers/with_big_integer_value.yaml index 5a0d9367fb7a..8045fb41fd29 100644 --- a/spec/truffle/parsing/fixtures/rational_numbers/with_big_integer_value.yaml +++ b/spec/truffle/parsing/fixtures/rational_numbers/with_big_integer_value.yaml @@ -8,7 +8,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/rational_numbers/with_float_point_value.yaml b/spec/truffle/parsing/fixtures/rational_numbers/with_float_point_value.yaml index 6b71fed3ce5d..f82210118e37 100644 --- a/spec/truffle/parsing/fixtures/rational_numbers/with_float_point_value.yaml +++ b/spec/truffle/parsing/fixtures/rational_numbers/with_float_point_value.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/rational_numbers/with_integer_value.yaml b/spec/truffle/parsing/fixtures/rational_numbers/with_integer_value.yaml index dc1a08149605..adfe2cc2b303 100644 --- a/spec/truffle/parsing/fixtures/rational_numbers/with_integer_value.yaml +++ b/spec/truffle/parsing/fixtures/rational_numbers/with_integer_value.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/rational_numbers/with_negative_value.yaml b/spec/truffle/parsing/fixtures/rational_numbers/with_negative_value.yaml index e4f5bfbd9d8f..7c7f0853a69b 100644 --- a/spec/truffle/parsing/fixtures/rational_numbers/with_negative_value.yaml +++ b/spec/truffle/parsing/fixtures/rational_numbers/with_negative_value.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/regexps/in_boolean_context.yaml b/spec/truffle/parsing/fixtures/regexps/in_boolean_context.yaml index 3f1f41dcf672..ea2c2e35d031 100644 --- a/spec/truffle/parsing/fixtures/regexps/in_boolean_context.yaml +++ b/spec/truffle/parsing/fixtures/regexps/in_boolean_context.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/regexps/in_boolean_context_with_interpolation.yaml b/spec/truffle/parsing/fixtures/regexps/in_boolean_context_with_interpolation.yaml index 52965e5ff52c..5dcf6af98126 100644 --- a/spec/truffle/parsing/fixtures/regexps/in_boolean_context_with_interpolation.yaml +++ b/spec/truffle/parsing/fixtures/regexps/in_boolean_context_with_interpolation.yaml @@ -12,7 +12,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 1 @@ -74,7 +74,7 @@ ast: | valueNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/regexps/with_interpolation.yaml b/spec/truffle/parsing/fixtures/regexps/with_interpolation.yaml index 83d5eae04caa..b5e4a0480266 100644 --- a/spec/truffle/parsing/fixtures/regexps/with_interpolation.yaml +++ b/spec/truffle/parsing/fixtures/regexps/with_interpolation.yaml @@ -1,12 +1,13 @@ subject: "Regexp" description: "a literal with interpolation (with #{...})" +yarp_specific: true # there is an extra "" StringLiteralNode with old translator focused_on_node: "org.truffleruby.core.regexp.InterpolatedRegexpNode" ruby: | /a#{ 42 }c/ ast: | InterpolatedRegexpNode attributes: - flags = 1 + flags = 0 rubyStringLibrary = org.truffleruby.language.library.RubyStringLibrary$Cached@... children: asTruffleStringNode = @@ -14,33 +15,25 @@ ast: | builderNode = InterpolatedRegexpNodeFactory$RegexpBuilderNodeGen attributes: - options = RegexpOptions(kcode: NONE, kcodeDefault) + options = RegexpOptions(kcode: NONE, kcodeDefault, literal) children: equalNode = TruffleStringFactory$EqualNodeGen children = [ - ToSNodeGen - children: - valueNode_ = - StringLiteralNode - attributes: - encoding = ASCII-8BIT - flags = 0 - tstring = "" ToSNodeGen children: valueNode_ = StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = a ToSNodeGen children: valueNode_ = IntegerFixnumLiteralNode attributes: - flags = 1 + flags = 0 value = 42 ToSNodeGen children: diff --git a/spec/truffle/parsing/fixtures/regexps/with_interpolation_without_expression.yaml b/spec/truffle/parsing/fixtures/regexps/with_interpolation_without_expression.yaml index 4f78ea0446d3..7faf3e5c3586 100644 --- a/spec/truffle/parsing/fixtures/regexps/with_interpolation_without_expression.yaml +++ b/spec/truffle/parsing/fixtures/regexps/with_interpolation_without_expression.yaml @@ -3,13 +3,14 @@ description: "a literal with interpolation but without expression (#{})" notes: > An empty expression is represented as a frozen empty string with (ObjectLiteralNode object = '') node. +yarp_specific: true # there is an extra "" StringLiteralNode with old translator focused_on_node: "org.truffleruby.core.regexp.InterpolatedRegexpNode" ruby: | /a#{}c/ ast: | InterpolatedRegexpNode attributes: - flags = 1 + flags = 0 rubyStringLibrary = org.truffleruby.language.library.RubyStringLibrary$Cached@... children: asTruffleStringNode = @@ -17,26 +18,18 @@ ast: | builderNode = InterpolatedRegexpNodeFactory$RegexpBuilderNodeGen attributes: - options = RegexpOptions(kcode: NONE, kcodeDefault) + options = RegexpOptions(kcode: NONE, kcodeDefault, literal) children: equalNode = TruffleStringFactory$EqualNodeGen children = [ - ToSNodeGen - children: - valueNode_ = - StringLiteralNode - attributes: - encoding = ASCII-8BIT - flags = 0 - tstring = "" ToSNodeGen children: valueNode_ = StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = a ToSNodeGen children: diff --git a/spec/truffle/parsing/fixtures/regexps/with_options.yaml b/spec/truffle/parsing/fixtures/regexps/with_options.yaml index fa889fb11e87..e1dac6e5b297 100644 --- a/spec/truffle/parsing/fixtures/regexps/with_options.yaml +++ b/spec/truffle/parsing/fixtures/regexps/with_options.yaml @@ -1,8 +1,8 @@ subject: "Regexp" -description: "a literal with options (e.g. i, x, m, o)" +description: "a literal with options (e.g. i, x, m)" focused_on_node: "org.truffleruby.language.literal.ObjectLiteralNode" ruby: | - /abc/ixmo + /abc/ixm ast: | ObjectLiteralNode attributes: diff --git a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_method_call.yaml b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_method_call.yaml index ed4e998c9d07..2660bf6efba0 100644 --- a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_method_call.yaml +++ b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_method_call.yaml @@ -26,7 +26,7 @@ ast: | rescueBody = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_range.yaml b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_range.yaml index 8067af9c20d2..678d0dfac6a0 100644 --- a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_range.yaml +++ b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_range.yaml @@ -26,12 +26,12 @@ ast: | rescueBody = ObjectLiteralNode attributes: - flags = 0 + flags = 1 object = org.truffleruby.core.range.RubyIntRange@...(begin = 0, end = 42, excludedEnd = false) ] tryPart = StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = foo \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_regexp.yaml b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_regexp.yaml index dd681d23bd17..073e7f5e4f72 100644 --- a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_regexp.yaml +++ b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/disabled/when_regexp.yaml @@ -26,12 +26,12 @@ ast: | rescueBody = ObjectLiteralNode attributes: - flags = 0 + flags = 1 object = RubyRegexp(source = bar, options = RegexpOptions(kcode: NONE, kcodeDefault, literal), encoding = US-ASCII) ] tryPart = StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = foo \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_complex_literal.yaml b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_complex_literal.yaml index 194306e214bd..1bd7e510f3ae 100644 --- a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_complex_literal.yaml +++ b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_complex_literal.yaml @@ -26,7 +26,7 @@ ast: | rescueBody = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_file_constant.yaml b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_file_constant.yaml index 987b044ae490..d01964523df1 100644 --- a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_file_constant.yaml +++ b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_file_constant.yaml @@ -27,12 +27,12 @@ ast: | StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = ] tryPart = StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = foo \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml index fe4151e08c8b..4f389e64e0d1 100644 --- a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml +++ b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -61,7 +61,7 @@ ast: | TryNodeGen attributes: canOmitBacktrace = true - flags = 1 + flags = 0 children: rescueParts = [ RescueStandardErrorNode @@ -71,7 +71,7 @@ ast: | rescueBody = ReadDeclarationVariableNode attributes: - flags = 0 + flags = 1 frameDepth = 1 frameSlot = 2 type = FRAME_LOCAL @@ -80,6 +80,6 @@ ast: | StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = foo ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_rational_literal.yaml b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_rational_literal.yaml index af4a0fb7d0d1..ab08445b16cf 100644 --- a/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_rational_literal.yaml +++ b/spec/truffle/parsing/fixtures/rescue/backtrace_optimization/enabled/when_rational_literal.yaml @@ -26,7 +26,7 @@ ast: | rescueBody = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/rescue/capturing/with_attribute.yaml b/spec/truffle/parsing/fixtures/rescue/capturing/with_attribute.yaml index abdb719213cc..b093d606416f 100644 --- a/spec/truffle/parsing/fixtures/rescue/capturing/with_attribute.yaml +++ b/spec/truffle/parsing/fixtures/rescue/capturing/with_attribute.yaml @@ -63,7 +63,7 @@ ast: | rescueVariableNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -84,7 +84,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/rescue/capturing/with_element_reference.yaml b/spec/truffle/parsing/fixtures/rescue/capturing/with_element_reference.yaml index 72deca9705e7..890fbc6b502a 100644 --- a/spec/truffle/parsing/fixtures/rescue/capturing/with_element_reference.yaml +++ b/spec/truffle/parsing/fixtures/rescue/capturing/with_element_reference.yaml @@ -66,7 +66,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = ObjectLiteralNode @@ -80,7 +80,7 @@ ast: | receiver_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/rescue/capturing/with_element_reference_and_multiple_explicit_arguments.yaml b/spec/truffle/parsing/fixtures/rescue/capturing/with_element_reference_and_multiple_explicit_arguments.yaml index 309f75af0213..380e0b35cced 100644 --- a/spec/truffle/parsing/fixtures/rescue/capturing/with_element_reference_and_multiple_explicit_arguments.yaml +++ b/spec/truffle/parsing/fixtures/rescue/capturing/with_element_reference_and_multiple_explicit_arguments.yaml @@ -49,7 +49,7 @@ ast: | rescueVariableNode = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 @@ -78,7 +78,7 @@ ast: | receiver = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/rescue/capturing/with_nested_element_reference.yaml b/spec/truffle/parsing/fixtures/rescue/capturing/with_nested_element_reference.yaml index e8e954422bc4..76eb3643dd6a 100644 --- a/spec/truffle/parsing/fixtures/rescue/capturing/with_nested_element_reference.yaml +++ b/spec/truffle/parsing/fixtures/rescue/capturing/with_nested_element_reference.yaml @@ -51,7 +51,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]=', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=true} children: operand1Node_ = ObjectLiteralNode @@ -67,12 +67,12 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='[]', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=false, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: leftNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/rescue/in_method.yaml b/spec/truffle/parsing/fixtures/rescue/in_method.yaml index 259d2451f398..007378638719 100644 --- a/spec/truffle/parsing/fixtures/rescue/in_method.yaml +++ b/spec/truffle/parsing/fixtures/rescue/in_method.yaml @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/disabled/when_method_call.yaml b/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/disabled/when_method_call.yaml index 237bb214a709..26c9e5957b45 100644 --- a/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/disabled/when_method_call.yaml +++ b/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/disabled/when_method_call.yaml @@ -22,7 +22,7 @@ ast: | rescueBody = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_complex_literal.yaml b/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_complex_literal.yaml index 14d569a1dbc0..500ba190b8c8 100644 --- a/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_complex_literal.yaml +++ b/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_complex_literal.yaml @@ -22,7 +22,7 @@ ast: | rescueBody = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml b/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml index 20b7a797049b..7b11e788c939 100644 --- a/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml +++ b/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_local_variable_defined_in_outer_scope.yaml @@ -45,7 +45,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_rational_literal.yaml b/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_rational_literal.yaml index c17dfba00d7d..564b29803730 100644 --- a/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_rational_literal.yaml +++ b/spec/truffle/parsing/fixtures/rescue/modifier/backtrace_optimization/enabled/when_rational_literal.yaml @@ -22,7 +22,7 @@ ast: | rescueBody = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/rescue/with_exception_and_variable.yaml b/spec/truffle/parsing/fixtures/rescue/with_exception_and_variable.yaml index 69410cd65244..d5a70fb0b51b 100644 --- a/spec/truffle/parsing/fixtures/rescue/with_exception_and_variable.yaml +++ b/spec/truffle/parsing/fixtures/rescue/with_exception_and_variable.yaml @@ -57,7 +57,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # error children: valueNode = ReadGlobalVariableNodeGen @@ -72,7 +72,7 @@ ast: | name = "$!" IntegerFixnumLiteralNode attributes: - flags = 0 + flags = 1 value = 42 ] ] @@ -80,5 +80,5 @@ ast: | StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = foo \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/rescue/without_exception_but_with_variable.yaml b/spec/truffle/parsing/fixtures/rescue/without_exception_but_with_variable.yaml index 85c8332e8ff4..6d231e25efda 100644 --- a/spec/truffle/parsing/fixtures/rescue/without_exception_but_with_variable.yaml +++ b/spec/truffle/parsing/fixtures/rescue/without_exception_but_with_variable.yaml @@ -30,7 +30,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # error children: valueNode = ReadGlobalVariableNodeGen @@ -45,7 +45,7 @@ ast: | name = "$!" IntegerFixnumLiteralNode attributes: - flags = 0 + flags = 1 value = 42 ] ] @@ -53,5 +53,5 @@ ast: | StringLiteralNode attributes: encoding = UTF-8 - flags = 0 + flags = 1 tstring = foo \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/return/in_block_in_class_body.yaml b/spec/truffle/parsing/fixtures/return/in_block_in_class_body.yaml index 30a80678e261..a5d11132d3fc 100644 --- a/spec/truffle/parsing/fixtures/return/in_block_in_class_body.yaml +++ b/spec/truffle/parsing/fixtures/return/in_block_in_class_body.yaml @@ -80,7 +80,7 @@ ast: | child = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/return/in_block_in_module_body.yaml b/spec/truffle/parsing/fixtures/return/in_block_in_module_body.yaml index 396badffb8a3..400157d80480 100644 --- a/spec/truffle/parsing/fixtures/return/in_block_in_module_body.yaml +++ b/spec/truffle/parsing/fixtures/return/in_block_in_module_body.yaml @@ -80,7 +80,7 @@ ast: | child = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PROTECTED emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/return/in_lambda_method_call_in_class_body.yaml b/spec/truffle/parsing/fixtures/return/in_lambda_method_call_in_class_body.yaml index 96331f708b9d..62b6c74cb2c4 100644 --- a/spec/truffle/parsing/fixtures/return/in_lambda_method_call_in_class_body.yaml +++ b/spec/truffle/parsing/fixtures/return/in_lambda_method_call_in_class_body.yaml @@ -82,7 +82,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='lambda', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: block_ = BlockDefinitionNodeGen diff --git a/spec/truffle/parsing/fixtures/return/in_lambda_method_call_in_module_body.yaml b/spec/truffle/parsing/fixtures/return/in_lambda_method_call_in_module_body.yaml index 1699ed273449..cdd9dca04e16 100644 --- a/spec/truffle/parsing/fixtures/return/in_lambda_method_call_in_module_body.yaml +++ b/spec/truffle/parsing/fixtures/return/in_lambda_method_call_in_module_body.yaml @@ -82,7 +82,7 @@ ast: | attributes: assumptions = [Assumption(valid, name=set_trace_func is not used)] flags = 0 - parameters = org.truffleruby.language.dispatch.RubyCallNodeParameters@... + parameters = RubyCallNodeParameters{methodName='lambda', descriptor=NoKeywordArgumentsDescriptor, isSplatted=false, ignoreVisibility=true, isVCall=false, isSafeNavigation=false, isAttrAssign=false} children: block_ = BlockDefinitionNodeGen diff --git a/spec/truffle/parsing/fixtures/sequence_of_expressions.yaml b/spec/truffle/parsing/fixtures/sequence_of_expressions.yaml index 8d0db7cb6aee..29c8debc464c 100644 --- a/spec/truffle/parsing/fixtures/sequence_of_expressions.yaml +++ b/spec/truffle/parsing/fixtures/sequence_of_expressions.yaml @@ -17,7 +17,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/strings/backtick_literal.yaml b/spec/truffle/parsing/fixtures/strings/backtick_literal.yaml index 939cb7a2afda..f4a9a95658f4 100644 --- a/spec/truffle/parsing/fixtures/strings/backtick_literal.yaml +++ b/spec/truffle/parsing/fixtures/strings/backtick_literal.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 1 diff --git a/spec/truffle/parsing/fixtures/strings/backtick_literal_with_interpolation.yaml b/spec/truffle/parsing/fixtures/strings/backtick_literal_with_interpolation.yaml index 181a53cf9dba..031b3f652805 100644 --- a/spec/truffle/parsing/fixtures/strings/backtick_literal_with_interpolation.yaml +++ b/spec/truffle/parsing/fixtures/strings/backtick_literal_with_interpolation.yaml @@ -9,7 +9,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/strings/backtick_literal_with_interpolation_without_expression.yaml b/spec/truffle/parsing/fixtures/strings/backtick_literal_with_interpolation_without_expression.yaml index 2cf64ae2d8cb..c56a912713ef 100644 --- a/spec/truffle/parsing/fixtures/strings/backtick_literal_with_interpolation_without_expression.yaml +++ b/spec/truffle/parsing/fixtures/strings/backtick_literal_with_interpolation_without_expression.yaml @@ -12,7 +12,7 @@ ruby: | ast: | RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 diff --git a/spec/truffle/parsing/fixtures/undef/with_multiple_symbols.yaml b/spec/truffle/parsing/fixtures/undef/with_multiple_symbols.yaml index 1412cd835992..045e34c8763a 100644 --- a/spec/truffle/parsing/fixtures/undef/with_multiple_symbols.yaml +++ b/spec/truffle/parsing/fixtures/undef/with_multiple_symbols.yaml @@ -12,7 +12,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen diff --git a/spec/truffle/parsing/fixtures/yield/with_arguments.yaml b/spec/truffle/parsing/fixtures/yield/with_arguments.yaml index ad301ff65375..f477ecb4652d 100644 --- a/spec/truffle/parsing/fixtures/yield/with_arguments.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_arguments.yaml @@ -43,7 +43,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -60,7 +60,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = false @@ -82,6 +82,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_keyword_arguments.yaml b/spec/truffle/parsing/fixtures/yield/with_keyword_arguments.yaml index 130ec6573f84..116fa16872c6 100644 --- a/spec/truffle/parsing/fixtures/yield/with_keyword_arguments.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_keyword_arguments.yaml @@ -47,7 +47,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -100,6 +100,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_only_double_splat_operator.yaml b/spec/truffle/parsing/fixtures/yield/with_only_double_splat_operator.yaml index fe16a95d48bd..eafe7c572ea9 100644 --- a/spec/truffle/parsing/fixtures/yield/with_only_double_splat_operator.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_only_double_splat_operator.yaml @@ -45,7 +45,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -78,7 +78,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -100,6 +100,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_only_splat_operator.yaml b/spec/truffle/parsing/fixtures/yield/with_only_splat_operator.yaml index 957c77cc6a81..4e9678f302de 100644 --- a/spec/truffle/parsing/fixtures/yield/with_only_splat_operator.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_only_splat_operator.yaml @@ -46,7 +46,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -63,7 +63,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = true @@ -82,7 +82,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -104,6 +104,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_following_arguments.yaml b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_following_arguments.yaml index 84cc8a8abac9..655096ede191 100644 --- a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_following_arguments.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_following_arguments.yaml @@ -62,7 +62,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -79,7 +79,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = true @@ -103,7 +103,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -136,7 +136,7 @@ ast: | values = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -155,7 +155,7 @@ ast: | flags = 0 RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -179,6 +179,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_preceding_and_following_positional_arguments.yaml b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_preceding_and_following_positional_arguments.yaml index 4a7e9e05adb0..d5605dbe9a9c 100644 --- a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_preceding_and_following_positional_arguments.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_preceding_and_following_positional_arguments.yaml @@ -68,7 +68,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -85,7 +85,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = true @@ -107,7 +107,7 @@ ast: | values = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -126,7 +126,7 @@ ast: | flags = 0 RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -154,7 +154,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -187,7 +187,7 @@ ast: | values = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -206,7 +206,7 @@ ast: | flags = 0 RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -230,6 +230,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_preceding_arguments.yaml b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_preceding_arguments.yaml index 8f92c452566b..780c19612cb9 100644 --- a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_preceding_arguments.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_multiple_preceding_arguments.yaml @@ -60,7 +60,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -77,7 +77,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = true @@ -99,7 +99,7 @@ ast: | values = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -118,7 +118,7 @@ ast: | flags = 0 RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -146,7 +146,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -169,6 +169,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_following_argument.yaml b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_following_argument.yaml index ce3e2e4e3893..bf3d14c308fb 100644 --- a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_following_argument.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_following_argument.yaml @@ -57,7 +57,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -74,7 +74,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = true @@ -103,7 +103,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -123,7 +123,7 @@ ast: | valueNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -145,6 +145,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_preceding_and_following_positional_arguments.yaml b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_preceding_and_following_positional_arguments.yaml index 75056b15be40..d02e467f7917 100644 --- a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_preceding_and_following_positional_arguments.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_preceding_and_following_positional_arguments.yaml @@ -60,7 +60,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -77,7 +77,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = true @@ -109,7 +109,7 @@ ast: | values = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -137,7 +137,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -158,7 +158,7 @@ ast: | valueNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -180,6 +180,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_preceding_argument.yaml b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_preceding_argument.yaml index 4de19e346edc..3765656e0090 100644 --- a/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_preceding_argument.yaml +++ b/spec/truffle/parsing/fixtures/yield/with_splat_operator_and_single_preceding_argument.yaml @@ -57,7 +57,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -74,7 +74,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = true @@ -96,7 +96,7 @@ ast: | values = [ RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -124,7 +124,7 @@ ast: | childNode_ = RubyCallNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor dispatchConfig = PRIVATE emptyKeywordsProfile = false flags = 0 @@ -147,6 +147,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/fixtures/yield/without_arguments.yaml b/spec/truffle/parsing/fixtures/yield/without_arguments.yaml index f8f37badcbca..398d71776ecb 100644 --- a/spec/truffle/parsing/fixtures/yield/without_arguments.yaml +++ b/spec/truffle/parsing/fixtures/yield/without_arguments.yaml @@ -44,7 +44,7 @@ ast: | WriteLocalVariableNode attributes: flags = 0 - frameSlot = 0 + frameSlot = 0 # (self) children: valueNode = ProfileArgumentNodeGen @@ -61,7 +61,7 @@ ast: | slot = 2 YieldExpressionNode attributes: - descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@... + descriptor = NoKeywordArgumentsDescriptor emptyKeywordsProfile = false flags = 1 isSplatted = false @@ -73,6 +73,6 @@ ast: | ReadLocalVariableNode attributes: flags = 0 - frameSlot = 2 + frameSlot = 2 # %method_block_arg type = FRAME_LOCAL ] \ No newline at end of file diff --git a/spec/truffle/parsing/parsing_spec.rb b/spec/truffle/parsing/parsing_spec.rb index f8be5bd43905..ac47a2d4f441 100644 --- a/spec/truffle/parsing/parsing_spec.rb +++ b/spec/truffle/parsing/parsing_spec.rb @@ -40,7 +40,11 @@ # # To regenerate fixture YAML files with actual AST run the following command: # -# OVERWRITE_PARSING_RESULTS=true jt -q test spec/truffle/parsing/parsing_spec.rb +# OVERWRITE_PARSING_RESULTS=true TRUFFLE_PARSING_USE_ORIGINAL_TRANSLATOR=true jt -q mspec spec/truffle/parsing/parsing_spec.rb && OVERWRITE_PARSING_RESULTS=true jt -q test spec/truffle/parsing/parsing_spec.rb +# +# To ensure that fixtures are valid and are passing both on the old and new translator, use: +# +# TRUFFLE_PARSING_USE_ORIGINAL_TRANSLATOR=true jt -q mspec spec/truffle/parsing/parsing_spec.rb && jt -q test spec/truffle/parsing/parsing_spec.rb # # An approach with YAML.dump has some downsides: # - it adds a line `---` at a file beginning @@ -51,12 +55,13 @@ overwrite = ENV['OVERWRITE_PARSING_RESULTS'] == 'true' original_parser = ENV['TRUFFLE_PARSING_USE_ORIGINAL_TRANSLATOR'] == 'true' +fixtures_glob = ENV['TRUFFLE_PARSING_GLOB'] describe "Parsing" do require 'yaml' - filenames = Dir.glob("#{__dir__}/fixtures/**/*.yaml") - # filenames = ["#{__dir__}/fixtures/if/with_empty_then_branch.yaml"] # to run a single one + filenames = Dir["#{__dir__}/fixtures/**/*.yaml"] + filenames = Dir[fixtures_glob] if fixtures_glob filenames.each do |filename| yaml = YAML.safe_load_file(filename) @@ -102,7 +107,7 @@ end unless actual_ast == expected_ast - $stderr.puts "\nYARP AST:", Truffle::Debug.yarp_parse(source_code) + $stderr.puts "\n#{filename}\nYARP AST:", Truffle::Debug.yarp_parse(source_code) end actual_ast.should == expected_ast end diff --git a/src/main/java/org/truffleruby/core/numeric/FixnumOrBignumNode.java b/src/main/java/org/truffleruby/core/numeric/FixnumOrBignumNode.java index 243939c971aa..36710b84979b 100644 --- a/src/main/java/org/truffleruby/core/numeric/FixnumOrBignumNode.java +++ b/src/main/java/org/truffleruby/core/numeric/FixnumOrBignumNode.java @@ -14,6 +14,7 @@ import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.GenerateCached; import com.oracle.truffle.api.dsl.GenerateInline; +import com.oracle.truffle.api.dsl.GenerateUncached; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.InlinedConditionProfile; @@ -24,11 +25,15 @@ @GenerateCached(false) @GenerateInline +@GenerateUncached public abstract class FixnumOrBignumNode extends RubyBaseNode { private static final BigInteger LONG_MIN_BIGINT = BigInteger.valueOf(Long.MIN_VALUE); private static final BigInteger LONG_MAX_BIGINT = BigInteger.valueOf(Long.MAX_VALUE); + public static Object executeUncached(BigInteger value) { + return FixnumOrBignumNodeGen.getUncached().execute(null, value); + } public abstract Object execute(Node node, BigInteger value); diff --git a/src/main/java/org/truffleruby/core/regexp/RegexpOptions.java b/src/main/java/org/truffleruby/core/regexp/RegexpOptions.java index 6b99b140b5e2..4223bd340f9c 100644 --- a/src/main/java/org/truffleruby/core/regexp/RegexpOptions.java +++ b/src/main/java/org/truffleruby/core/regexp/RegexpOptions.java @@ -43,6 +43,47 @@ public RegexpOptions(KCode kcode, int options) { assert kcode != null : "kcode must always be set to something"; } + public RegexpOptions( + KCode kcode, + boolean fixed, + boolean once, + boolean extended, + boolean multiLine, + boolean ignoreCase, + boolean encodingNone, + boolean kCodeDefault, + boolean literal) { + this.kcode = kcode; + int options = 0; + if (fixed) { + options |= FIXED; + } + if (once) { + options |= ONCE; + } + if (extended) { + options |= EXTENDED; + } + if (multiLine) { + options |= MULTILINE; + } + if (ignoreCase) { + options |= IGNORECASE; + } + if (encodingNone) { + options |= ENCODINGNONE; + } + if (kCodeDefault) { + options |= KCODEDEFAULT; + } + if (literal) { + options |= LITERAL; + } + this.options = options; + + assert kcode != null : "kcode must always be set to something"; + } + public boolean isExtended() { return (options & EXTENDED) != 0; } @@ -117,14 +158,6 @@ public RegexpOptions setOnce(boolean once) { return newWithFlag(ONCE, once); } - public boolean isJava() { - return (options & JAVA) != 0; - } - - public RegexpOptions setJava(boolean java) { - return newWithFlag(JAVA, java); - } - public boolean isEncodingNone() { return (options & ENCODINGNONE) != 0; } @@ -251,7 +284,6 @@ public int hashCode() { hash = 11 * hash + (isExtended() ? 1 : 0); hash = 11 * hash + (isMultiline() ? 1 : 0); hash = 11 * hash + (isIgnorecase() ? 1 : 0); - hash = 11 * hash + (isJava() ? 1 : 0); hash = 11 * hash + (isEncodingNone() ? 1 : 0); hash = 11 * hash + (isKcodeDefault() ? 1 : 0); hash = 11 * hash + (isLiteral() ? 1 : 0); @@ -284,7 +316,6 @@ public String toString() { (isExtended() ? ", extended" : "") + (isFixed() ? ", fixed" : "") + (isIgnorecase() ? ", ignorecase" : "") + - (isJava() ? ", java" : "") + (isKcodeDefault() ? ", kcodeDefault" : "") + (isLiteral() ? ", literal" : "") + (isMultiline() ? ", multiline" : "") + @@ -309,8 +340,7 @@ public int compareTo(RegexpOptions o) { private static final int EXTENDED = 1 << 2; private static final int MULTILINE = 1 << 3; private static final int IGNORECASE = 1 << 4; - private static final int JAVA = 1 << 5; - private static final int ENCODINGNONE = 1 << 6; - private static final int KCODEDEFAULT = 1 << 7; - private static final int LITERAL = 1 << 8; + private static final int ENCODINGNONE = 1 << 5; + private static final int KCODEDEFAULT = 1 << 6; + private static final int LITERAL = 1 << 7; } diff --git a/src/main/java/org/truffleruby/core/string/ConvertBytes.java b/src/main/java/org/truffleruby/core/string/ConvertBytes.java index 573d6a917c1c..31b290c6f7bd 100644 --- a/src/main/java/org/truffleruby/core/string/ConvertBytes.java +++ b/src/main/java/org/truffleruby/core/string/ConvertBytes.java @@ -29,8 +29,7 @@ public final class ConvertBytes { private final RubyContext context; - private final Node caller; - private final FixnumOrBignumNode fixnumOrBignumNode; + private final Node currentNode; private final AbstractTruffleString tstring; private int p; private int end; @@ -40,8 +39,7 @@ public final class ConvertBytes { public ConvertBytes( RubyContext context, - Node caller, - FixnumOrBignumNode fixnumOrBignumNode, + Node currentNode, AbstractTruffleString tstring, RubyEncoding encoding, int base, @@ -51,8 +49,7 @@ public ConvertBytes( var byteArray = tstring.getInternalByteArrayUncached(encoding.tencoding); this.context = context; - this.caller = caller; - this.fixnumOrBignumNode = fixnumOrBignumNode; + this.currentNode = currentNode; this.tstring = tstring; this.p = byteArray.getOffset(); this.data = byteArray.getArray(); @@ -70,9 +67,9 @@ public ConvertBytes( } /** rb_cstr_to_inum */ - public static Object bytesToInum(RubyContext context, Node caller, FixnumOrBignumNode fixnumOrBignumNode, + public static Object bytesToInum(RubyContext context, Node currentNode, AbstractTruffleString tstring, RubyEncoding encoding, int base, boolean badcheck) { - return new ConvertBytes(context, caller, fixnumOrBignumNode, tstring, encoding, base, badcheck).bytesToInum(); + return new ConvertBytes(context, currentNode, tstring, encoding, base, badcheck).bytesToInum(); } /** conv_digit */ @@ -197,7 +194,7 @@ private int calculateLength() { if (base < 2 || 36 < base) { throw new RaiseException( context, - context.getCoreExceptions().argumentErrorInvalidRadix(base, caller)); + context.getCoreExceptions().argumentErrorInvalidRadix(base, currentNode)); } if (base <= 32) { len = 5; @@ -465,7 +462,7 @@ private Object bigParse(int len, boolean sign) { } } - return fixnumOrBignumNode.execute(caller, z); + return FixnumOrBignumNode.executeUncached(z); } private BigInteger stringToBig(String str) { @@ -532,10 +529,9 @@ public Kind getKind() { /** rb_invalid_str */ private void invalidString() { - throw new RaiseException( - context, - context.getCoreExceptions().argumentErrorInvalidStringToInteger(tstring.toJavaStringUncached(), - caller)); + var string = tstring.toJavaStringUncached(); + throw new RaiseException(context, + context.getCoreExceptions().argumentErrorInvalidStringToInteger(string, currentNode)); } public static final byte[] intToBinaryBytes(int i) { diff --git a/src/main/java/org/truffleruby/core/string/StringNodes.java b/src/main/java/org/truffleruby/core/string/StringNodes.java index 8b837d1a42ff..ab41356e94d8 100644 --- a/src/main/java/org/truffleruby/core/string/StringNodes.java +++ b/src/main/java/org/truffleruby/core/string/StringNodes.java @@ -127,7 +127,6 @@ import org.truffleruby.core.kernel.KernelNodes; import org.truffleruby.core.klass.RubyClass; import org.truffleruby.core.numeric.FixnumLowerNode; -import org.truffleruby.core.numeric.FixnumOrBignumNode; import org.truffleruby.core.proc.RubyProc; import org.truffleruby.core.range.RangeNodes; import org.truffleruby.core.regexp.RubyRegexp; @@ -3682,8 +3681,7 @@ public abstract static class StringToFPrimitiveNode extends PrimitiveArrayArgume @TruffleBoundary @Specialization Object stringToF(Object string, - @Cached RubyStringLibrary strings, - @Cached FixnumOrBignumNode fixnumOrBignumNode) { + @Cached RubyStringLibrary strings) { var tstring = strings.getTString(string); var encoding = strings.getEncoding(string); if (tstring.isEmpty()) { @@ -3696,15 +3694,13 @@ Object stringToF(Object string, return Double.parseDouble(javaString); } catch (NumberFormatException e) { // Try falling back to this implementation if the first fails, neither 100% complete - final Object result = ConvertBytes - .bytesToInum( - getContext(), - this, - fixnumOrBignumNode, - tstring, - encoding, - 16, - true); + final Object result = ConvertBytes.bytesToInum( + getContext(), + this, + tstring, + encoding, + 16, + true); if (result instanceof Integer) { return ((Integer) result).doubleValue(); } else if (result instanceof Long) { @@ -4135,7 +4131,6 @@ Object base10(Object string, int base, boolean strict, boolean raiseOnError, @Cached @Shared RubyStringLibrary libString, @Cached @Shared TruffleString.ParseLongNode parseLongNode, @Cached @Shared InlinedBranchProfile notLazyLongProfile, - @Cached @Shared FixnumOrBignumNode fixnumOrBignumNode, @Cached @Shared InlinedBranchProfile exceptionProfile) { var tstring = libString.getTString(string); try { @@ -4143,8 +4138,7 @@ Object base10(Object string, int base, boolean strict, boolean raiseOnError, } catch (TruffleString.NumberFormatException e) { notLazyLongProfile.enter(this); var encoding = libString.getEncoding(string); - return bytesToInum(this, tstring, encoding, base, strict, raiseOnError, fixnumOrBignumNode, - exceptionProfile); + return bytesToInum(tstring, encoding, base, strict, raiseOnError, exceptionProfile); } } @@ -4155,7 +4149,6 @@ Object base0(Object string, int base, boolean strict, boolean raiseOnError, @Cached TruffleString.CodePointAtByteIndexNode codePointNode, @Cached InlinedConditionProfile notEmptyProfile, @Cached @Shared InlinedBranchProfile notLazyLongProfile, - @Cached @Shared FixnumOrBignumNode fixnumOrBignumNode, @Cached @Shared InlinedBranchProfile exceptionProfile) { var tstring = libString.getTString(string); var enc = libString.getEncoding(string); @@ -4177,36 +4170,30 @@ Object base0(Object string, int base, boolean strict, boolean raiseOnError, } var encoding = libString.getEncoding(string); - return bytesToInum(this, tstring, encoding, base, strict, raiseOnError, fixnumOrBignumNode, - exceptionProfile); + return bytesToInum(tstring, encoding, base, strict, raiseOnError, exceptionProfile); } @Specialization(guards = { "base != 10", "base != 0" }) Object otherBase(Object string, int base, boolean strict, boolean raiseOnError, @Cached @Shared RubyStringLibrary libString, - @Cached @Shared FixnumOrBignumNode fixnumOrBignumNode, @Cached @Shared InlinedBranchProfile exceptionProfile) { var tstring = libString.getTString(string); var encoding = libString.getEncoding(string); - return bytesToInum(this, tstring, encoding, base, strict, raiseOnError, fixnumOrBignumNode, - exceptionProfile); + return bytesToInum(tstring, encoding, base, strict, raiseOnError, exceptionProfile); } - private Object bytesToInum(Node node, AbstractTruffleString tstring, RubyEncoding encoding, int base, - boolean strict, - boolean raiseOnError, FixnumOrBignumNode fixnumOrBignumNode, - InlinedBranchProfile exceptionProfile) { + private Object bytesToInum(AbstractTruffleString tstring, RubyEncoding encoding, int base, + boolean strict, boolean raiseOnError, InlinedBranchProfile exceptionProfile) { try { return ConvertBytes.bytesToInum( getContext(), this, - fixnumOrBignumNode, tstring, encoding, base, strict); } catch (RaiseException e) { - exceptionProfile.enter(node); + exceptionProfile.enter(this); if (!raiseOnError) { return nil; } diff --git a/src/main/java/org/truffleruby/debug/TruffleDebugNodes.java b/src/main/java/org/truffleruby/debug/TruffleDebugNodes.java index bc851648cf3f..d8fffc3dc5f7 100644 --- a/src/main/java/org/truffleruby/debug/TruffleDebugNodes.java +++ b/src/main/java/org/truffleruby/debug/TruffleDebugNodes.java @@ -77,6 +77,7 @@ import org.truffleruby.language.arguments.RubyArguments; import org.truffleruby.language.backtrace.BacktraceFormatter; import org.truffleruby.language.backtrace.InternalRootNode; +import org.truffleruby.language.control.RaiseException; import org.truffleruby.language.library.RubyStringLibrary; import org.truffleruby.language.methods.DeclarationContext; import org.truffleruby.language.methods.InternalMethod; @@ -1468,7 +1469,16 @@ Object parseAndDump(Object code, Object focusedNodeClassName, int index, @Cached RubyStringLibrary strings, @Cached TruffleString.FromJavaStringNode fromJavaStringNode) { String nodeClassNameString = RubyGuards.getJavaString(focusedNodeClassName); - RubyRootNode rootNode = parse(code); + RubyRootNode rootNode; + try { + rootNode = parse(code); + } catch (Error e) { + if (e.getMessage().contains("does not know how to translate")) { + throw new RaiseException(getContext(), coreExceptions().runtimeError(e.getMessage(), this)); + } else { + throw e; + } + } String output = TruffleASTPrinter.dump(rootNode, nodeClassNameString, index); return createString(fromJavaStringNode, output, Encodings.UTF_8); } diff --git a/src/main/java/org/truffleruby/language/arguments/NoKeywordArgumentsDescriptor.java b/src/main/java/org/truffleruby/language/arguments/NoKeywordArgumentsDescriptor.java index 2ed6f9e5999c..c25e06957383 100644 --- a/src/main/java/org/truffleruby/language/arguments/NoKeywordArgumentsDescriptor.java +++ b/src/main/java/org/truffleruby/language/arguments/NoKeywordArgumentsDescriptor.java @@ -17,4 +17,8 @@ public final class NoKeywordArgumentsDescriptor extends ArgumentsDescriptor { private NoKeywordArgumentsDescriptor() { } + @Override + public String toString() { + return "NoKeywordArgumentsDescriptor"; + } } diff --git a/src/main/java/org/truffleruby/language/arguments/ReadKeywordArgumentNode.java b/src/main/java/org/truffleruby/language/arguments/ReadKeywordArgumentNode.java index efe320e86e08..5309e6519289 100644 --- a/src/main/java/org/truffleruby/language/arguments/ReadKeywordArgumentNode.java +++ b/src/main/java/org/truffleruby/language/arguments/ReadKeywordArgumentNode.java @@ -40,6 +40,10 @@ public static ReadKeywordArgumentNode create(RubySymbol name, RubyNode defaultVa return ReadKeywordArgumentNodeGen.create(name, defaultValue); } + public RubySymbol getName() { + return name; + } + @Override public final Object execute(VirtualFrame frame) { return execute(frame, readUserKeywordsHashNode.execute(frame)); diff --git a/src/main/java/org/truffleruby/language/dispatch/RubyCallNodeParameters.java b/src/main/java/org/truffleruby/language/dispatch/RubyCallNodeParameters.java index 9d75bf0d1c53..14a01bde0957 100644 --- a/src/main/java/org/truffleruby/language/dispatch/RubyCallNodeParameters.java +++ b/src/main/java/org/truffleruby/language/dispatch/RubyCallNodeParameters.java @@ -58,6 +58,19 @@ public RubyCallNodeParameters( this.isAttrAssign = isAttrAssign; } + @Override + public String toString() { + return "RubyCallNodeParameters{" + + "methodName='" + methodName + "'" + + ", descriptor=" + descriptor + + ", isSplatted=" + isSplatted + + ", ignoreVisibility=" + ignoreVisibility + + ", isVCall=" + isVCall + + ", isSafeNavigation=" + isSafeNavigation + + ", isAttrAssign=" + isAttrAssign + + '}'; + } + public RubyCallNodeParameters withReceiverAndArguments(RubyNode receiver, RubyNode[] arguments, RubyNode block) { return new RubyCallNodeParameters( receiver, diff --git a/src/main/java/org/truffleruby/language/literal/IntegerFixnumLiteralNode.java b/src/main/java/org/truffleruby/language/literal/IntegerFixnumLiteralNode.java index 088e4b448d74..0ec119934d94 100644 --- a/src/main/java/org/truffleruby/language/literal/IntegerFixnumLiteralNode.java +++ b/src/main/java/org/truffleruby/language/literal/IntegerFixnumLiteralNode.java @@ -25,6 +25,10 @@ public IntegerFixnumLiteralNode(int value) { this.value = value; } + public int getValue() { + return value; + } + @Override public Object execute(VirtualFrame frame) { return value; diff --git a/src/main/java/org/truffleruby/language/literal/LongFixnumLiteralNode.java b/src/main/java/org/truffleruby/language/literal/LongFixnumLiteralNode.java index 86285687867b..cc52194a89b8 100644 --- a/src/main/java/org/truffleruby/language/literal/LongFixnumLiteralNode.java +++ b/src/main/java/org/truffleruby/language/literal/LongFixnumLiteralNode.java @@ -25,6 +25,10 @@ public LongFixnumLiteralNode(long value) { this.value = value; } + public long getValue() { + return value; + } + @Override public Object execute(VirtualFrame frame) { return value; diff --git a/src/main/java/org/truffleruby/language/methods/BlockDefinitionNode.java b/src/main/java/org/truffleruby/language/methods/BlockDefinitionNode.java index dc1b1709bda8..7af0a7e87a69 100644 --- a/src/main/java/org/truffleruby/language/methods/BlockDefinitionNode.java +++ b/src/main/java/org/truffleruby/language/methods/BlockDefinitionNode.java @@ -23,7 +23,7 @@ import org.truffleruby.language.control.FrameOnStackMarker; import com.oracle.truffle.api.frame.VirtualFrame; -import org.truffleruby.parser.BodyTranslator; +import org.truffleruby.parser.Translator; /** Create a Ruby Proc to pass as a block to the called method. The literal block is represented as call targets and a * SharedMethodInfo. This is executed at the call site just before dispatch. */ @@ -41,7 +41,7 @@ public BlockDefinitionNode( ProcCallTargets callTargets, BreakID breakID, int frameOnStackMarkerSlot) { - assert (type == ProcType.PROC) == (frameOnStackMarkerSlot != BodyTranslator.NO_FRAME_ON_STACK_MARKER); + assert (type == ProcType.PROC) == (frameOnStackMarkerSlot != Translator.NO_FRAME_ON_STACK_MARKER); this.type = type; this.sharedMethodInfo = sharedMethodInfo; this.callTargets = callTargets; @@ -61,7 +61,7 @@ RubyProc doBlockDefinition(VirtualFrame frame, @Cached GetSpecialVariableStorage readSpecialVariableStorageNode, @Cached WithoutVisibilityNode withoutVisibilityNode) { final FrameOnStackMarker frameOnStackMarker; - if (frameOnStackMarkerSlot != BodyTranslator.NO_FRAME_ON_STACK_MARKER) { + if (frameOnStackMarkerSlot != Translator.NO_FRAME_ON_STACK_MARKER) { frameOnStackMarker = (FrameOnStackMarker) frame.getObject(frameOnStackMarkerSlot); assert frameOnStackMarker != null; } else { diff --git a/src/main/java/org/truffleruby/language/supercall/ZSuperOutsideMethodNode.java b/src/main/java/org/truffleruby/language/supercall/ZSuperOutsideMethodNode.java index 165c6dc71905..e708576e3576 100644 --- a/src/main/java/org/truffleruby/language/supercall/ZSuperOutsideMethodNode.java +++ b/src/main/java/org/truffleruby/language/supercall/ZSuperOutsideMethodNode.java @@ -32,7 +32,7 @@ public ZSuperOutsideMethodNode(boolean insideDefineMethod) { } @Override - public final Object execute(VirtualFrame frame) { + public Object execute(VirtualFrame frame) { // This is MRI behavior if (insideDefineMethod) { // TODO (eregon, 22 July 2015): This check should be more dynamic. throw new RaiseException(getContext(), coreExceptions().runtimeError( diff --git a/src/main/java/org/truffleruby/options/LanguageOptions.java b/src/main/java/org/truffleruby/options/LanguageOptions.java index 97c11c8cec60..9a452631b658 100644 --- a/src/main/java/org/truffleruby/options/LanguageOptions.java +++ b/src/main/java/org/truffleruby/options/LanguageOptions.java @@ -127,6 +127,8 @@ public final class LanguageOptions { public final boolean RUN_TWICE; /** --experimental-engine-caching=RUN_TWICE */ public final boolean EXPERIMENTAL_ENGINE_CACHING; + /** --prism=false */ + public final boolean PRISM; public LanguageOptions(Env env, OptionValues options, boolean singleContext) { NO_HOME_PROVIDED = options.get(OptionsCatalog.NO_HOME_PROVIDED_KEY); @@ -181,6 +183,7 @@ public LanguageOptions(Env env, OptionValues options, boolean singleContext) { SHARED_OBJECTS_FORCE = options.get(OptionsCatalog.SHARED_OBJECTS_FORCE_KEY); RUN_TWICE = options.get(OptionsCatalog.RUN_TWICE_KEY); EXPERIMENTAL_ENGINE_CACHING = options.hasBeenSet(OptionsCatalog.EXPERIMENTAL_ENGINE_CACHING_KEY) ? options.get(OptionsCatalog.EXPERIMENTAL_ENGINE_CACHING_KEY) : RUN_TWICE; + PRISM = options.get(OptionsCatalog.PRISM_KEY); } public Object fromDescriptor(OptionDescriptor descriptor) { @@ -289,6 +292,8 @@ public Object fromDescriptor(OptionDescriptor descriptor) { return RUN_TWICE; case "ruby.experimental-engine-caching": return EXPERIMENTAL_ENGINE_CACHING; + case "ruby.prism": + return PRISM; default: return null; } @@ -346,7 +351,8 @@ public static boolean areOptionsCompatible(OptionValues one, OptionValues two) { one.get(OptionsCatalog.SHARED_OBJECTS_DEBUG_KEY).equals(two.get(OptionsCatalog.SHARED_OBJECTS_DEBUG_KEY)) && one.get(OptionsCatalog.SHARED_OBJECTS_FORCE_KEY).equals(two.get(OptionsCatalog.SHARED_OBJECTS_FORCE_KEY)) && one.get(OptionsCatalog.RUN_TWICE_KEY).equals(two.get(OptionsCatalog.RUN_TWICE_KEY)) && - one.get(OptionsCatalog.EXPERIMENTAL_ENGINE_CACHING_KEY).equals(two.get(OptionsCatalog.EXPERIMENTAL_ENGINE_CACHING_KEY)); + one.get(OptionsCatalog.EXPERIMENTAL_ENGINE_CACHING_KEY).equals(two.get(OptionsCatalog.EXPERIMENTAL_ENGINE_CACHING_KEY)) && + one.get(OptionsCatalog.PRISM_KEY).equals(two.get(OptionsCatalog.PRISM_KEY)); } public static boolean areOptionsCompatibleOrLog(TruffleLogger logger, LanguageOptions oldOptions, LanguageOptions newOptions) { @@ -717,6 +723,13 @@ public static boolean areOptionsCompatibleOrLog(TruffleLogger logger, LanguageOp return false; } + oldValue = oldOptions.PRISM; + newValue = newOptions.PRISM; + if (!newValue.equals(oldValue)) { + logger.fine("not reusing pre-initialized context: --prism differs, was: " + oldValue + " and is now: " + newValue); + return false; + } + return true; } } diff --git a/src/main/java/org/truffleruby/parser/BodyTranslator.java b/src/main/java/org/truffleruby/parser/BodyTranslator.java index ace995625f32..e906968503c9 100644 --- a/src/main/java/org/truffleruby/parser/BodyTranslator.java +++ b/src/main/java/org/truffleruby/parser/BodyTranslator.java @@ -567,11 +567,11 @@ private RubyNode translateCallNode(CallParseNode node, boolean ignoreVisibility, final List children = new ArrayList<>(); - if (argumentsAndBlock.getBlock() != null) { - children.add(argumentsAndBlock.getBlock()); + if (argumentsAndBlock.block() != null) { + children.add(argumentsAndBlock.block()); } - children.addAll(Arrays.asList(argumentsAndBlock.getArguments())); + children.addAll(Arrays.asList(argumentsAndBlock.arguments())); final SourceIndexLength enclosingSourceSection = enclosing( sourceSection, @@ -580,9 +580,9 @@ private RubyNode translateCallNode(CallParseNode node, boolean ignoreVisibility, RubyCallNodeParameters callParameters = new RubyCallNodeParameters( receiver, methodName, - argumentsAndBlock.getBlock(), - argumentsAndBlock.getArgumentsDescriptor(), - argumentsAndBlock.getArguments(), + argumentsAndBlock.block(), + argumentsAndBlock.argumentsDescriptor(), + argumentsAndBlock.arguments(), argumentsAndBlock.isSplatted(), ignoreVisibility, isVCall, @@ -598,59 +598,15 @@ private RubyNode translateCallNode(CallParseNode node, boolean ignoreVisibility, } protected RubyNode wrapCallWithLiteralBlock(ArgumentsAndBlockTranslation argumentsAndBlock, RubyNode callNode) { - if (argumentsAndBlock.getBlock() instanceof BlockDefinitionNode) { // if we have a literal block, break breaks out of this call site - callNode = new FrameOnStackNode(callNode, argumentsAndBlock.getFrameOnStackMarkerSlot()); - final BlockDefinitionNode blockDef = (BlockDefinitionNode) argumentsAndBlock.getBlock(); + if (argumentsAndBlock.block() instanceof BlockDefinitionNode) { // if we have a literal block, break breaks out of this call site + callNode = new FrameOnStackNode(callNode, argumentsAndBlock.frameOnStackMarkerSlot()); + final BlockDefinitionNode blockDef = (BlockDefinitionNode) argumentsAndBlock.block(); return new CatchBreakNode(blockDef.getBreakID(), callNode, false); } else { return callNode; } } - protected static final class ArgumentsAndBlockTranslation { - - private final RubyNode block; - private final RubyNode[] arguments; - private final ArgumentsDescriptor argumentsDescriptor; - private final boolean isSplatted; - private final int frameOnStackMarkerSlot; - - public ArgumentsAndBlockTranslation( - RubyNode block, - RubyNode[] arguments, - boolean isSplatted, - ArgumentsDescriptor argumentsDescriptor, - int frameOnStackMarkerSlot) { - super(); - this.block = block; - this.arguments = arguments; - this.argumentsDescriptor = argumentsDescriptor; - this.isSplatted = isSplatted; - this.frameOnStackMarkerSlot = frameOnStackMarkerSlot; - } - - public RubyNode getBlock() { - return block; - } - - public RubyNode[] getArguments() { - return arguments; - } - - public boolean isSplatted() { - return isSplatted; - } - - public int getFrameOnStackMarkerSlot() { - return frameOnStackMarkerSlot; - } - - public ArgumentsDescriptor getArgumentsDescriptor() { - return argumentsDescriptor; - } - } - - public static final int NO_FRAME_ON_STACK_MARKER = -1; private static final ParseNode[] EMPTY_ARGUMENTS = ParseNode.EMPTY_ARRAY; public Deque frameOnStackMarkerSlotStack = new ArrayDeque<>(); @@ -2951,14 +2907,14 @@ public RubyNode visitYieldNode(YieldParseNode node) { final ArgumentsAndBlockTranslation argumentsAndBlock = translateArgumentsAndBlock( node.getPosition(), null, argsNode, ""); - final RubyNode[] argumentsTranslated = argumentsAndBlock.getArguments(); + final RubyNode[] argumentsTranslated = argumentsAndBlock.arguments(); RubyNode readBlock = environment .findLocalVarOrNilNode(TranslatorEnvironment.METHOD_BLOCK_NAME, node.getPosition()); final RubyNode ret = new YieldExpressionNode( argumentsAndBlock.isSplatted(), - argumentsAndBlock.getArgumentsDescriptor(), + argumentsAndBlock.argumentsDescriptor(), argumentsTranslated, readBlock); diff --git a/src/main/java/org/truffleruby/parser/MethodTranslator.java b/src/main/java/org/truffleruby/parser/MethodTranslator.java index 8c47e1fc31db..c56e329bded5 100644 --- a/src/main/java/org/truffleruby/parser/MethodTranslator.java +++ b/src/main/java/org/truffleruby/parser/MethodTranslator.java @@ -450,12 +450,12 @@ public RubyNode visitSuperNode(SuperParseNode node) { environment.getMethodName()); final RubyNode arguments = new ReadSuperArgumentsNode( - argumentsAndBlock.getArguments(), + argumentsAndBlock.arguments(), argumentsAndBlock.isSplatted()); - final RubyNode block = executeOrInheritBlock(argumentsAndBlock.getBlock(), node); + final RubyNode block = executeOrInheritBlock(argumentsAndBlock.block(), node); RubyNode callNode = new SuperCallNode(argumentsAndBlock.isSplatted(), arguments, block, - argumentsAndBlock.getArgumentsDescriptor()); + argumentsAndBlock.argumentsDescriptor()); callNode = wrapCallWithLiteralBlock(argumentsAndBlock, callNode); return withSourceSection(sourceSection, callNode); @@ -501,7 +501,7 @@ public RubyNode visitZSuperNode(ZSuperParseNode node) { : NoKeywordArgumentsDescriptor.INSTANCE; final int restParamIndex = reloadTranslator.getRestParameterIndex(); final RubyNode arguments = new ReadZSuperArgumentsNode(restParamIndex, reloadSequence); - final RubyNode block = executeOrInheritBlock(argumentsAndBlock.getBlock(), node); + final RubyNode block = executeOrInheritBlock(argumentsAndBlock.block(), node); final boolean isSplatted = reloadTranslator.getRestParameterIndex() != -1; RubyNode callNode = new SuperCallNode(isSplatted, arguments, block, descriptor); diff --git a/src/main/java/org/truffleruby/parser/ParseEnvironment.java b/src/main/java/org/truffleruby/parser/ParseEnvironment.java index 551eac77c3ca..460c433dfc25 100644 --- a/src/main/java/org/truffleruby/parser/ParseEnvironment.java +++ b/src/main/java/org/truffleruby/parser/ParseEnvironment.java @@ -10,6 +10,7 @@ package org.truffleruby.parser; import com.oracle.truffle.api.source.Source; +import org.prism.Nodes; import org.truffleruby.RubyLanguage; import org.truffleruby.annotations.SuppressFBWarnings; import org.truffleruby.language.control.BreakID; @@ -24,6 +25,8 @@ public final class ParseEnvironment { private final boolean inCore; private final boolean coverageEnabled; + public Nodes.Source yarpSource = null; + // Set once after parsing and before translating public Boolean allowTruffleRubyPrimitives = null; diff --git a/src/main/java/org/truffleruby/parser/ReloadArgumentsTranslator.java b/src/main/java/org/truffleruby/parser/ReloadArgumentsTranslator.java index d9459a700904..87ab89d3618a 100644 --- a/src/main/java/org/truffleruby/parser/ReloadArgumentsTranslator.java +++ b/src/main/java/org/truffleruby/parser/ReloadArgumentsTranslator.java @@ -101,7 +101,7 @@ public RubyNode[] reload(ArgsParseNode node) { RubyNode kwArgsNode = null; - if (node.hasKwargs()) { + if (node.getKeywordCount() > 0) { final int keywordIndex = node.getKeywordsIndex(); final int keywordCount = node.getKeywordCount(); RubyNode[] keyValues = new RubyNode[keywordCount * 2]; diff --git a/src/main/java/org/truffleruby/parser/Translator.java b/src/main/java/org/truffleruby/parser/Translator.java index cf64a5ac098d..045f97c654ba 100644 --- a/src/main/java/org/truffleruby/parser/Translator.java +++ b/src/main/java/org/truffleruby/parser/Translator.java @@ -19,6 +19,7 @@ import org.truffleruby.language.RubyContextSourceNode; import org.truffleruby.language.RubyNode; import org.truffleruby.language.SourceIndexLength; +import org.truffleruby.language.arguments.ArgumentsDescriptor; import org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor; import org.truffleruby.language.arguments.ProfileArgumentNodeGen; import org.truffleruby.language.arguments.ReadSelfNode; @@ -39,6 +40,8 @@ public abstract class Translator extends AbstractNodeVisitor { + public static final int NO_FRAME_ON_STACK_MARKER = -1; + protected final Source source; protected final ParserContext parserContext; protected final Node currentNode; @@ -190,4 +193,7 @@ protected RubyContextSourceNode createCallNode(RubyNode receiver, String method, return language.coreMethodAssumptions.createCallNode(parameters); } + public record ArgumentsAndBlockTranslation(RubyNode block, RubyNode[] arguments, boolean isSplatted, + ArgumentsDescriptor argumentsDescriptor, int frameOnStackMarkerSlot) { + } } diff --git a/src/main/java/org/truffleruby/parser/TranslatorDriver.java b/src/main/java/org/truffleruby/parser/TranslatorDriver.java index b8196ae38cc4..e96571d165ae 100644 --- a/src/main/java/org/truffleruby/parser/TranslatorDriver.java +++ b/src/main/java/org/truffleruby/parser/TranslatorDriver.java @@ -105,6 +105,11 @@ public TranslatorDriver(RubyContext context, RubySource rubySource) { public RootCallTarget parse(RubySource rubySource, ParserContext parserContext, String[] argumentNames, MaterializedFrame parentFrame, LexicalScope staticLexicalScope, Node currentNode) { + if (language.options.PRISM) { + return new YARPTranslatorDriver(context, rubySource).parse(rubySource, parserContext, argumentNames, + parentFrame, staticLexicalScope, currentNode); + } + if (rubySource.getSource() != parseEnvironment.source) { throw CompilerDirectives.shouldNotReachHere("TranslatorDriver used with a different Source"); } diff --git a/src/main/java/org/truffleruby/parser/TranslatorEnvironment.java b/src/main/java/org/truffleruby/parser/TranslatorEnvironment.java index 53bdf543283a..5ac155fe39a7 100644 --- a/src/main/java/org/truffleruby/parser/TranslatorEnvironment.java +++ b/src/main/java/org/truffleruby/parser/TranslatorEnvironment.java @@ -15,6 +15,7 @@ import java.util.concurrent.atomic.AtomicInteger; import com.oracle.truffle.api.Assumption; +import org.prism.Nodes; import org.truffleruby.Layouts; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.frame.FrameSlotKind; @@ -85,6 +86,10 @@ public final class TranslatorEnvironment { public final String modulePath; public final String methodName; + /** Only set for literal blocks passed to a method, e.g. "foo" for `foo { ... }` */ + public String literalBlockPassedToMethod = null; + /** Only set for def methods */ + public Nodes.ParametersNode parametersNode = null; // TODO(CS): overflow? and it should be per-context, or even more local private static final AtomicInteger tempIndex = new AtomicInteger(); @@ -241,10 +246,12 @@ public int declareLocalTemp(String indicator) { } public Integer findFrameSlotOrNull(Object name) { + assert name != null; return nameToIndex.get(name); } public int findFrameSlot(Object name) { + assert name != null; Integer index = nameToIndex.get(name); if (index == null) { throw CompilerDirectives.shouldNotReachHere("Could not find slot " + name); @@ -279,6 +286,7 @@ public RubyNode findLocalVarOrNilNode(String name, SourceIndexLength sourceSecti } public ReadLocalNode findLocalVarNode(String name, SourceIndexLength sourceSection) { + assert name != null; TranslatorEnvironment current = this; int level = 0; diff --git a/src/main/java/org/truffleruby/parser/YARPBlockNodeTranslator.java b/src/main/java/org/truffleruby/parser/YARPBlockNodeTranslator.java index 1cf572382831..89986441c60f 100644 --- a/src/main/java/org/truffleruby/parser/YARPBlockNodeTranslator.java +++ b/src/main/java/org/truffleruby/parser/YARPBlockNodeTranslator.java @@ -10,6 +10,7 @@ package org.truffleruby.parser; import com.oracle.truffle.api.RootCallTarget; +import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.nodes.NodeUtil; import com.oracle.truffle.api.source.Source; import com.oracle.truffle.api.source.SourceSection; @@ -45,20 +46,20 @@ public final class YARPBlockNodeTranslator extends YARPTranslator { private final Nodes.ParametersNode parameters; private final Arity arity; - private final String currentCallMethodName; public YARPBlockNodeTranslator( RubyLanguage language, TranslatorEnvironment environment, byte[] sourceBytes, Source source, + ParserContext parserContext, + Node currentNode, + RubyDeferredWarnings rubyWarnings, Nodes.ParametersNode parameters, - Arity arity, - String currentCallMethodName) { - super(language, environment, sourceBytes, source, null, null, null); + Arity arity) { + super(language, environment, sourceBytes, source, parserContext, currentNode, rubyWarnings); this.parameters = parameters; this.arity = arity; - this.currentCallMethodName = currentCallMethodName; } public RubyNode compileBlockNode(Nodes.Node body, String[] locals, boolean isStabbyLambda, @@ -86,7 +87,7 @@ public RubyNode compileBlockNode(Nodes.Node body, String[] locals, boolean isSta final RubyNode bodyNode = translateNodeOrNil(body).simplifyAsTailExpression(); - final boolean isLambdaMethodCall = !isStabbyLambda && currentCallMethodName.equals("lambda"); + final boolean isLambdaMethodCall = !isStabbyLambda && environment.literalBlockPassedToMethod.equals("lambda"); final boolean emitLambda = isStabbyLambda || isLambdaMethodCall; final Supplier procCompiler = procCompiler( diff --git a/src/main/java/org/truffleruby/parser/YARPReloadArgumentsTranslator.java b/src/main/java/org/truffleruby/parser/YARPReloadArgumentsTranslator.java new file mode 100644 index 000000000000..32684f3d6182 --- /dev/null +++ b/src/main/java/org/truffleruby/parser/YARPReloadArgumentsTranslator.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved. This + * code is released under a tri EPL/GPL/LGPL license. You can use it, + * redistribute it and/or modify it under the terms of the: + * + * Eclipse Public License version 2.0, or + * GNU General Public License version 2, or + * GNU Lesser General Public License version 2.1. + */ +package org.truffleruby.parser; + +import java.util.ArrayList; +import java.util.List; + +import org.prism.AbstractNodeVisitor; +import org.prism.Nodes; +import org.truffleruby.RubyLanguage; +import org.truffleruby.core.hash.ConcatHashLiteralNode; +import org.truffleruby.core.hash.HashLiteralNode; +import org.truffleruby.language.RubyNode; +import org.truffleruby.language.arguments.MissingArgumentBehavior; +import org.truffleruby.language.arguments.ReadKeywordArgumentNode; +import org.truffleruby.language.arguments.ReadPreArgumentNode; +import org.truffleruby.language.literal.NilLiteralNode; +import org.truffleruby.language.literal.ObjectLiteralNode; + + +/** Produces code to reload arguments from local variables back into the arguments array. Only works for simple cases. + * Used for zsuper calls which pass the same arguments, but will pick up modifications made to them in the method so + * far. */ +public final class YARPReloadArgumentsTranslator extends AbstractNodeVisitor { + + private final RubyLanguage language; + private final YARPTranslator yarpTranslator; + private final boolean hasKeywordArguments; + + private int index = 0; + private int restParameterIndex = -1; + + public YARPReloadArgumentsTranslator( + RubyLanguage language, + YARPTranslator yarpTranslator, + Nodes.ParametersNode parametersNode) { + this.language = language; + this.yarpTranslator = yarpTranslator; + this.hasKeywordArguments = parametersNode.keywords.length > 0 || parametersNode.keyword_rest != null; + } + + public int getRestParameterIndex() { + return restParameterIndex; + } + + public RubyNode[] reload(Nodes.ParametersNode parametersNode) { + final List sequence = new ArrayList<>(); + + for (var node : parametersNode.requireds) { + sequence.add(node.accept(this)); // Nodes.RequiredParameterNode is expected here + index++; + } + + for (var node : parametersNode.optionals) { + sequence.add(node.accept(this)); // Nodes.OptionalParameterNode is expected here + index++; + } + + if (parametersNode.rest != null) { + restParameterIndex = index; + sequence.add(parametersNode.rest.accept(this)); // Nodes.RestParameterNode is expected here + } + + int postCount = parametersNode.posts.length; + if (postCount > 0) { + index = -postCount; + for (var node : parametersNode.posts) { + sequence.add(node.accept(this)); // Nodes.RequiredParameterNode is expected here + index++; + } + } + + RubyNode kwArgsNode = null; + + if (parametersNode.keywords.length > 0) { + final int keywordCount = parametersNode.keywords.length; + RubyNode[] keyValues = new RubyNode[keywordCount * 2]; + + for (int i = 0; i < keywordCount; i++) { + // Nodes.RequiredKeywordParameterNode/Nodes.OptionalKeywordParameterNode are expected here + final Nodes.Node kwArg = parametersNode.keywords[i]; + final RubyNode value = kwArg.accept(this); + var name = ((ReadKeywordArgumentNode) value).getName(); + RubyNode key = new ObjectLiteralNode(name); + keyValues[2 * i] = key; + keyValues[2 * i + 1] = value; + } + kwArgsNode = HashLiteralNode.create(keyValues); + } + + if (parametersNode.keyword_rest != null) { + // Nodes.KeywordRestParameterNode/Nodes.NoKeywordsParameterNode are expected here + final RubyNode keyRest = parametersNode.keyword_rest.accept(this); + if (kwArgsNode == null) { + kwArgsNode = keyRest; + } else { + kwArgsNode = new ConcatHashLiteralNode(new RubyNode[]{ kwArgsNode, keyRest }); + } + + } + + if (kwArgsNode != null) { + sequence.add(kwArgsNode); + } + + return sequence.toArray(RubyNode.EMPTY_ARRAY); + } + + @Override + public RubyNode visitRequiredParameterNode(Nodes.RequiredParameterNode node) { + return yarpTranslator.getEnvironment().findLocalVarNode(node.name, null); + } + + @Override + public RubyNode visitOptionalParameterNode(Nodes.OptionalParameterNode node) { + return yarpTranslator.getEnvironment().findLocalVarNode(node.name, null); + } + + @Override + public RubyNode visitMultiTargetNode(Nodes.MultiTargetNode node) { + return Translator.profileArgument(language, + new ReadPreArgumentNode(index, hasKeywordArguments, MissingArgumentBehavior.NIL)); + } + + @Override + public RubyNode visitRestParameterNode(Nodes.RestParameterNode node) { + return yarpTranslator.getEnvironment().findLocalVarNode(node.name, null); + } + + @Override + public RubyNode visitRequiredKeywordParameterNode(Nodes.RequiredKeywordParameterNode node) { + return yarpTranslator.getEnvironment().findLocalVarNode(node.name, null); + } + + @Override + public RubyNode visitOptionalKeywordParameterNode(Nodes.OptionalKeywordParameterNode node) { + return yarpTranslator.getEnvironment().findLocalVarNode(node.name, null); + } + + @Override + public RubyNode visitKeywordRestParameterNode(Nodes.KeywordRestParameterNode node) { + return yarpTranslator.getEnvironment().findLocalVarNode(node.name, null); + } + + @Override + public RubyNode visitNoKeywordsParameterNode(Nodes.NoKeywordsParameterNode node) { + return defaultVisit(node); + } + + @Override + protected RubyNode defaultVisit(Nodes.Node node) { + var nilNode = new NilLiteralNode(); + return YARPTranslator.assignPositionAndFlags(node, nilNode); + } + +} diff --git a/src/main/java/org/truffleruby/parser/YARPTranslator.java b/src/main/java/org/truffleruby/parser/YARPTranslator.java index febea48f6ba0..83f70df6c54e 100644 --- a/src/main/java/org/truffleruby/parser/YARPTranslator.java +++ b/src/main/java/org/truffleruby/parser/YARPTranslator.java @@ -15,6 +15,8 @@ import com.oracle.truffle.api.source.Source; import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.api.strings.TruffleString; +import org.jcodings.specific.EUCJPEncoding; +import org.jcodings.specific.Windows_31JEncoding; import org.truffleruby.RubyContext; import org.truffleruby.RubyLanguage; import org.truffleruby.annotations.Split; @@ -36,10 +38,19 @@ import org.truffleruby.core.hash.ConcatHashLiteralNode; import org.truffleruby.core.hash.HashLiteralNode; import org.truffleruby.core.module.ModuleNodes; +import org.truffleruby.core.numeric.RubyBignum; +import org.truffleruby.core.range.RangeNodesFactory; +import org.truffleruby.core.range.RubyIntRange; +import org.truffleruby.core.range.RubyLongRange; +import org.truffleruby.core.regexp.InterpolatedRegexpNode; +import org.truffleruby.core.regexp.RegexpOptions; +import org.truffleruby.core.regexp.RubyRegexp; import org.truffleruby.core.rescue.AssignRescueVariableNode; +import org.truffleruby.core.string.ConvertBytes; import org.truffleruby.core.string.FrozenStrings; import org.truffleruby.core.string.ImmutableRubyString; import org.truffleruby.core.string.InterpolatedStringNode; +import org.truffleruby.core.string.KCode; import org.truffleruby.core.string.StringUtils; import org.truffleruby.core.symbol.RubySymbol; import org.truffleruby.debug.ChaosNode; @@ -51,6 +62,7 @@ import org.truffleruby.language.RubyTopLevelRootNode; import org.truffleruby.language.SourceIndexLength; import org.truffleruby.language.arguments.ArgumentsDescriptor; +import org.truffleruby.language.arguments.KeywordArgumentsDescriptorManager; import org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor; import org.truffleruby.language.arguments.ProfileArgumentNodeGen; import org.truffleruby.language.arguments.ReadSelfNode; @@ -60,6 +72,7 @@ import org.truffleruby.language.constants.WriteConstantNode; import org.truffleruby.language.control.AndNodeGen; import org.truffleruby.language.control.BreakNode; +import org.truffleruby.language.control.DeferredRaiseException; import org.truffleruby.language.control.DynamicReturnNode; import org.truffleruby.language.control.FrameOnStackNode; import org.truffleruby.language.control.IfElseNode; @@ -69,6 +82,8 @@ import org.truffleruby.language.control.LocalReturnNode; import org.truffleruby.language.control.NextNode; import org.truffleruby.language.control.NotNodeGen; +import org.truffleruby.language.control.OnceNode; +import org.truffleruby.language.control.OrLazyValueDefinedNodeGen; import org.truffleruby.language.control.OrNodeGen; import org.truffleruby.language.control.RaiseException; import org.truffleruby.language.control.RedoNode; @@ -95,6 +110,7 @@ import org.truffleruby.language.literal.FloatLiteralNode; import org.truffleruby.language.literal.FrozenStringLiteralNode; import org.truffleruby.language.literal.IntegerFixnumLiteralNode; +import org.truffleruby.language.literal.LongFixnumLiteralNode; import org.truffleruby.language.literal.NilLiteralNode; import org.truffleruby.language.literal.ObjectClassLiteralNode; import org.truffleruby.language.literal.ObjectLiteralNode; @@ -130,6 +146,12 @@ import org.truffleruby.language.objects.classvariables.WriteClassVariableNode; import org.prism.AbstractNodeVisitor; import org.prism.Nodes; +import org.truffleruby.language.supercall.ReadSuperArgumentsNode; +import org.truffleruby.language.supercall.ReadZSuperArgumentsNode; +import org.truffleruby.language.supercall.SuperCallNode; +import org.truffleruby.language.supercall.ZSuperOutsideMethodNode; +import org.truffleruby.language.yield.YieldExpressionNode; +import org.truffleruby.parser.Translator.ArgumentsAndBlockTranslation; import org.truffleruby.parser.parser.ParserSupport; import java.util.ArrayDeque; @@ -137,6 +159,7 @@ import java.util.Arrays; import java.util.Deque; import java.util.List; +import java.util.Objects; import static org.truffleruby.parser.TranslatorEnvironment.DEFAULT_KEYWORD_REST_NAME; import static org.truffleruby.parser.TranslatorEnvironment.FORWARDED_BLOCK_NAME; @@ -153,26 +176,31 @@ public class YARPTranslator extends AbstractNodeVisitor { protected final RubyLanguage language; protected final TranslatorEnvironment environment; + // TODO: Since these fields don't seem to change per translator instance we could/should store them in ParseEnvironment + private final ParserContext parserContext; private final byte[] sourceBytes; private final Source source; - private final ParserContext parserContext; private final Node currentNode; private final RubyDeferredWarnings rubyWarnings; private final RubyEncoding sourceEncoding; public Deque frameOnStackMarkerSlotStack = new ArrayDeque<>(); - public static final int NO_FRAME_ON_STACK_MARKER = -1; + public static final int NO_FRAME_ON_STACK_MARKER = Translator.NO_FRAME_ON_STACK_MARKER; + + public static final Nodes.Node[] EMPTY_NODE_ARRAY = Nodes.Node.EMPTY_ARRAY; + public static final Nodes.ParametersNode ZERO_PARAMETERS_NODE = new Nodes.ParametersNode(EMPTY_NODE_ARRAY, + EMPTY_NODE_ARRAY, null, EMPTY_NODE_ARRAY, EMPTY_NODE_ARRAY, null, null, 0, 0); public static final RescueNode[] EMPTY_RESCUE_NODE_ARRAY = new RescueNode[0]; + protected static final short NO_FLAGS = 0; + private boolean translatingWhile = false; private boolean translatingNextExpression = false; private boolean translatingForStatement = false; - private String currentCallMethodName = null; - public YARPTranslator( RubyLanguage language, TranslatorEnvironment environment, @@ -191,6 +219,10 @@ public YARPTranslator( this.sourceEncoding = Encodings.UTF_8; // TODO } + public TranslatorEnvironment getEnvironment() { + return environment; + } + public RubyRootNode translate(Nodes.Node node) { var body = node.accept(this); var frameDescriptor = TranslatorEnvironment.newFrameDescriptorBuilderForMethod().build(); @@ -205,8 +237,7 @@ public RubyRootNode translate(Nodes.Node node) { public RubyNode visitAliasGlobalVariableNode(Nodes.AliasGlobalVariableNode node) { RubyNode rubyNode = new AliasGlobalVarNode(toString(node.old_name), toString(node.new_name)); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -217,8 +248,7 @@ public RubyNode visitAliasMethodNode(Nodes.AliasMethodNode node) { node.new_name.accept(this), node.old_name.accept(this)); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -232,8 +262,7 @@ public RubyNode visitAndNode(Nodes.AndNode node) { RubyNode right = node.right.accept(this); RubyNode rubyNode = AndNodeGen.create(left, right); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -246,17 +275,15 @@ public RubyNode visitArgumentsNode(Nodes.ArgumentsNode node) { final RubyNode[] translatedValues = translate(values); final RubyNode rubyNode = ArrayLiteralNode.create(language, translatedValues); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitArrayNode(Nodes.ArrayNode node) { RubyNode[] elements = translate(node.elements); RubyNode rubyNode = ArrayLiteralNode.create(language, elements); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -267,8 +294,7 @@ public RubyNode visitArrayPatternNode(Nodes.ArrayPatternNode node) { @Override public RubyNode visitBackReferenceReadNode(Nodes.BackReferenceReadNode node) { final RubyNode rubyNode = ReadGlobalVariableNodeGen.create(node.name); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -323,7 +349,7 @@ public RubyNode visitBeginNode(Nodes.BeginNode node) { final RescueNode rescueNode = new RescueSplatNode(language, splatTranslated, translatedBody); - assignNodePositionInSource(splatNode, rescueNode); + assignPositionAndFlags(splatNode, rescueNode); rescueNodes.add(rescueNode); } else { @@ -348,7 +374,7 @@ public RubyNode visitBeginNode(Nodes.BeginNode node) { } final RescueStandardErrorNode rescueNode = new RescueStandardErrorNode(translatedBody); - assignNodePositionInSource(rescueClause, rescueNode); + assignPositionAndFlags(rescueClause, rescueNode); rescueNodes.add(rescueNode); } @@ -378,34 +404,38 @@ public RubyNode visitBeginNode(Nodes.BeginNode node) { rescueNodes.toArray(EMPTY_RESCUE_NODE_ARRAY), elsePart, canOmitBacktrace); - assignNodePositionInSource(node, rubyNode); + assignPositionAndFlags(node, rubyNode); } // with ensure section if (node.ensure_clause != null && node.ensure_clause.statements != null) { final RubyNode ensureBlock = node.ensure_clause.accept(this); rubyNode = EnsureNodeGen.create(rubyNode, ensureBlock); - assignNodePositionInSource(node, rubyNode); + assignPositionOnly(node, rubyNode); } return rubyNode; } private RescueNode translateExceptionNodes(ArrayList exceptionNodes, Nodes.RescueNode rescueClause) { - RubyNode translatedBody = translateNodeOrNil(rescueClause.statements); - final Nodes.Node[] exceptionNodesArray = exceptionNodes.toArray(Nodes.Node.EMPTY_ARRAY); + final Nodes.Node[] exceptionNodesArray = exceptionNodes.toArray(EMPTY_NODE_ARRAY); final RubyNode[] handlingClasses = translate(exceptionNodesArray); + RubyNode translatedBody; if (rescueClause.reference != null) { - final RubyNode exceptionWriteNode = translateRescueException( - rescueClause.reference); + // We need to translate the reference before the statements, + // because the statements can use the variable defined by the reference. + final RubyNode exceptionWriteNode = translateRescueException(rescueClause.reference); + var translatedStatements = translateNodeOrNil(rescueClause.statements); translatedBody = sequence(rescueClause, - Arrays.asList(exceptionWriteNode, translatedBody)); + Arrays.asList(exceptionWriteNode, translatedStatements)); + } else { + translatedBody = translateNodeOrNil(rescueClause.statements); } final RescueNode rescueNode = new RescueClassesNode(handlingClasses, translatedBody); - assignNodePositionInSource(exceptionNodesArray, rescueNode); + assignPositionOnly(exceptionNodesArray, rescueNode); return rescueNode; } @@ -416,11 +446,16 @@ public RubyNode visitBlockArgumentNode(Nodes.BlockArgumentNode node) { @Override public RubyNode visitBlockNode(Nodes.BlockNode node) { - return translateBlockAndLambda(node, node.parameters, node.body, node.locals); + throw CompilerDirectives.shouldNotReachHere( + "BlockNode should be translated specially by its parent node to pass the method name to which the block is passed"); + } + + private RubyNode visitBlockNode(Nodes.BlockNode node, String literalBlockPassedToMethod) { + return translateBlockAndLambda(node, node.parameters, node.body, node.locals, literalBlockPassedToMethod); } private RubyNode translateBlockAndLambda(Nodes.Node node, Nodes.BlockParametersNode blockParameters, - Nodes.Node body, String[] locals) { + Nodes.Node body, String[] locals, String literalBlockPassedToMethod) { final boolean isStabbyLambda = node instanceof Nodes.LambdaNode; final boolean hasOwnScope = true; @@ -451,8 +486,8 @@ private RubyNode translateBlockAndLambda(Nodes.Node node, Nodes.BlockParametersN for (int i = 1; i <= max; i++) { requireds[i - 1] = new Nodes.RequiredParameterNode("_" + i, 0, 0); } - parameters = new Nodes.ParametersNode(requireds, Nodes.Node.EMPTY_ARRAY, null, Nodes.Node.EMPTY_ARRAY, - Nodes.Node.EMPTY_ARRAY, null, null, 0, 0); + parameters = new Nodes.ParametersNode(requireds, EMPTY_NODE_ARRAY, null, EMPTY_NODE_ARRAY, + EMPTY_NODE_ARRAY, null, null, 0, 0); } else { // no numbered parameters parameters = null; @@ -492,14 +527,18 @@ private RubyNode translateBlockAndLambda(Nodes.Node node, Nodes.BlockParametersN parseEnvironment.allocateBreakID(), null, environment.modulePath); + newEnvironment.literalBlockPassedToMethod = literalBlockPassedToMethod; + final YARPBlockNodeTranslator methodCompiler = new YARPBlockNodeTranslator( language, newEnvironment, sourceBytes, source, + parserContext, + currentNode, + rubyWarnings, parameters, - arity, - currentCallMethodName); + arity); methodCompiler.frameOnStackMarkerSlotStack = frameOnStackMarkerSlotStack; @@ -509,8 +548,7 @@ private RubyNode translateBlockAndLambda(Nodes.Node node, Nodes.BlockParametersN isStabbyLambda, getSourceSection(node)); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -530,9 +568,7 @@ public RubyNode visitBreakNode(Nodes.BreakNode node) { final RubyNode argumentsNode = translateControlFlowArguments(node.arguments); final RubyNode rubyNode = new BreakNode(environment.getBreakID(), translatingWhile, argumentsNode); - assignNodePositionInSource(node, rubyNode); - - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -544,45 +580,28 @@ public RubyNode visitCallAndWriteNode(Nodes.CallAndWriteNode node) { public RubyNode visitCallNode(Nodes.CallNode node) { var methodName = node.name; var receiver = node.receiver == null ? new SelfNode() : node.receiver.accept(this); - final Nodes.Node[] arguments; - - if (node.arguments == null) { - arguments = Nodes.Node.EMPTY_ARRAY; - } else { - arguments = node.arguments.arguments; - } - var translatedArguments = translate(arguments); - var argumentsDescriptor = getKeywordArgumentsDescriptor(arguments); + var argumentsAndBlock = translateArgumentsAndBlock(node.arguments, node.block, methodName); + var translatedArguments = argumentsAndBlock.arguments(); // If the receiver is explicit or implicit 'self' then we can call private methods final boolean ignoreVisibility = node.receiver == null || node.receiver instanceof Nodes.SelfNode; final boolean isVariableCall = node.isVariableCall(); - // this check isn't accurate and doesn't handle cases like #===, #!=, a.foo=(42) + // This isn't fully accurate and doesn't handle cases like #===, #!=, a.foo=(42) // the issue is tracked in https://github.com/ruby/prism/issues/1715 - final boolean isAttrAssign = methodName.endsWith("="); + final boolean isAttrAssign = isAttrAssign(node.name); final boolean isSafeNavigation = node.isSafeNavigation(); - boolean isSplatted = false; - for (var n : arguments) { // check if there is splat operator in the arguments list - if (n instanceof Nodes.SplatNode) { - isSplatted = true; - break; - } - } - // No need to copy the array for call(*splat), the elements will be copied to the frame arguments - if (isSplatted && translatedArguments.length == 1 && + if (argumentsAndBlock.isSplatted() && translatedArguments.length == 1 && translatedArguments[0] instanceof SplatCastNode splatNode) { splatNode.doNotCopy(); } - // TODO (pitr-ch 02-Dec-2019): replace with a primitive if (environment.getParseEnvironment().inCore() && isVariableCall && methodName.equals("undefined")) { // translate undefined final RubyNode rubyNode = new ObjectLiteralNode(NotProvided.INSTANCE); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } if (node.receiver instanceof Nodes.StringNode stringNode && @@ -591,45 +610,84 @@ public RubyNode visitCallNode(Nodes.CallNode node) { final ImmutableRubyString frozenString = language.getFrozenStringLiteral(tstring, sourceEncoding); final RubyNode rubyNode = new FrozenStringLiteralNode(frozenString, FrozenStrings.METHOD); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } // Translates something that looks like // Primitive.foo arg1, arg2, argN // into - // InvokePrimitiveNode(FooNode(arg1, arg2, ..., argN)) + // FooPrimitiveNode(arg1, arg2, ..., argN) if (environment.getParseEnvironment().canUsePrimitives() && node.receiver instanceof Nodes.ConstantReadNode constantReadNode && - toString(constantReadNode).equals("Primitive")) { + constantReadNode.name.equals("Primitive")) { final PrimitiveNodeConstructor constructor = language.primitiveManager.getPrimitive(methodName); // TODO: avoid SourceIndexLength final SourceIndexLength sourceSection = new SourceIndexLength(node.startOffset, node.length); - final RubyNode rubyNode = constructor.createInvokePrimitiveNode(source, sourceSection, translatedArguments); + return constructor.createInvokePrimitiveNode(source, sourceSection, translatedArguments); + } - return rubyNode; + final var callNodeParameters = new RubyCallNodeParameters( + receiver, + methodName, + argumentsAndBlock.block(), + argumentsAndBlock.argumentsDescriptor(), + translatedArguments, + argumentsAndBlock.isSplatted(), + ignoreVisibility, + isVariableCall, + isSafeNavigation, + isAttrAssign); + final RubyNode callNode = language.coreMethodAssumptions.createCallNode(callNodeParameters); + + final var rubyNode = wrapCallWithLiteralBlock(argumentsAndBlock, callNode); + return assignPositionAndFlags(node, rubyNode); + } + + private static RubyNode wrapCallWithLiteralBlock(ArgumentsAndBlockTranslation argumentsAndBlock, + RubyNode callNode) { + // wrap call node with literal block + if (argumentsAndBlock.block() instanceof BlockDefinitionNode blockDef) { + // if we have a literal block, `break` breaks out of this call site + final var frameOnStackNode = new FrameOnStackNode(callNode, argumentsAndBlock.frameOnStackMarkerSlot()); + return new CatchBreakNode(blockDef.getBreakID(), frameOnStackNode, false); + } else { + return callNode; + } + } + + private ArgumentsAndBlockTranslation translateArgumentsAndBlock(Nodes.ArgumentsNode argumentsNode, Nodes.Node block, + String methodName) { + final Nodes.Node[] arguments; + if (argumentsNode == null) { + arguments = EMPTY_NODE_ARRAY; + } else { + arguments = argumentsNode.arguments; + } + + boolean isSplatted = containYARPSplatNode(arguments); + var argumentsDescriptor = getKeywordArgumentsDescriptor(arguments); + + final RubyNode[] translatedArguments; + if (isSplatted) { + translatedArguments = new RubyNode[]{ translateExpressionsList(arguments) }; + } else { + translatedArguments = translate(arguments); } final RubyNode blockNode; final int frameOnStackMarkerSlot; - if (node.block != null) { - if (node.block instanceof Nodes.BlockNode) { + if (block != null) { + if (block instanceof Nodes.BlockNode b) { // a() {} - final String oldCurrentCallMethodName = currentCallMethodName; - currentCallMethodName = methodName; - frameOnStackMarkerSlot = environment.declareLocalTemp("frame_on_stack_marker"); frameOnStackMarkerSlotStack.push(frameOnStackMarkerSlot); - try { - blockNode = node.block.accept(this); + blockNode = visitBlockNode(b, methodName); } finally { frameOnStackMarkerSlotStack.pop(); } - - currentCallMethodName = oldCurrentCallMethodName; - } else if (node.block instanceof Nodes.BlockArgumentNode blockArgument) { + } else if (block instanceof Nodes.BlockArgumentNode blockArgument) { // def a(&) b(&) end assert blockArgument.expression != null; // Ruby 3.1's anonymous block parameter, that we don't support yet @@ -644,32 +702,8 @@ public RubyNode visitCallNode(Nodes.CallNode node) { frameOnStackMarkerSlot = NO_FRAME_ON_STACK_MARKER; } - final var callNodeParameters = new RubyCallNodeParameters( - receiver, - methodName, - blockNode, - argumentsDescriptor, - translatedArguments, - isSplatted, - ignoreVisibility, - isVariableCall, - isSafeNavigation, - isAttrAssign); - final RubyNode callNode = language.coreMethodAssumptions.createCallNode(callNodeParameters); - final RubyNode rubyNode; - - // wrap call node with literal block - if (blockNode instanceof BlockDefinitionNode) { - // if we have a literal block, `break` breaks out of this call site - final var frameOnStackNode = new FrameOnStackNode(callNode, frameOnStackMarkerSlot); - final var blockDef = (BlockDefinitionNode) blockNode; - rubyNode = new CatchBreakNode(blockDef.getBreakID(), frameOnStackNode, false); - } else { - rubyNode = callNode; - } - - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return new ArgumentsAndBlockTranslation(blockNode, translatedArguments, isSplatted, argumentsDescriptor, + frameOnStackMarkerSlot); } private ArgumentsDescriptor getKeywordArgumentsDescriptor(Nodes.Node[] arguments) { @@ -707,6 +741,14 @@ private ArgumentsDescriptor getKeywordArgumentsDescriptor(Nodes.Node[] arguments } } + private boolean isAttrAssign(String methodName) { + if (!methodName.endsWith("=") || methodName.length() < 2) { + return false; + } + char before = methodName.charAt(methodName.length() - 2); + return before != '=' && before != '!' && before != '<' && before != '>'; + } + @Override public RubyNode visitCallOperatorWriteNode(Nodes.CallOperatorWriteNode node) { return defaultVisit(node); @@ -856,8 +898,7 @@ public RubyNode visitCaseNode(Nodes.CaseNode node) { rubyNode = elseNode; } - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -881,8 +922,7 @@ public RubyNode visitClassNode(Nodes.ClassNode node) { OpenModule.CLASS, shouldUseDynamicConstantLookupForModuleBody(node)); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -892,12 +932,23 @@ public RubyNode visitClassVariableAndWriteNode(Nodes.ClassVariableAndWriteNode n @Override public RubyNode visitClassVariableOperatorWriteNode(Nodes.ClassVariableOperatorWriteNode node) { - return defaultVisit(node); + int startOffset = node.startOffset; + int length = node.length; + var readNode = new Nodes.ClassVariableReadNode(node.name, startOffset, length); + var desugared = new Nodes.ClassVariableWriteNode(node.name, + callNode(node, readNode, node.operator, node.value), startOffset, length); + return desugared.accept(this); } @Override public RubyNode visitClassVariableOrWriteNode(Nodes.ClassVariableOrWriteNode node) { - return defaultVisit(node); + int startOffset = node.startOffset; + int length = node.length; + var writeNode = new Nodes.ClassVariableWriteNode(node.name, node.value, startOffset, length).accept(this); + var readNode = new Nodes.ClassVariableReadNode(node.name, startOffset, length).accept(this); + var definedCheck = AndNodeGen.create(new DefinedNode(readNode), readNode); + final RubyNode rubyNode = OrLazyValueDefinedNodeGen.create(definedCheck, writeNode); + return assignPositionAndFlags(node, rubyNode); } @Override @@ -906,8 +957,7 @@ public RubyNode visitClassVariableReadNode(Nodes.ClassVariableReadNode node) { getLexicalScopeNode("class variable lookup", node), node.name); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -918,8 +968,7 @@ public RubyNode visitClassVariableWriteNode(Nodes.ClassVariableWriteNode node) { node.name, rhs); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -929,8 +978,7 @@ public RubyNode visitClassVariableTargetNode(Nodes.ClassVariableTargetNode node) node.name, null); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -973,8 +1021,7 @@ public RubyNode visitConstantPathNode(Nodes.ConstantPathNode node) { final RubyNode rubyNode = new ReadConstantNode(moduleNode, name); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1004,8 +1051,7 @@ public RubyNode visitConstantPathWriteNode(Nodes.ConstantPathWriteNode node) { final RubyNode value = node.value.accept(this); final RubyNode rubyNode = new WriteConstantNode(name, moduleNode, value); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1022,8 +1068,7 @@ public RubyNode visitConstantPathTargetNode(Nodes.ConstantPathTargetNode node) { final String name = ((Nodes.ConstantReadNode) node.child).name; final RubyNode rubyNode = new WriteConstantNode(name, moduleNode, null); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1042,8 +1087,7 @@ public RubyNode visitConstantReadNode(Nodes.ConstantReadNode node) { rubyNode = new ReadConstantWithLexicalScopeNode(lexicalScope, node.name); } - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1052,8 +1096,7 @@ public RubyNode visitConstantWriteNode(Nodes.ConstantWriteNode node) { final RubyNode moduleNode = getLexicalScopeModuleNode("set dynamic constant", node); final RubyNode rubyNode = new WriteConstantNode(node.name, moduleNode, value); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1061,8 +1104,7 @@ public RubyNode visitConstantTargetNode(Nodes.ConstantTargetNode node) { final RubyNode moduleNode = getLexicalScopeModuleNode("set dynamic constant", node); final RubyNode rubyNode = new WriteConstantNode(node.name, moduleNode, null); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1104,6 +1146,7 @@ public RubyNode visitDefNode(Nodes.DefNode node) { null, null, environment.modulePath); + newEnvironment.parametersNode = node.parameters; final var defNodeTranslator = new YARPDefNodeTranslator( language, @@ -1124,8 +1167,7 @@ public RubyNode visitDefNode(Nodes.DefNode node) { isDefSingleton, callTargetSupplier); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1133,23 +1175,19 @@ public RubyNode visitDefinedNode(Nodes.DefinedNode node) { // Handle defined?(yield) explicitly otherwise it would raise SyntaxError if (node.value instanceof Nodes.YieldNode && isInvalidYield()) { final var nilNode = new NilLiteralNode(); - assignNodePositionInSource(node, nilNode); - - return nilNode; + return assignPositionAndFlags(node, nilNode); } final RubyNode value = node.value.accept(this); final RubyNode rubyNode = new DefinedNode(value); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitElseNode(Nodes.ElseNode node) { if (node.statements == null) { final RubyNode rubyNode = new NilLiteralNode(); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } return node.statements.accept(this); } @@ -1160,8 +1198,7 @@ public RubyNode visitEmbeddedStatementsNode(Nodes.EmbeddedStatementsNode node) { if (node.statements == null) { RubyNode rubyNode = new ObjectLiteralNode( language.getFrozenStringLiteral(sourceEncoding.tencoding.getEmpty(), sourceEncoding)); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } return node.statements.accept(this); @@ -1176,8 +1213,7 @@ public RubyNode visitEmbeddedVariableNode(Nodes.EmbeddedVariableNode node) { public RubyNode visitEnsureNode(Nodes.EnsureNode node) { if (node.statements == null) { final RubyNode rubyNode = new NilLiteralNode(); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } return node.statements.accept(this); @@ -1186,8 +1222,7 @@ public RubyNode visitEnsureNode(Nodes.EnsureNode node) { @Override public RubyNode visitFalseNode(Nodes.FalseNode node) { RubyNode rubyNode = new BooleanLiteralNode(false); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1204,8 +1239,7 @@ public RubyNode visitFlipFlopNode(Nodes.FlipFlopNode node) { final RubyNode rubyNode = FlipFlopNodeGen.create(begin, end, node.isExcludeEnd(), slotAndDepth.depth, slotAndDepth.slot); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1222,8 +1256,7 @@ public RubyNode visitFloatNode(Nodes.FloatNode node) { } final RubyNode rubyNode = new FloatLiteralNode(value); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1238,7 +1271,41 @@ public RubyNode visitForwardingArgumentsNode(Nodes.ForwardingArgumentsNode node) @Override public RubyNode visitForwardingSuperNode(Nodes.ForwardingSuperNode node) { - return defaultVisit(node); + var argumentsAndBlock = translateArgumentsAndBlock(null, node.block, environment.getMethodName()); + + boolean insideDefineMethod = false; + var environment = this.environment; + while (environment.isBlock()) { + if (environment.isModuleBody()) { + return assignPositionAndFlags(node, new ZSuperOutsideMethodNode(insideDefineMethod)); + } else if (Objects.equals(environment.literalBlockPassedToMethod, "define_method")) { + insideDefineMethod = true; + } + environment = environment.getParent(); + } + + // TODO: could we use the ArgumentDescriptor[] stored in the SharedMethodInfo instead? + var parametersNode = environment.parametersNode; + if (parametersNode == null) { + // parametersNode == null for a method means zero parameters: https://github.com/ruby/prism/issues/1915 + parametersNode = ZERO_PARAMETERS_NODE; + } + var reloadTranslator = new YARPReloadArgumentsTranslator(language, this, parametersNode); + + final RubyNode[] reloadSequence = reloadTranslator.reload(parametersNode); + + var descriptor = (parametersNode.keywords.length > 0 || parametersNode.keyword_rest != null) + ? KeywordArgumentsDescriptorManager.EMPTY + : NoKeywordArgumentsDescriptor.INSTANCE; + final int restParamIndex = reloadTranslator.getRestParameterIndex(); + final RubyNode arguments = new ReadZSuperArgumentsNode(restParamIndex, reloadSequence); + final RubyNode block = executeOrInheritBlock(argumentsAndBlock.block()); + final boolean isSplatted = reloadTranslator.getRestParameterIndex() != -1; + + RubyNode callNode = new SuperCallNode(isSplatted, arguments, block, descriptor); + callNode = wrapCallWithLiteralBlock(argumentsAndBlock, callNode); + + return assignPositionAndFlags(node, callNode); } @Override @@ -1248,19 +1315,29 @@ public RubyNode visitGlobalVariableAndWriteNode(Nodes.GlobalVariableAndWriteNode @Override public RubyNode visitGlobalVariableOperatorWriteNode(Nodes.GlobalVariableOperatorWriteNode node) { - return defaultVisit(node); + int startOffset = node.startOffset; + int length = node.length; + var readNode = new Nodes.GlobalVariableReadNode(node.name, startOffset, length); + var desugared = new Nodes.GlobalVariableWriteNode(node.name, + callNode(node, readNode, node.operator, node.value), startOffset, length); + return desugared.accept(this); } @Override public RubyNode visitGlobalVariableOrWriteNode(Nodes.GlobalVariableOrWriteNode node) { - return defaultVisit(node); + int startOffset = node.startOffset; + int length = node.length; + var writeNode = new Nodes.GlobalVariableWriteNode(node.name, node.value, startOffset, length).accept(this); + var readNode = new Nodes.GlobalVariableReadNode(node.name, startOffset, length).accept(this); + var definedCheck = AndNodeGen.create(new DefinedNode(readNode), readNode); + final RubyNode rubyNode = OrLazyValueDefinedNodeGen.create(definedCheck, writeNode); + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitGlobalVariableReadNode(Nodes.GlobalVariableReadNode node) { final RubyNode rubyNode = ReadGlobalVariableNodeGen.create(node.name); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1268,24 +1345,21 @@ public RubyNode visitGlobalVariableWriteNode(Nodes.GlobalVariableWriteNode node) final RubyNode value = node.value.accept(this); final RubyNode rubyNode = WriteGlobalVariableNodeGen.create(node.name, value); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitGlobalVariableTargetNode(Nodes.GlobalVariableTargetNode node) { final RubyNode rubyNode = WriteGlobalVariableNodeGen.create(node.name, null); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitHashNode(Nodes.HashNode node) { if (node.elements.length == 0) { // an empty Hash literal like h = {} final RubyNode rubyNode = HashLiteralNode.create(RubyNode.EMPTY_ARRAY); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } final List hashConcats = new ArrayList<>(); @@ -1325,13 +1399,11 @@ public RubyNode visitHashNode(Nodes.HashNode node) { if (hashConcats.size() == 1) { final RubyNode rubyNode = hashConcats.get(0); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } final RubyNode rubyNode = new ConcatHashLiteralNode(hashConcats.toArray(RubyNode.EMPTY_ARRAY)); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1348,20 +1420,18 @@ public RubyNode visitIfNode(Nodes.IfNode node) { if (thenNode != null && elseNode != null) { rubyNode = IfElseNodeGen.create(conditionNode, thenNode, elseNode); - assignNodePositionInSource(node, rubyNode); + return assignPositionAndFlags(node, rubyNode); } else if (thenNode != null) { rubyNode = IfNodeGen.create(conditionNode, thenNode); - assignNodePositionInSource(node, rubyNode); + return assignPositionAndFlags(node, rubyNode); } else if (elseNode != null) { rubyNode = UnlessNodeGen.create(conditionNode, elseNode); - assignNodePositionInSource(node, rubyNode); + return assignPositionAndFlags(node, rubyNode); } else { // if (condition) // end - rubyNode = sequence(node, Arrays.asList(conditionNode, new NilLiteralNode())); + return sequence(node, Arrays.asList(conditionNode, new NilLiteralNode())); } - - return rubyNode; } @Override @@ -1376,8 +1446,7 @@ public RubyNode visitImaginaryNode(Nodes.ImaginaryNode node) { RubyNode[] arguments = new RubyNode[]{ realComponentNode, imaginaryComponentNode }; RubyNode rubyNode = createCallNode(complexModuleNode, "convert", arguments); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1412,69 +1481,65 @@ public RubyNode visitInstanceVariableAndWriteNode(Nodes.InstanceVariableAndWrite @Override public RubyNode visitInstanceVariableOperatorWriteNode(Nodes.InstanceVariableOperatorWriteNode node) { - return defaultVisit(node); + int startOffset = node.startOffset; + int length = node.length; + var readNode = new Nodes.InstanceVariableReadNode(node.name, startOffset, length); + var desugared = new Nodes.InstanceVariableWriteNode(node.name, + callNode(node, readNode, node.operator, node.value), startOffset, length); + return desugared.accept(this); } @Override public RubyNode visitInstanceVariableOrWriteNode(Nodes.InstanceVariableOrWriteNode node) { - return defaultVisit(node); + // No need to check `defined?(@ivar)` before reading, as `@ivar` even if not set returns nil and does not have side effects + int startOffset = node.startOffset; + int length = node.length; + var writeNode = new Nodes.InstanceVariableWriteNode(node.name, node.value, startOffset, length).accept(this); + var readNode = new Nodes.InstanceVariableReadNode(node.name, startOffset, length).accept(this); + final RubyNode rubyNode = OrLazyValueDefinedNodeGen.create(readNode, writeNode); + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitInstanceVariableReadNode(Nodes.InstanceVariableReadNode node) { final RubyNode rubyNode = new ReadInstanceVariableNode(node.name); - - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitInstanceVariableWriteNode(Nodes.InstanceVariableWriteNode node) { final RubyNode value = node.value.accept(this); final RubyNode rubyNode = WriteInstanceVariableNodeGen.create(node.name, value); - - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitInstanceVariableTargetNode(Nodes.InstanceVariableTargetNode node) { final RubyNode rubyNode = WriteInstanceVariableNodeGen.create(node.name, null); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitIntegerNode(Nodes.IntegerNode node) { // parse Integer literal ourselves // See https://github.com/ruby/yarp/issues/1098 - final String string = toString(node).replaceAll("_", ""); + var tstring = toTString(node); + Object integer = ConvertBytes.bytesToInum(RubyLanguage.getCurrentContext(), null, tstring, sourceEncoding, 0, + true); - final int radix; - final int offset; - - if (node.isBinary()) { - radix = 2; - offset = 2; - } else if (node.isHexadecimal()) { - radix = 16; - offset = 2; - } else if (node.isDecimal()) { - radix = 10; - offset = (string.startsWith("0d") || string.startsWith("0D")) ? 2 : 0; - } else if (node.isOctal()) { - radix = 8; - offset = (string.startsWith("0o") || string.startsWith("0O")) ? 2 : 1; // 0oXX, 0OXX, 0XX + final RubyNode rubyNode; + if (integer instanceof Integer i) { + rubyNode = new IntegerFixnumLiteralNode(i); + } else if (integer instanceof Long l) { + rubyNode = new LongFixnumLiteralNode(l); + } else if (integer instanceof RubyBignum bignum) { + rubyNode = new ObjectLiteralNode(bignum); } else { - throw CompilerDirectives.shouldNotReachHere(); + throw CompilerDirectives.shouldNotReachHere(integer.getClass().getName()); } - final long value = Long.parseLong(string.substring(offset), radix); - final RubyNode rubyNode = Translator.integerOrLongLiteralNode(value); - - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1484,39 +1549,34 @@ public RubyNode visitInterpolatedMatchLastLineNode(Nodes.InterpolatedMatchLastLi @Override public RubyNode visitInterpolatedRegularExpressionNode(Nodes.InterpolatedRegularExpressionNode node) { - return defaultVisit(node); - } + final ToSNode[] children = translateInterpolatedParts(node.parts); - @Override - public RubyNode visitInterpolatedStringNode(Nodes.InterpolatedStringNode node) { - final ToSNode[] children = new ToSNode[node.parts.length]; + var encodingAndOptions = getRegexpEncodingAndOptions(new Nodes.RegularExpressionFlags(node.flags)); - for (int i = 0; i < node.parts.length; i++) { - var part = node.parts[i]; + RubyNode rubyNode = new InterpolatedRegexpNode(children, encodingAndOptions.options); - children[i] = ToSNodeGen.create(part.accept(this)); + if (node.isOnce()) { + rubyNode = new OnceNode(rubyNode); } - final RubyNode rubyNode = new InterpolatedStringNode(children, sourceEncoding.jcoding); - assignNodePositionInSource(node, rubyNode); + return assignPositionAndFlags(node, rubyNode); + } - return rubyNode; + @Override + public RubyNode visitInterpolatedStringNode(Nodes.InterpolatedStringNode node) { + final ToSNode[] children = translateInterpolatedParts(node.parts); + + final RubyNode rubyNode = new InterpolatedStringNode(children, sourceEncoding.jcoding); + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitInterpolatedSymbolNode(Nodes.InterpolatedSymbolNode node) { - final ToSNode[] children = new ToSNode[node.parts.length]; - - for (int i = 0; i < node.parts.length; i++) { - final RubyNode expression = node.parts[i].accept(this); - children[i] = ToSNodeGen.create(expression); - } + final ToSNode[] children = translateInterpolatedParts(node.parts); final RubyNode stringNode = new InterpolatedStringNode(children, sourceEncoding.jcoding); final RubyNode rubyNode = StringToSymbolNodeGen.create(stringNode); - assignNodePositionInSource(node, rubyNode); - - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1525,8 +1585,17 @@ public RubyNode visitInterpolatedXStringNode(Nodes.InterpolatedXStringNode node) final RubyNode string = stringNode.accept(this); final RubyNode rubyNode = createCallNode(new SelfNode(), "`", string); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); + } + + private ToSNode[] translateInterpolatedParts(Nodes.Node[] parts) { + final ToSNode[] children = new ToSNode[parts.length]; + + for (int i = 0; i < parts.length; i++) { + RubyNode expression = parts[i].accept(this); + children[i] = ToSNodeGen.create(expression); + } + return children; } @Override @@ -1538,7 +1607,7 @@ public RubyNode visitKeywordHashNode(Nodes.KeywordHashNode node) { @Override public RubyNode visitLambdaNode(Nodes.LambdaNode node) { - return translateBlockAndLambda(node, node.parameters, node.body, node.locals); + return translateBlockAndLambda(node, node.parameters, node.body, node.locals, null); } @Override @@ -1548,8 +1617,7 @@ public RubyNode visitLocalVariableReadNode(Nodes.LocalVariableReadNode node) { final RubyNode rubyNode = environment.findLocalVarNode(name, null); assert rubyNode != null : name; - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1559,12 +1627,24 @@ public RubyNode visitLocalVariableAndWriteNode(Nodes.LocalVariableAndWriteNode n @Override public RubyNode visitLocalVariableOperatorWriteNode(Nodes.LocalVariableOperatorWriteNode node) { - return defaultVisit(node); + int startOffset = node.startOffset; + int length = node.length; + var readNode = new Nodes.LocalVariableReadNode(node.name, node.depth, startOffset, length); + var desugared = new Nodes.LocalVariableWriteNode(node.name, node.depth, + callNode(node, readNode, node.operator, node.value), startOffset, length); + return desugared.accept(this); } @Override public RubyNode visitLocalVariableOrWriteNode(Nodes.LocalVariableOrWriteNode node) { - return defaultVisit(node); + // No need to check `defined?(var)` before reading, as `var` even if not set returns nil and does not have side effects + int startOffset = node.startOffset; + int length = node.length; + var writeNode = new Nodes.LocalVariableWriteNode(node.name, node.depth, node.value, startOffset, length) + .accept(this); + var readNode = new Nodes.LocalVariableReadNode(node.name, node.depth, startOffset, length).accept(this); + final RubyNode rubyNode = OrLazyValueDefinedNodeGen.create(readNode, writeNode); + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1596,8 +1676,7 @@ public RubyNode visitLocalVariableWriteNode(Nodes.LocalVariableWriteNode node) { final RubyNode rhs = translateNodeOrDeadNode(node.value, "YARPTranslator#visitLocalVariableWriteNode"); final WriteLocalNode rubyNode = lhs.makeWriteNode(rhs); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1646,8 +1725,7 @@ public RubyNode visitModuleNode(Nodes.ModuleNode node) { OpenModule.MODULE, shouldUseDynamicConstantLookupForModuleBody(node)); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1656,8 +1734,7 @@ public RubyNode visitMultiWriteNode(Nodes.MultiWriteNode node) { var translator = new YARPMultiWriteNodeTranslator(node, language, this); rubyNode = translator.translate(); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1686,15 +1763,13 @@ public RubyNode visitNextNode(Nodes.NextNode node) { } final RubyNode rubyNode = new NextNode(argumentsNode); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitNilNode(Nodes.NilNode node) { final RubyNode rubyNode = new NilLiteralNode(); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1702,8 +1777,7 @@ public RubyNode visitNumberedReferenceReadNode(Nodes.NumberedReferenceReadNode n final RubyNode lastMatchNode = ReadGlobalVariableNodeGen.create("$~"); final RubyNode rubyNode = new ReadMatchReferenceNodes.ReadNthMatchNode(lastMatchNode, node.number); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1712,16 +1786,14 @@ public RubyNode visitOrNode(Nodes.OrNode node) { final RubyNode right = node.right.accept(this); final RubyNode rubyNode = OrNodeGen.create(left, right); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitParenthesesNode(Nodes.ParenthesesNode node) { if (node.body == null) { final RubyNode rubyNode = new NilLiteralNode(); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } return node.body.accept(this); } @@ -1753,7 +1825,20 @@ public RubyNode visitProgramNode(Nodes.ProgramNode node) { @Override public RubyNode visitRangeNode(Nodes.RangeNode node) { - return defaultVisit(node); + var left = translateNodeOrNil(node.left); + var right = translateNodeOrNil(node.right); + + final RubyNode rubyNode; + if (left instanceof IntegerFixnumLiteralNode l && right instanceof IntegerFixnumLiteralNode r) { + final Object range = new RubyIntRange(node.isExcludeEnd(), l.getValue(), r.getValue()); + rubyNode = new ObjectLiteralNode(range); + } else if (left instanceof LongFixnumLiteralNode l && right instanceof LongFixnumLiteralNode r) { + final Object range = new RubyLongRange(node.isExcludeEnd(), l.getValue(), r.getValue()); + rubyNode = new ObjectLiteralNode(range); + } else { + rubyNode = RangeNodesFactory.RangeLiteralNodeGen.create(left, right, node.isExcludeEnd()); + } + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1770,8 +1855,7 @@ public RubyNode visitRationalNode(Nodes.RationalNode node) { RubyNode[] arguments = new RubyNode[]{ numeratorNode, denominatorNode }; RubyNode rubyNode = createCallNode(rationalModuleNode, "convert", arguments); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1790,13 +1874,57 @@ public RubyNode visitRedoNode(Nodes.RedoNode node) { } final RubyNode rubyNode = new RedoNode(); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitRegularExpressionNode(Nodes.RegularExpressionNode node) { - return defaultVisit(node); + var source = toTString(node.unescaped); + var encodingAndOptions = getRegexpEncodingAndOptions(new Nodes.RegularExpressionFlags(node.flags)); + try { + final RubyRegexp regexp = RubyRegexp.create(language, source, encodingAndOptions.encoding, + encodingAndOptions.options, currentNode); + final ObjectLiteralNode literalNode = new ObjectLiteralNode(regexp); + return assignPositionAndFlags(node, literalNode); + } catch (DeferredRaiseException dre) { + throw dre.getException(RubyLanguage.getCurrentContext()); + } + } + + private record RegexpEncodingAndOptions(RubyEncoding encoding, RegexpOptions options) { + } + + private RegexpEncodingAndOptions getRegexpEncodingAndOptions(Nodes.RegularExpressionFlags flags) { + final KCode kcode; + final RubyEncoding regexpEncoding; + final boolean fixed; + boolean explicitEncoding = true; + if (flags.isAscii8bit()) { + fixed = false; + kcode = KCode.NONE; + regexpEncoding = Encodings.BINARY; + } else if (flags.isUtf8()) { + fixed = true; + kcode = KCode.UTF8; + regexpEncoding = Encodings.UTF_8; + } else if (flags.isEucJp()) { + fixed = true; + kcode = KCode.EUC; + regexpEncoding = Encodings.getBuiltInEncoding(EUCJPEncoding.INSTANCE); + } else if (flags.isWindows31j()) { + fixed = true; + kcode = KCode.SJIS; + regexpEncoding = Encodings.getBuiltInEncoding(Windows_31JEncoding.INSTANCE); + } else { + fixed = false; + kcode = KCode.NONE; + regexpEncoding = sourceEncoding; + explicitEncoding = false; + } + + final RegexpOptions options = new RegexpOptions(kcode, fixed, flags.isOnce(), flags.isExtended(), + flags.isMultiLine(), flags.isIgnoreCase(), flags.isAscii8bit(), !explicitEncoding, true); + return new RegexpEncodingAndOptions(regexpEncoding, options); } @Override @@ -1816,8 +1944,7 @@ public RubyNode visitRescueModifierNode(Nodes.RescueModifierNode node) { null, canOmitBacktrace); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1828,8 +1955,7 @@ public RubyNode visitRescueNode(Nodes.RescueNode node) { @Override public RubyNode visitRetryNode(Nodes.RetryNode node) { final RubyNode rubyNode = new RetryNode(); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1852,20 +1978,54 @@ public RubyNode visitReturnNode(Nodes.ReturnNode node) { rubyNode = new LocalReturnNode(argumentsNode); } - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitSelfNode(Nodes.SelfNode node) { final RubyNode rubyNode = new SelfNode(); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitSingletonClassNode(Nodes.SingletonClassNode node) { - return defaultVisit(node); + final RubyNode receiverNode = node.expression.accept(this); + var singletonClassNode = SingletonClassASTNodeGen.create(receiverNode); + assignPositionOnly(node, singletonClassNode); + + boolean dynamicConstantLookup = environment.isDynamicConstantLookup(); + + String modulePath = ""; + if (!dynamicConstantLookup) { + if (environment.isModuleBody() && node.expression instanceof Nodes.SelfNode) { + // Common case of class << self in a module body, the constant lookup scope is still static. + if (environment.isTopLevelObjectScope()) { + // Special pattern recognized by #modulePathAndMethodName: + modulePath = "main::"; + } else { + modulePath = TranslatorEnvironment.composeModulePath(environment.modulePath, ""); + } + } else if (environment.isTopLevelScope()) { + // At the top-level of a file, opening the singleton class of an expression executed only once + } else { + // Switch to dynamic constant lookup + dynamicConstantLookup = true; + if (language.options.LOG_DYNAMIC_CONSTANT_LOOKUP) { + RubyLanguage.LOGGER.info( + () -> "start dynamic constant lookup at " + + RubyLanguage.getCurrentContext().fileLine(getSourceSection(node))); + } + } + } + + final RubyNode rubyNode = openModule( + node, + singletonClassNode, + modulePath, + node.body, + OpenModule.SINGLETON_CLASS, + dynamicConstantLookup); + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1875,21 +2035,29 @@ public RubyNode visitSourceEncodingNode(Nodes.SourceEncodingNode node) { @Override public RubyNode visitSourceFileNode(Nodes.SourceFileNode node) { - return defaultVisit(node); + // Note: ideally we would use the filesystem encoding here, but it is too early to get that. + // The filesystem encoding on Linux and macOS is UTF-8 anyway, so keep it simple. + RubyEncoding encoding = Encodings.UTF_8; + String path = language.getSourcePath(source); + var tstring = TruffleString.fromJavaStringUncached(path, encoding.tencoding); + var rubyNode = new StringLiteralNode(tstring, encoding); + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitSourceLineNode(Nodes.SourceLineNode node) { - return defaultVisit(node); + // Note: we use the YARP source here, notably to account for the lineOffset. + // Instead of getSourceSection(node).getStartLine() which would also create the TextMap early. + int line = environment.getParseEnvironment().yarpSource.line(node.startOffset); + var rubyNode = new IntegerFixnumLiteralNode(line); + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitSplatNode(Nodes.SplatNode node) { final RubyNode value = translateNodeOrNil(node.expression); final RubyNode rubyNode = SplatCastNodeGen.create(language, SplatCastNode.NilBehavior.CONVERT, false, value); - assignNodePositionInSource(node, rubyNode); - - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1916,13 +2084,31 @@ public RubyNode visitStringNode(Nodes.StringNode node) { rubyNode = new FrozenStringLiteralNode(frozenString, FrozenStrings.EXPRESSION); } - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitSuperNode(Nodes.SuperNode node) { - return defaultVisit(node); + var argumentsAndBlock = translateArgumentsAndBlock(node.arguments, node.block, environment.getMethodName()); + + final RubyNode arguments = new ReadSuperArgumentsNode( + argumentsAndBlock.arguments(), + argumentsAndBlock.isSplatted()); + final RubyNode block = executeOrInheritBlock(argumentsAndBlock.block()); + + RubyNode callNode = new SuperCallNode(argumentsAndBlock.isSplatted(), arguments, block, + argumentsAndBlock.argumentsDescriptor()); + callNode = wrapCallWithLiteralBlock(argumentsAndBlock, callNode); + + return assignPositionAndFlags(node, callNode); + } + + private RubyNode executeOrInheritBlock(RubyNode blockNode) { + if (blockNode != null) { + return blockNode; + } else { + return environment.findLocalVarOrNilNode(TranslatorEnvironment.METHOD_BLOCK_NAME, null); + } } @Override @@ -1930,25 +2116,20 @@ public RubyNode visitSymbolNode(Nodes.SymbolNode node) { var tstring = TStringUtils.fromByteArray(node.unescaped, sourceEncoding); final RubySymbol symbol = language.getSymbol(tstring, sourceEncoding); final RubyNode rubyNode = new ObjectLiteralNode(symbol); - - assignNodePositionInSource(node, rubyNode); - - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitTrueNode(Nodes.TrueNode node) { final RubyNode rubyNode = new BooleanLiteralNode(true); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitUndefNode(Nodes.UndefNode node) { final RubyNode[] names = translate(node.names); final RubyNode rubyNode = new ModuleNodes.UndefNode(names); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1960,36 +2141,33 @@ public RubyNode visitUnlessNode(Nodes.UnlessNode node) { if (thenNode != null && elseNode != null) { rubyNode = IfElseNodeGen.create(conditionNode, elseNode, thenNode); - assignNodePositionInSource(node, rubyNode); + return assignPositionAndFlags(node, rubyNode); } else if (thenNode != null) { rubyNode = UnlessNodeGen.create(conditionNode, thenNode); - assignNodePositionInSource(node, rubyNode); + return assignPositionAndFlags(node, rubyNode); } else if (elseNode != null) { rubyNode = IfNodeGen.create(conditionNode, elseNode); - assignNodePositionInSource(node, rubyNode); + return assignPositionAndFlags(node, rubyNode); } else { // unless (condition) // end rubyNode = sequence(node, Arrays.asList(conditionNode, new NilLiteralNode())); + return rubyNode; } - - return rubyNode; } @Override public RubyNode visitUntilNode(Nodes.UntilNode node) { final RubyNode rubyNode = translateWhileNode(node, node.predicate, node.statements, true, !node.isBeginModifier()); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitWhileNode(Nodes.WhileNode node) { final RubyNode rubyNode = translateWhileNode(node, node.predicate, node.statements, false, !node.isBeginModifier()); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override @@ -1999,18 +2177,31 @@ public RubyNode visitXStringNode(Nodes.XStringNode node) { final RubyNode string = stringNode.accept(this); final RubyNode rubyNode = createCallNode(new SelfNode(), "`", string); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } @Override public RubyNode visitYieldNode(Nodes.YieldNode node) { - return defaultVisit(node); + var argumentsAndBlock = translateArgumentsAndBlock(node.arguments, null, ""); + + RubyNode readBlock = environment.findLocalVarOrNilNode(TranslatorEnvironment.METHOD_BLOCK_NAME, null); + + var rubyNode = new YieldExpressionNode( + argumentsAndBlock.isSplatted(), + argumentsAndBlock.argumentsDescriptor(), + argumentsAndBlock.arguments(), + readBlock); + + return assignPositionAndFlags(node, rubyNode); } @Override protected RubyNode defaultVisit(Nodes.Node node) { - throw new Error("Unknown node: " + node); + String code = toString(node); + throw new Error( + this.getClass().getSimpleName() + " does not know how to translate " + node.getClass().getSimpleName() + + " at " + RubyLanguage.getCurrentContext().fileLine(getSourceSection(node)) + + "\nCode snippet:\n" + code + "\nPrism AST:\n" + node); } /** Declare variable in the nearest non-block outer lexical scope - either method, class or top-level */ @@ -2325,8 +2516,7 @@ private RubyNode translateControlFlowArguments(Nodes.ArgumentsNode node) { final RubyNode rubyNode = translateExpressionsList(values); - assignNodePositionInSource(node, rubyNode); - return rubyNode; + return assignPositionAndFlags(node, rubyNode); } private RubyNode translateRescueException(Nodes.Node exception) { @@ -2439,23 +2629,45 @@ protected boolean isSideEffectFreeRescueExpression(Nodes.Node node) { node instanceof Nodes.NilNode; } + protected TruffleString toTString(Nodes.Node node) { + return TruffleString.fromByteArrayUncached(sourceBytes, node.startOffset, node.length, sourceEncoding.tencoding, + false); + } + protected String toString(Nodes.Node node) { - return TStringUtils.toJavaStringOrThrow(TruffleString.fromByteArrayUncached(sourceBytes, node.startOffset, - node.length, sourceEncoding.tencoding, false), sourceEncoding); + return TStringUtils.toJavaStringOrThrow(toTString(node), sourceEncoding); + } + + protected TruffleString toTString(byte[] bytes) { + return TruffleString.fromByteArrayUncached(bytes, sourceEncoding.tencoding, false); } protected String toString(byte[] bytes) { return TStringUtils.toJavaStringOrThrow( - TruffleString.fromByteArrayUncached(bytes, sourceEncoding.tencoding, false), sourceEncoding); + toTString(bytes), sourceEncoding); } protected SourceSection getSourceSection(Nodes.Node yarpNode) { return source.createSection(yarpNode.startOffset, yarpNode.length); } - private static void assignNodePositionInSource(Nodes.Node yarpNode, RubyNode rubyNode) { - rubyNode.unsafeSetSourceSection(yarpNode.startOffset, yarpNode.length); + public static RubyNode assignPositionAndFlags(Nodes.Node yarpNode, RubyNode rubyNode) { + assignPositionOnly(yarpNode, rubyNode); copyNewlineFlag(yarpNode, rubyNode); + return rubyNode; + } + + private static void assignPositionOnly(Nodes.Node yarpNode, RubyNode rubyNode) { + rubyNode.unsafeSetSourceSection(yarpNode.startOffset, yarpNode.length); + } + + // assign position based on a list of nodes (arguments list, exception classes list in a rescue section, etc) + private void assignPositionOnly(Nodes.Node[] nodes, RubyNode rubyNode) { + final Nodes.Node first = nodes[0]; + final Nodes.Node last = nodes[nodes.length - 1]; + + final int length = last.startOffset - first.startOffset + last.length; + rubyNode.unsafeSetSourceSection(first.startOffset, length); } private static void copyNewlineFlag(Nodes.Node yarpNode, RubyNode rubyNode) { @@ -2470,7 +2682,7 @@ protected static RubyNode sequence(Nodes.Node yarpNode, List sequence) RubyNode sequenceNode = sequence(sequence); if (!sequenceNode.hasSource()) { - assignNodePositionInSource(yarpNode, sequenceNode); + assignPositionOnly(yarpNode, sequenceNode); } return sequenceNode; @@ -2491,13 +2703,11 @@ protected static RubyNode sequence(List sequence) { } } - // assign position based on a list of nodes (arguments list, exception classes list in a rescue section, etc) - private void assignNodePositionInSource(Nodes.Node[] nodes, RubyNode rubyNode) { - final Nodes.Node first = nodes[0]; - final Nodes.Node last = nodes[nodes.length - 1]; - - final int length = last.startOffset - first.startOffset + last.length; - rubyNode.unsafeSetSourceSection(first.startOffset, length); + protected static Nodes.CallNode callNode(Nodes.Node location, Nodes.Node receiver, String methodName, + Nodes.Node... arguments) { + return new Nodes.CallNode(receiver, + new Nodes.ArgumentsNode(arguments, NO_FLAGS, location.startOffset, location.length), null, NO_FLAGS, + methodName, location.startOffset, location.length); } private boolean containYARPSplatNode(Nodes.Node[] nodes) { diff --git a/src/main/java/org/truffleruby/parser/YARPTranslatorDriver.java b/src/main/java/org/truffleruby/parser/YARPTranslatorDriver.java index a0c63e4cc8fe..ffd6059a8631 100644 --- a/src/main/java/org/truffleruby/parser/YARPTranslatorDriver.java +++ b/src/main/java/org/truffleruby/parser/YARPTranslatorDriver.java @@ -190,7 +190,8 @@ public RootCallTarget parse(RubySource rubySource, ParserContext parserContext, node = context.getMetricsProfiler().callWithMetrics( "parsing", source.getName(), - () -> parseToYARPAST(context, language, rubySource, staticScope, parserConfiguration, rubyWarnings)); + () -> parseToYARPAST(context, language, rubySource, staticScope, parserConfiguration, rubyWarnings, + parseEnvironment)); printParseTranslateExecuteMetric("after-parsing", context, source); // } @@ -394,7 +395,8 @@ private String getMethodName(ParserContext parserContext, MaterializedFrame pare } public static org.prism.Nodes.Node parseToYARPAST(RubyContext context, RubyLanguage language, RubySource rubySource, - StaticScope blockScope, ParserConfiguration configuration, RubyDeferredWarnings rubyWarnings) { + StaticScope blockScope, ParserConfiguration configuration, RubyDeferredWarnings rubyWarnings, + ParseEnvironment parseEnvironment) { // LexerSource lexerSource = new LexerSource(rubySource); // We only need to pass in current scope if we are evaluating as a block (which // is only done for evals). We need to pass this in so that we can appropriately scope @@ -411,6 +413,7 @@ public static org.prism.Nodes.Node parseToYARPAST(RubyContext context, RubyLangu byte[] serializedBytes = Parser.parseAndSerialize(sourceBytes); var yarpSource = createYARPSource(sourceBytes, rubySource); + parseEnvironment.yarpSource = yarpSource; var parseResult = Loader.load(serializedBytes, yarpSource); final String filename = rubySource.getSourcePath(); diff --git a/src/main/java/org/truffleruby/parser/lexer/StringTerm.java b/src/main/java/org/truffleruby/parser/lexer/StringTerm.java index 0b1eed35045d..6e3d6d8499ba 100644 --- a/src/main/java/org/truffleruby/parser/lexer/StringTerm.java +++ b/src/main/java/org/truffleruby/parser/lexer/StringTerm.java @@ -217,9 +217,6 @@ private RegexpOptions parseRegexpFlags(RubyLexer lexer) { case 'u': options = options.setExplicitKCode(KCode.UTF8); break; - case 'j': - options = options.setJava(true); - break; default: unknownFlags.append((char) c); break; diff --git a/src/options.yml b/src/options.yml index 2d813bc4e25b..ac0fc13427b8 100644 --- a/src/options.yml +++ b/src/options.yml @@ -52,6 +52,7 @@ LANGUAGE_OPTIONS: - RUN_TWICE - CHECK_CLONE_UNINITIALIZED_CORRECTNESS - ALWAYS_CLONE_ALL +- PRISM USER: STABLE: @@ -260,3 +261,5 @@ INTERNAL: # Options for debugging the TruffleRuby implementation # Options for the regular expression engines COMPARE_REGEX_ENGINES: [compare-regex-engines, boolean, false, 'Uses both Joni and the TRegex engine and compares their results'] + + PRISM: [prism, boolean, false, 'Use Prism as the parser for Ruby code'] diff --git a/src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java b/src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java index 5a3053bcb5ee..2f9cf3fa0773 100644 --- a/src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java +++ b/src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java @@ -165,6 +165,7 @@ public final class OptionsCatalog { public static final OptionKey RUN_TWICE_KEY = new OptionKey<>(false); public static final OptionKey EXPERIMENTAL_ENGINE_CACHING_KEY = new OptionKey<>(RUN_TWICE_KEY.getDefaultValue()); public static final OptionKey COMPARE_REGEX_ENGINES_KEY = new OptionKey<>(false); + public static final OptionKey PRISM_KEY = new OptionKey<>(false); public static final OptionDescriptor LOAD_PATHS = OptionDescriptor .newBuilder(LOAD_PATHS_KEY, "ruby.load-paths") @@ -1326,6 +1327,14 @@ public final class OptionsCatalog { .usageSyntax("") .build(); + public static final OptionDescriptor PRISM = OptionDescriptor + .newBuilder(PRISM_KEY, "ruby.prism") + .help("Use Prism as the parser for Ruby code") + .category(OptionCategory.INTERNAL) + .stability(OptionStability.EXPERIMENTAL) + .usageSyntax("") + .build(); + public static OptionDescriptor fromName(String name) { switch (name) { case "ruby.load-paths": @@ -1618,6 +1627,8 @@ public static OptionDescriptor fromName(String name) { return EXPERIMENTAL_ENGINE_CACHING; case "ruby.compare-regex-engines": return COMPARE_REGEX_ENGINES; + case "ruby.prism": + return PRISM; default: return null; } @@ -1770,6 +1781,7 @@ public static OptionDescriptor[] allDescriptors() { RUN_TWICE, EXPERIMENTAL_ENGINE_CACHING, COMPARE_REGEX_ENGINES, + PRISM, }; } }