1From 330bdeeaa4389225c27d27188499543ddd184f69 Mon Sep 17 00:00:00 2001
2From: Adrian Perez de Castro <aperez@igalia.com>
3Date: Wed, 15 Jan 2020 22:15:38 +0000
4Subject: [PATCH] Offlineasm warnings with newer Ruby versions
5 https://bugs.webkit.org/show_bug.cgi?id=206233
6
7Reviewed by Yusuke Suzuki.
8
9Avoid a warning about using Object#=~ on Annotation instances, which
10has been deprecated in Ruby 2.7.
11
12* offlineasm/parser.rb: Swap checks to prevent applying the =~ operator
13to Annotation instances, which do not define it.
14
15Canonical link: https://commits.webkit.org/219400@main
16git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17Upstream-Status: Backport
18Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
19---
20 Source/JavaScriptCore/offlineasm/parser.rb | 6 +++---
21 1 file changed, 3 insertions(+), 3 deletions(-)
22
23diff --git a/Source/JavaScriptCore/offlineasm/parser.rb b/Source/JavaScriptCore/offlineasm/parser.rb
24index b44511245..cd1cffaec 100644
25--- a/Source/JavaScriptCore/offlineasm/parser.rb
26+++ b/Source/JavaScriptCore/offlineasm/parser.rb
27@@ -584,9 +584,7 @@ class Parser
28         firstCodeOrigin = @tokens[@idx].codeOrigin
29         list = []
30         loop {
31-            if (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
32-                break
33-            elsif @tokens[@idx].is_a? Annotation
34+            if @tokens[@idx].is_a? Annotation
35                 # This is the only place where we can encounter a global
36                 # annotation, and hence need to be able to distinguish between
37                 # them.
38@@ -600,6 +598,8 @@ class Parser
39                 list << Instruction.new(codeOrigin, annotationOpcode, [], @tokens[@idx].string)
40                 @annotation = nil
41                 @idx += 2 # Consume the newline as well.
42+            elsif (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
43+                break
44             elsif @tokens[@idx] == "\n"
45                 # ignore
46                 @idx += 1
47--
482.39.0
49
50