vfmt: fix raw string support

pull/4971/head
Ned Palacios 2020-05-27 09:10:47 +08:00 committed by GitHub
parent 3cfdd2a4cd
commit b02ec8cbf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -660,6 +660,9 @@ pub fn (mut f Fmt) expr(node ast.Expr) {
f.write(')')
}
ast.StringLiteral {
if it.is_raw {
f.write('r')
}
if it.val.contains("'") && !it.val.contains('"') {
f.write('"$it.val"')
} else {

View File

@ -94,7 +94,7 @@ pub fn githash(should_get_from_filesystem bool) string {
}
//
fn set_vroot_folder(vroot_path string) {
pub fn set_vroot_folder(vroot_path string) {
// Preparation for the compiler module:
// VEXE env variable is needed so that compiler.vexe_path()
// can return it later to whoever needs it:
@ -205,7 +205,7 @@ pub fn read_file(file_path string) ?string {
}
[inline]
fn imin(a, b int) int {
pub fn imin(a, b int) int {
return if a < b {
a
} else {
@ -214,7 +214,7 @@ fn imin(a, b int) int {
}
[inline]
fn imax(a, b int) int {
pub fn imax(a, b int) int {
return if a > b {
a
} else {