mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v: forbid function parameter names, shadowing imported module names (#17210)
This commit is contained in:
@ -108,7 +108,7 @@ fn add_item_to_array(obj &C.cJSON, item &C.cJSON) {
|
||||
C.cJSON_AddItemToArray(obj, item)
|
||||
}
|
||||
|
||||
fn json_print(json &C.cJSON) string {
|
||||
s := C.cJSON_Print(json)
|
||||
fn json_print(json_ &C.cJSON) string {
|
||||
s := C.cJSON_Print(json_)
|
||||
return unsafe { tos3(s) }
|
||||
}
|
||||
|
@ -120,15 +120,15 @@ fn json(file string) string {
|
||||
// use as permissive preferences as possible, so that `v ast`
|
||||
// can print the AST of arbitrary V files, even .vsh or ones
|
||||
// that require globals:
|
||||
mut pref := &pref.Preferences{}
|
||||
pref.fill_with_defaults()
|
||||
pref.enable_globals = true
|
||||
pref.is_fmt = true
|
||||
mut pref_ := &pref.Preferences{}
|
||||
pref_.fill_with_defaults()
|
||||
pref_.enable_globals = true
|
||||
pref_.is_fmt = true
|
||||
//
|
||||
mut t := Tree{
|
||||
root: new_object()
|
||||
table: ast.new_table()
|
||||
pref: pref
|
||||
pref: pref_
|
||||
}
|
||||
// parse file with comment
|
||||
ast_file := parser.parse_file(file, t.table, .parse_comments, t.pref)
|
||||
@ -359,9 +359,9 @@ fn (t Tree) imports(nodes []ast.Import) &Node {
|
||||
return import_array
|
||||
}
|
||||
|
||||
fn (t Tree) errors(errors []errors.Error) &Node {
|
||||
fn (t Tree) errors(errors_ []errors.Error) &Node {
|
||||
mut errs := new_array()
|
||||
for e in errors {
|
||||
for e in errors_ {
|
||||
obj := new_object()
|
||||
obj.add_terse('message', t.string_node(e.message))
|
||||
obj.add_terse('file_path', t.string_node(e.file_path))
|
||||
|
Reference in New Issue
Block a user