Skip to content

Commit

Permalink
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/compiler/crystal/codegen/codegen.cr
Original file line number Diff line number Diff line change
@@ -2049,14 +2049,15 @@ module Crystal

def self.safe_mangling(program, name)
if program.has_flag?("windows")
name.gsub do |char|
case char
when '<', '>', '(', ')', '*', ':', ',', '#', '@', ' '
"."
when '+'
".."
else
char
String.build do |str|
name.each_char do |char|
if char.ascii_alphanumeric? || char == '_'
str << char
else
str << '.'
char.ord.to_s(16, str, upcase: true)
str << '.'
end
end
end
else

0 comments on commit 44a4c63

Please sign in to comment.