Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-45043] Translate more nodes in YARPTranslator #3329

Merged
merged 32 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9cf5e59
Add a debug option to parse with Prism
eregon Nov 20, 2023
ca16111
Improve error on unknown Prism node
eregon Nov 20, 2023
7a86e9d
Translate *VariableOperatorWriteNode
eregon Nov 20, 2023
74ec14e
Translate SingletonClassNode
eregon Nov 20, 2023
afbf970
Use an uncached FixnumOrBignumNode in ConvertBytes
eregon Nov 20, 2023
54748f6
Use ConvertBytes.bytesToInum() to translate IntegerNode
eregon Nov 20, 2023
e4bdd49
Make ArgumentsAndBlockTranslation a record and move it under Translator
eregon Nov 21, 2023
68bfed7
Extract translateArgumentsAndBlock() and wrapCallWithLiteralBlock() f…
eregon Nov 21, 2023
c41d43b
Translate SuperCallNode
eregon Nov 21, 2023
bf26cb4
Translate YieldNode
eregon Nov 21, 2023
b1cfd8e
Translate RegularExpressionNode
eregon Nov 21, 2023
03b5fbd
Fix passing parserContext, currentNode, rubyWarnings to YARPBlockNode…
eregon Nov 21, 2023
8df4254
Translate InterpolatedRegexpNode
eregon Nov 21, 2023
c8083fa
Translate RangeNode
eregon Nov 21, 2023
ef77082
Return the RubyNode for assignPositionAndFlags()
eregon Nov 21, 2023
b013c2e
Translate *VariableOrWriteNode
eregon Nov 21, 2023
5c3e58d
Translate ForwardingSuperNode
eregon Nov 21, 2023
02f160a
Fix translating of splatted arguments to a call
eregon Nov 21, 2023
3a0f457
Improve isAttrAssign check
eregon Nov 21, 2023
b8103d7
Translate SourceFileNode and SourceLineNode
eregon Nov 21, 2023
4b63a14
We must translate the rescue reference before the rescue statements
eregon Nov 21, 2023
5685bca
Handle methods with a null ParametersNode
eregon Nov 23, 2023
45eee80
Extend parsing fixture for `for`
eregon Nov 23, 2023
bfb9c6d
Untag passing super parsing fixtures
eregon Nov 23, 2023
409d2cf
Fail in a non-fatal way in parse_with_yarp_and_dump_truffle_ast for n…
eregon Nov 23, 2023
cfc3865
The write node needs to be translated first for `foo ||= expr`
eregon Nov 23, 2023
6ccd34a
Regenerate parsing fixtures
eregon Nov 23, 2023
087a279
Untag passing parsing specs
eregon Nov 23, 2023
60e3ec4
Add parsing fixtures for +=
eregon Nov 23, 2023
8e9c232
Avoid spaces in filenames
eregon Nov 24, 2023
10419cc
Untag passing Regexp parsing fixtures
eregon Nov 24, 2023
d063e40
Improve toString() of RubyCallNodeParameters and NoKeywordArgumentsDe…
eregon Nov 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 6 additions & 46 deletions spec/tags/truffle/parsing/parsing_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,44 +18,22 @@ 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
fails:Parsing a Parentheses operator (with single expression) case is parsed correctly
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 (/(?<a>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
Expand All @@ -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
2 changes: 1 addition & 1 deletion spec/truffle/parsing/fixtures/BEGIN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 0
frameSlot = 0 # (self)
children:
valueNode =
ProfileArgumentNodeGen
Expand Down
4 changes: 2 additions & 2 deletions spec/truffle/parsing/fixtures/END.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ast: |
child =
RubyCallNode
attributes:
descriptor = org.truffleruby.language.arguments.NoKeywordArgumentsDescriptor@...
descriptor = NoKeywordArgumentsDescriptor
dispatchConfig = PROTECTED
emptyKeywordsProfile = false
flags = 0
Expand Down Expand Up @@ -82,7 +82,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 0
frameSlot = 0 # (self)
children:
valueNode =
ProfileArgumentNodeGen
Expand Down
2 changes: 1 addition & 1 deletion spec/truffle/parsing/fixtures/begin_end_block.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 0
frameSlot = 0 # (self)
children:
valueNode =
ProfileArgumentNodeGen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 3
frameSlot = 3 # %destructure_1
children:
valueNode =
SplatCastNodeGen
Expand Down Expand Up @@ -94,7 +94,7 @@ ast: |
ReadLocalVariableNode
attributes:
flags = 0
frameSlot = 3
frameSlot = 3 # %destructure_1
type = FRAME_LOCAL
]
elseBody =
Expand All @@ -106,7 +106,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 0
frameSlot = 0 # (self)
children:
valueNode =
ProfileArgumentNodeGen
Expand All @@ -120,7 +120,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 1
frameSlot = 1 # a
children:
valueNode =
ProfileArgumentNodeGen
Expand All @@ -137,7 +137,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 2
frameSlot = 2 # %anonymous_rest
children:
valueNode =
ReadRestArgumentNode
Expand All @@ -157,7 +157,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 0
frameSlot = 0 # (self)
children:
valueNode =
ProfileArgumentNodeGen
Expand All @@ -171,7 +171,7 @@ ast: |
WriteLocalVariableNode
attributes:
flags = 0
frameSlot = 1
frameSlot = 1 # a
children:
valueNode =
ArrayIndexNodesFactory$ReadConstantIndexNodeGen
Expand All @@ -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
Expand All @@ -201,7 +201,7 @@ ast: |
ReadLocalVariableNode
attributes:
flags = 0
frameSlot = 3
frameSlot = 3 # %destructure_1
type = FRAME_LOCAL
]
NilLiteralNode
Expand Down
Loading