[前][次][番号順一覧][スレッド一覧]

ruby-changes:45465

From: kazu <ko1@a...>
Date: Sun, 5 Feb 2017 16:54:38 +0900 (JST)
Subject: [ruby-changes:45465] kazu:r57538 (trunk): {ext, test}/ripper: Specify frozen_string_literal: true.

kazu	2017-02-05 16:54:32 +0900 (Sun, 05 Feb 2017)

  New Revision: 57538

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57538

  Log:
    {ext,test}/ripper: Specify frozen_string_literal: true.

  Modified files:
    trunk/ext/ripper/extconf.rb
    trunk/ext/ripper/lib/ripper/core.rb
    trunk/ext/ripper/lib/ripper/filter.rb
    trunk/ext/ripper/lib/ripper/lexer.rb
    trunk/ext/ripper/lib/ripper/sexp.rb
    trunk/ext/ripper/lib/ripper.rb
    trunk/ext/ripper/tools/generate-param-macros.rb
    trunk/ext/ripper/tools/generate.rb
    trunk/ext/ripper/tools/preproc.rb
    trunk/ext/ripper/tools/strip.rb
    trunk/test/ripper/dummyparser.rb
    trunk/test/ripper/test_files.rb
    trunk/test/ripper/test_filter.rb
    trunk/test/ripper/test_parser_events.rb
    trunk/test/ripper/test_ripper.rb
    trunk/test/ripper/test_scanner_events.rb
    trunk/test/ripper/test_sexp.rb
Index: ext/ripper/tools/strip.rb
===================================================================
--- ext/ripper/tools/strip.rb	(revision 57537)
+++ ext/ripper/tools/strip.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/strip.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 last_is_void = false
 ARGF.each do |line|
   case line
Index: ext/ripper/tools/generate-param-macros.rb
===================================================================
--- ext/ripper/tools/generate-param-macros.rb	(revision 57537)
+++ ext/ripper/tools/generate-param-macros.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/generate-param-macros.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 off = true
 ARGF.each do |line|
   case line
Index: ext/ripper/tools/generate.rb
===================================================================
--- ext/ripper/tools/generate.rb	(revision 57537)
+++ ext/ripper/tools/generate.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/generate.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 # $Id$
 
 require 'optparse'
@@ -68,7 +68,7 @@ def usage(msg) https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/generate.rb#L68
 end
 
 def generate_eventids1(ids)
-  buf = ""
+  buf = "".dup
   buf << %Q[static struct {\n]
   ids.each do |id, arity|
     buf << %Q[    ID id_#{id};\n]
@@ -101,7 +101,7 @@ def generate_eventids1(ids) https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/generate.rb#L101
 end
 
 def generate_eventids2_table(ids)
-  buf = ""
+  buf = "".dup
   buf << %Q[static void\n]
   buf << %Q[ripper_init_eventids2_table(VALUE self)\n]
   buf << %Q[{\n]
Index: ext/ripper/tools/preproc.rb
===================================================================
--- ext/ripper/tools/preproc.rb	(revision 57537)
+++ ext/ripper/tools/preproc.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/preproc.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 # $Id$
 
 require 'optparse'
@@ -24,7 +24,7 @@ def main https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/preproc.rb#L24
   unless ARGV.size == 1
     abort "wrong number of arguments (#{ARGV.size} for 1)"
   end
-  out = ""
+  out = "".dup
   File.open(ARGV[0]) {|f|
     prelude f, out
     grammar f, out
Index: ext/ripper/lib/ripper/lexer.rb
===================================================================
--- ext/ripper/lib/ripper/lexer.rb	(revision 57537)
+++ ext/ripper/lib/ripper/lexer.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/lib/ripper/lexer.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 #
 # $Id$
 #
Index: ext/ripper/lib/ripper/sexp.rb
===================================================================
--- ext/ripper/lib/ripper/sexp.rb	(revision 57537)
+++ ext/ripper/lib/ripper/sexp.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/lib/ripper/sexp.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 #
 # $Id$
 #
Index: ext/ripper/lib/ripper/filter.rb
===================================================================
--- ext/ripper/lib/ripper/filter.rb	(revision 57537)
+++ ext/ripper/lib/ripper/filter.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/lib/ripper/filter.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 #
 # $Id$
 #
Index: ext/ripper/lib/ripper/core.rb
===================================================================
--- ext/ripper/lib/ripper/core.rb	(revision 57537)
+++ ext/ripper/lib/ripper/core.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/lib/ripper/core.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 #
 # $Id$
 #
Index: ext/ripper/lib/ripper.rb
===================================================================
--- ext/ripper/lib/ripper.rb	(revision 57537)
+++ ext/ripper/lib/ripper.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/lib/ripper.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 require 'ripper/core'
 require 'ripper/lexer'
 require 'ripper/filter'
Index: ext/ripper/extconf.rb
===================================================================
--- ext/ripper/extconf.rb	(revision 57537)
+++ ext/ripper/extconf.rb	(revision 57538)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ext/ripper/extconf.rb#L1
 #!ruby -s
-# frozen_string_literal: false
+# frozen_string_literal: true
 
 require 'mkmf'
 require 'rbconfig'
Index: test/ripper/test_filter.rb
===================================================================
--- test/ripper/test_filter.rb	(revision 57537)
+++ test/ripper/test_filter.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ripper/test_filter.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 begin
   require 'ripper'
   require 'test/unit'
Index: test/ripper/dummyparser.rb
===================================================================
--- test/ripper/dummyparser.rb	(revision 57537)
+++ test/ripper/dummyparser.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ripper/dummyparser.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 #
 # dummyparser.rb
 #
@@ -186,7 +186,7 @@ class DummyParser < Ripper https://github.com/ruby/ruby/blob/trunk/test/ripper/dummyparser.rb#L186
   end
 
   def on_word_new
-    ""
+    "".dup
   end
 
   def on_word_add(word, w)
Index: test/ripper/test_scanner_events.rb
===================================================================
--- test/ripper/test_scanner_events.rb	(revision 57537)
+++ test/ripper/test_scanner_events.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ripper/test_scanner_events.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 #
 # test_scanner_events.rb
 #
@@ -134,7 +134,7 @@ class TestRipper::ScannerEvents < Test:: https://github.com/ruby/ruby/blob/trunk/test/ripper/test_scanner_events.rb#L134
   end
 
   def assert_location(src)
-    buf = ''
+    buf = ''.dup
     Ripper.lex(src).each do |pos, type, tok|
       line, col = *pos
       assert_equal buf.count("\n") + 1, line,
Index: test/ripper/test_sexp.rb
===================================================================
--- test/ripper/test_sexp.rb	(revision 57537)
+++ test/ripper/test_sexp.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ripper/test_sexp.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 begin
   require 'ripper'
   require 'test/unit'
Index: test/ripper/test_parser_events.rb
===================================================================
--- test/ripper/test_parser_events.rb	(revision 57537)
+++ test/ripper/test_parser_events.rb	(revision 57538)
@@ -1,3 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ripper/test_parser_events.rb#L1
+# frozen_string_literal: true
 begin
   require_relative 'dummyparser'
   require 'test/unit'
Index: test/ripper/test_ripper.rb
===================================================================
--- test/ripper/test_ripper.rb	(revision 57537)
+++ test/ripper/test_ripper.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ripper/test_ripper.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 begin
   require 'ripper'
   require 'test/unit'
@@ -37,7 +37,7 @@ class TestRipper::Ripper < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ripper/test_ripper.rb#L37
 
   def test_filename
     assert_equal '(ripper)', @ripper.filename
-    filename = "ripper"
+    filename = "ripper".dup
     ripper = Ripper.new("", filename)
     filename.clear
     assert_equal "ripper", ripper.filename
@@ -63,11 +63,11 @@ class TestRipper::Ripper < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ripper/test_ripper.rb#L63
 
   def test_regexp_with_option
     bug11932 = '[ruby-core:72638] [Bug #11932]'
-    src = '/[\xC0-\xF0]/u'.force_encoding(Encoding::UTF_8)
+    src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8)
     ripper = Ripper.new(src)
     ripper.parse
     assert_predicate(ripper, :error?)
-    src = '/[\xC0-\xF0]/n'.force_encoding(Encoding::UTF_8)
+    src = '/[\xC0-\xF0]/n'.dup.force_encoding(Encoding::UTF_8)
     ripper = Ripper.new(src)
     ripper.parse
     assert_not_predicate(ripper, :error?, bug11932)
@@ -101,11 +101,11 @@ class TestRipper::Ripper < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ripper/test_ripper.rb#L101
 
   # https://bugs.jruby.org/4176
   def test_dedent_string
-    col = Ripper.dedent_string '  hello', 0
+    col = Ripper.dedent_string '  hello'.dup, 0
     assert_equal 0, col
-    col = Ripper.dedent_string '  hello', 2
+    col = Ripper.dedent_string '  hello'.dup, 2
     assert_equal 2, col
-    col = Ripper.dedent_string '  hello', 4
+    col = Ripper.dedent_string '  hello'.dup, 4
     assert_equal 2, col
 
     # lexing a squiggly heredoc triggers Ripper#dedent_string use
Index: test/ripper/test_files.rb
===================================================================
--- test/ripper/test_files.rb	(revision 57537)
+++ test/ripper/test_files.rb	(revision 57538)
@@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ripper/test_files.rb#L1
-# frozen_string_literal: false
+# frozen_string_literal: true
 require 'test/unit'
 
 module TestRipper; end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]