summaryrefslogtreecommitdiff
path: root/tool/transform_mjit_header.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-05 00:52:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-05 00:52:45 +0000
commit70ae83f8e18a2a3d65ee45dde318027be8b4f3c3 (patch)
treef1db4fea1a4db34eb7c99a906ee029ef0726790b /tool/transform_mjit_header.rb
parenta38b3307b6dd7ea8770a46f9485b0ffe4de1b40c (diff)
transform_mjit_header.rb: separate macro and code
* tool/transform_mjit_header.rb (separate_macro_and_code): return macro and code separately as the name, and concat before output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/transform_mjit_header.rb')
-rw-r--r--tool/transform_mjit_header.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/tool/transform_mjit_header.rb b/tool/transform_mjit_header.rb
index 7ce139f92a..143c393b66 100644
--- a/tool/transform_mjit_header.rb
+++ b/tool/transform_mjit_header.rb
@@ -99,7 +99,7 @@ module MJITHeader
# This makes easier to process code
def self.separate_macro_and_code(code)
- code.lines.partition { |l| !l.start_with?('#') }.flatten.join('')
+ code.lines.partition { |l| l.start_with?('#') }.map! {|lines| lines.join('')}
end
def self.write(code, out)
@@ -142,7 +142,7 @@ if MJITHeader.windows? # transformation is broken with Windows headers for now
end
puts "\nTransforming external functions to static:"
-code = MJITHeader.separate_macro_and_code(code) # note: this does not work on MinGW
+macro, code = MJITHeader.separate_macro_and_code(code) # note: this does not work on MinGW
stop_pos = -1
extern_names = []
@@ -178,6 +178,8 @@ while (decl_range = MJITHeader.find_decl(code, stop_pos))
end
end
+code << macro
+
# Check the final file correctness
MJITHeader.check_code!(code, cc, cflags, 'final')