linamh/dev-qt/qtwebkit/files/offlineasm_ruby_3.2.diff
2025-09-18 11:05:51 +02:00

29 lines
1.2 KiB
Diff

Description: fix offlineasm error with Ruby 3.2
Swap checks to prevent applying the =~ operator to Annotation instances,
which do not define it.
Origin: upstream, https://commits.webkit.org/219400@main
Last-Update: 2024-03-28
--- a/Source/JavaScriptCore/offlineasm/parser.rb
+++ b/Source/JavaScriptCore/offlineasm/parser.rb
@@ -584,9 +584,7 @@ class Parser
firstCodeOrigin = @tokens[@idx].codeOrigin
list = []
loop {
- if (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
- break
- elsif @tokens[@idx].is_a? Annotation
+ if @tokens[@idx].is_a? Annotation
# This is the only place where we can encounter a global
# annotation, and hence need to be able to distinguish between
# them.
@@ -600,6 +598,8 @@ class Parser
list << Instruction.new(codeOrigin, annotationOpcode, [], @tokens[@idx].string)
@annotation = nil
@idx += 2 # Consume the newline as well.
+ elsif (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
+ break
elsif @tokens[@idx] == "\n"
# ignore
@idx += 1