fix offlineasm error with Ruby 3.2
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Fri, 25 Oct 2024 09:39:48 +0000 (12:39 +0300)
committerDmitry Shachnev <mitya57@debian.org>
Fri, 25 Oct 2024 09:39:48 +0000 (12:39 +0300)
Origin: upstream, https://commits.webkit.org/219400@main
Last-Update: 2024-03-28

Swap checks to prevent applying the =~ operator to Annotation instances,
which do not define it.

Gbp-Pq: Name offlineasm_ruby_3.2.diff

Source/JavaScriptCore/offlineasm/parser.rb

index b4451124521fa719b5b0a75761571b039b8b4a2a..cd1cffaec6ed53a8f71eafa253795f259636368e 100644 (file)
@@ -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