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

ruby-changes:42720

From: naruse <ko1@a...>
Date: Wed, 27 Apr 2016 15:14:31 +0900 (JST)
Subject: [ruby-changes:42720] naruse:r54794 (trunk): * tool/instruction.rb: fix to follow current implementation.

naruse	2016-04-27 16:11:07 +0900 (Wed, 27 Apr 2016)

  New Revision: 54794

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

  Log:
    * tool/instruction.rb: fix to follow current implementation.

  Modified files:
    trunk/ChangeLog
    trunk/tool/instruction.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54793)
+++ ChangeLog	(revision 54794)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Apr 27 16:10:35 2016  NARUSE, Yui  <naruse@r...>
+
+	* tool/instruction.rb: fix to follow current implementation.
+
 Wed Apr 27 15:47:54 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/stringio/stringio.c (strio_s_new): warn if a block is given,
Index: tool/instruction.rb
===================================================================
--- tool/instruction.rb	(revision 54793)
+++ tool/instruction.rb	(revision 54794)
@@ -453,9 +453,9 @@ class RubyVM https://github.com/ruby/ruby/blob/trunk/tool/instruction.rb#L453
         pops.concat e_pops
         rets.concat e_rets
         defopes.concat e_defs
-        sp_inc += "#{insn.sp_inc}"
+        sp_inc << "#{insn.sp_inc}"
 
-        body += "{ /* unif: #{i} */\n" +
+        body << "{ /* unif: #{i} */\n" +
                 passed_vars.map{|rpvars|
                   pv = rpvars[0]
                   rv = rpvars[1]
@@ -463,15 +463,22 @@ class RubyVM https://github.com/ruby/ruby/blob/trunk/tool/instruction.rb#L463
                 }.join("\n") +
                 "\n" +
                 redef_vars.map{|v, type|
-                  "#define #{v} #{v}_#{i}"
-                }.join("\n") + "\n" +
-                insn.body +
-                passed_vars.map{|rpvars|
-                  "#undef #{rpvars[0][1]}"
+                  "#{type} #{v} = #{v}_#{i};"
+                }.join("\n") + "\n"
+        if line = insn.body.instance_variable_get(:@line_no)
+          file = insn.body.instance_variable_get(:@file)
+          body << "#line #{line+1} \"#{file}\"\n"
+          body << insn.body
+          body << "\n#line __CURRENT_LINE__ \"__CURRENT_FILE__\"\n"
+        else
+          body << insn.body
+        end
+        body << redef_vars.keys.map{|v|
+                  "#{v}_#{i} = #{v};"
                 }.join("\n") +
                 "\n" +
-                redef_vars.keys.map{|v|
-                  "#undef  #{v}"
+                passed_vars.map{|rpvars|
+                  "#undef #{rpvars[0][1]}"
                 }.join("\n") +
                 "\n}\n"
       }
@@ -893,7 +900,7 @@ class RubyVM https://github.com/ruby/ruby/blob/trunk/tool/instruction.rb#L900
           commit insn.body
           commit '#line __CURRENT_LINE__ "__CURRENT_FILE__"'
         else
-          insn.body
+          commit insn.body
         end
         make_footer(insn)
       end

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

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