@@ -972,8 +972,7 @@ defmodule Code do
972972 @ doc since: "1.13.0"
973973 @ spec string_to_quoted_with_comments ( List.Chars . t ( ) , keyword ) ::
974974 { :ok , Macro . t ( ) , list ( map ( ) ) } | { :error , { location :: keyword , term , term } }
975- def string_to_quoted_with_comments ( string , opts \\ [ ] )
976- when is_binary ( string ) and is_list ( opts ) do
975+ def string_to_quoted_with_comments ( string , opts \\ [ ] ) when is_list ( opts ) do
977976 charlist = to_charlist ( string )
978977 file = Keyword . get ( opts , :file , "nofile" )
979978 line = Keyword . get ( opts , :line , 1 )
@@ -1003,7 +1002,9 @@ defmodule Code do
10031002 @ doc since: "1.13.0"
10041003 @ spec string_to_quoted_with_comments! ( List.Chars . t ( ) , keyword ) :: { Macro . t ( ) , list ( map ( ) ) }
10051004 def string_to_quoted_with_comments! ( string , opts \\ [ ] ) do
1006- case string_to_quoted_with_comments ( string , opts ) do
1005+ charlist = to_charlist ( string )
1006+
1007+ case string_to_quoted_with_comments ( charlist , opts ) do
10071008 { :ok , forms , comments } ->
10081009 { forms , comments }
10091010
@@ -1013,7 +1014,7 @@ defmodule Code do
10131014 Keyword . get ( opts , :file , "nofile" ) ,
10141015 error ,
10151016 token ,
1016- { string , Keyword . get ( opts , :line , 1 ) , Keyword . get ( opts , :column , 1 ) }
1017+ { charlist , Keyword . get ( opts , :line , 1 ) , Keyword . get ( opts , :column , 1 ) }
10171018 )
10181019 end
10191020 end
0 commit comments