1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

add builtin import pass + use builder in map

This commit is contained in:
Joe Conigliaro 2019-08-05 13:54:16 +10:00 committed by Alexander Medvednikov
parent 5ed338dc2e
commit 2fab73983b
2 changed files with 11 additions and 9 deletions

View File

@ -948,6 +948,12 @@ fn (v mut V) add_v_files_to_compile() {
} }
// import tables for user/lib files // import tables for user/lib files
mut file_imports := []FileImportTable mut file_imports := []FileImportTable
// Parse builtin imports
for file in v.files {
mut p := v.new_parser(file, Pass.imports)
p.parse()
file_imports << *p.import_table
}
// Parse user imports // Parse user imports
for file in user_files { for file in user_files {
mut p := v.new_parser(file, Pass.imports) mut p := v.new_parser(file, Pass.imports)

View File

@ -249,15 +249,11 @@ pub fn (m map_string) str() string {
return '{}' return '{}'
} }
// TODO use bytes buffer // TODO use bytes buffer
//mut sb := strings.new_builder(50) mut sb := strings.new_builder(50)
//sb.writeln('{') sb.writeln('{')
mut s := '{\n'
for key, val in m { for key, val in m {
//sb.writeln(' "$entry.key" => "$val"') sb.writeln(' "$key" => "$val"')
s += ' "$key" => "$val"\n'
} }
s += '}\n' sb.writeln('}')
//sb.writeln('}') return sb.str()
//return sb.str()
return s
} }