@@ -1062,14 +1062,16 @@ show_unquoted(io::IO, val::SSAValue, ::Int, ::Int) = print(io, "%", val.id)
1062
1062
show_unquoted (io:: IO , sym:: Symbol , :: Int , :: Int ) = show_sym (io, sym, allow_macroname= false )
1063
1063
show_unquoted (io:: IO , ex:: LineNumberNode , :: Int , :: Int ) = show_linenumber (io, ex. line, ex. file)
1064
1064
show_unquoted (io:: IO , ex:: GotoNode , :: Int , :: Int ) = print (io, " goto %" , ex. label)
1065
- function show_unquoted (io:: IO , ex:: GlobalRef , :: Int , :: Int )
1065
+ show_unquoted (io:: IO , ex:: GlobalRef , :: Int , :: Int ) = show_globalref (io, ex)
1066
+
1067
+ function show_globalref (io:: IO , ex:: GlobalRef ; allow_macroname= false )
1066
1068
print (io, ex. mod)
1067
1069
print (io, ' .' )
1068
1070
quoted = ! isidentifier (ex. name) && ! startswith (string (ex. name), " @" )
1069
1071
parens = quoted && (! isoperator (ex. name) || (ex. name in quoted_syms))
1070
1072
quoted && print (io, ' :' )
1071
1073
parens && print (io, ' (' )
1072
- show_sym (io, ex. name, allow_macroname= true )
1074
+ show_sym (io, ex. name, allow_macroname= allow_macroname )
1073
1075
parens && print (io, ' )' )
1074
1076
nothing
1075
1077
end
@@ -1175,8 +1177,8 @@ end
1175
1177
# Wrap symbols for macro names to allow them to be printed literally
1176
1178
function allow_macroname (ex)
1177
1179
if (ex isa Symbol && first (string (ex)) == ' @' ) ||
1180
+ ex isa GlobalRef ||
1178
1181
(is_expr (ex, :(.)) && length (ex. args) == 2 &&
1179
- (ex. args[1 ] isa Symbol || ex. args[1 ] isa Module) &&
1180
1182
(is_expr (ex. args[2 ], :quote ) || ex. args[2 ] isa QuoteNode))
1181
1183
return Expr (:macroname , ex)
1182
1184
else
@@ -1483,15 +1485,18 @@ function show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int, quote_level::In
1483
1485
arg1 = args[1 ]
1484
1486
if arg1 isa Symbol
1485
1487
show_sym (io, arg1, allow_macroname= true )
1488
+ elseif arg1 isa GlobalRef
1489
+ show_globalref (io, arg1, allow_macroname= true )
1486
1490
elseif is_expr (arg1, :(.)) && length (arg1. args) == 2
1487
- if arg1. args[1 ] isa Module
1488
- print (io, ' (' )
1489
- print (io, arg1. args[1 ])
1490
- print (io, " )." )
1491
+ m = arg1. args[1 ]
1492
+ if m isa Symbol || m isa GlobalRef || is_expr (m, :(.), 2 )
1493
+ show_unquoted (io, m)
1491
1494
else
1492
- print (io, arg1. args[1 ])
1493
- print (io, ' .' )
1495
+ print (io, " (" )
1496
+ show_unquoted (io, m)
1497
+ print (io, " )" )
1494
1498
end
1499
+ print (io, ' .' )
1495
1500
if is_expr (arg1. args[2 ], :quote )
1496
1501
mname = arg1. args[2 ]. args[1 ]
1497
1502
else
0 commit comments