mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
js: use prefixed names for functions and global symbols (#11387)
This commit is contained in:
@@ -15,7 +15,7 @@ pub fn setenv(key string, val string, overwrite bool) {
|
||||
// `getenv` returns the value of the environment variable named by the key.
|
||||
pub fn getenv(key string) string {
|
||||
mut res := ''
|
||||
#if ($ENV[key]) res = new builtin.string($ENV[key])
|
||||
#if ($ENV[key]) res = new string($ENV[key])
|
||||
|
||||
return res
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ pub const (
|
||||
)
|
||||
|
||||
$if js_node {
|
||||
#$process.argv.forEach(function(val,index) { args.arr[index] = new string(val); })
|
||||
#$process.argv.forEach(function(val,index) { os__args.arr[index] = new string(val); })
|
||||
}
|
||||
|
||||
// real_path returns the full absolute path for fpath, with all relative ../../, symlinks and so on resolved.
|
||||
@@ -55,7 +55,7 @@ pub fn chown(path string, owner int, group int) {
|
||||
pub fn temp_dir() string {
|
||||
mut res := ''
|
||||
$if js_node {
|
||||
#res = new builtin.string($os.tmpdir())
|
||||
#res = new string($os.tmpdir())
|
||||
}
|
||||
return res
|
||||
}
|
||||
@@ -63,7 +63,7 @@ pub fn temp_dir() string {
|
||||
pub fn home_dir() string {
|
||||
mut res := ''
|
||||
$if js_node {
|
||||
#res = new builtin.string($os.homedir())
|
||||
#res = new string($os.homedir())
|
||||
}
|
||||
return res
|
||||
}
|
||||
@@ -87,8 +87,8 @@ pub fn execute(cmd string) Result {
|
||||
mut stdout := ''
|
||||
#let commands = cmd.str.split(' ');
|
||||
#let output = $child_process.spawnSync(commands[0],commands.slice(1,commands.length));
|
||||
#exit_code = new builtin.int(output.status)
|
||||
#stdout = new builtin.string(output.stdout + '')
|
||||
#exit_code = new int(output.status)
|
||||
#stdout = newstring(output.stdout + '')
|
||||
|
||||
return Result{
|
||||
exit_code: exit_code
|
||||
|
@@ -45,7 +45,7 @@ pub fn ls(path string) ?[]string {
|
||||
result := []string{}
|
||||
$if js_node {
|
||||
#let i = 0
|
||||
#$fs.readdirSync(path.str).forEach((path) => result.arr[i++] = new builtin.string(path))
|
||||
#$fs.readdirSync(path.str).forEach((path) => result.arr[i++] = new string(path))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@ pub fn (mut p Process) stdin_write(s string) {
|
||||
pub fn (mut p Process) stdout_slurp() string {
|
||||
p.check_redirection_call('stdout_slurp')
|
||||
mut res := ''
|
||||
#p.val.pid.stdout.on('data', function (data) { res = new builtin.string(data) })
|
||||
#p.val.pid.stdout.on('data', function (data) { res = new string(data) })
|
||||
|
||||
return res
|
||||
}
|
||||
|
Reference in New Issue
Block a user