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

add the cmd/tools/gen_1long_fn.v script too

This commit is contained in:
Delyan Angelov 2023-07-15 18:18:08 +03:00
parent 8eded2e025
commit 46c07a5fac
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

15
cmd/tools/gen_1long_fn.v Normal file
View File

@ -0,0 +1,15 @@
import strings
import os
n := os.args[1] or { '1_000_000' }.int()
stmt := os.args[2] or { 'a = b + c * d' }
mut s := strings.new_builder(1000)
s.writeln('fn main() {')
s.writeln(' mut a,b,c,d := 0,1,2,3')
for _ in 0 .. n {
s.writeln(' ${stmt}')
}
s.writeln(' println("a: \${a}")')
s.writeln('}')
os.write_file('${n}.v', s.str())!