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

CReserved => c_reserved; charptr

This commit is contained in:
Alexander Medvednikov 2019-11-30 15:40:08 +03:00
parent d323b48179
commit 0999273d32
3 changed files with 5 additions and 3 deletions

View File

@ -187,6 +187,7 @@ typedef double f64;
typedef unsigned char* byteptr;
typedef int* intptr;
typedef void* voidptr;
typedef char* charptr;
typedef struct array array;
typedef struct map map;
typedef array array_string;

View File

@ -271,7 +271,7 @@ fn (table mut Table) fn_gen_name(f &Fn) string {
// Avoid name conflicts (with things like abs(), print() etc).
// Generate v_abs(), v_print()
// TODO duplicate functionality
if f.mod == 'builtin' && f.name in CReserved {
if f.mod == 'builtin' && f.name in c_reserved {
return 'v_$name'
}
// Obfuscate but skip certain names

View File

@ -144,7 +144,7 @@ fn (t Type) str() string {
*/
const (
CReserved = [
c_reserved = [
'delete',
'exit',
'unix',
@ -245,6 +245,7 @@ fn new_table(obfuscate bool) &Table {
t.register_builtin('bool')
t.register_builtin('void')
t.register_builtin('voidptr')
t.register_builtin('charptr')
t.register_builtin('va_list')
for c in reserved_type_param_names {
t.register_builtin(c)
@ -260,7 +261,7 @@ fn new_table(obfuscate bool) &Table {
// If `name` is a reserved C keyword, returns `v_name` instead.
fn (t &Table) var_cgen_name(name string) string {
if name in CReserved {
if name in c_reserved {
return 'v_$name'
}
else {