This commit is contained in:
hyung-hwan 2007-12-20 08:37:04 +00:00
parent 9365283895
commit f5a2f5d70f

View File

@ -839,7 +839,6 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
return ASE_NULL; return ASE_NULL;
} }
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
/* check if it coincides to be a global variable name */ /* check if it coincides to be a global variable name */
@ -852,7 +851,6 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
return ASE_NULL; return ASE_NULL;
} }
} }
#endif
/* clone the function name before it is overwritten */ /* clone the function name before it is overwritten */
name_dup = ase_awk_strxdup (awk, name, name_len); name_dup = ase_awk_strxdup (awk, name, name_len);
@ -917,7 +915,6 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
param = ASE_STR_BUF(&awk->token.name); param = ASE_STR_BUF(&awk->token.name);
param_len = ASE_STR_LEN(&awk->token.name); param_len = ASE_STR_LEN(&awk->token.name);
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
/* check if a parameter conflicts with a function */ /* check if a parameter conflicts with a function */
@ -940,7 +937,6 @@ static ase_awk_nde_t* parse_function (ase_awk_t* awk)
* x in print x is a parameter * x in print x is a parameter
*/ */
} }
#endif
/* check if a parameter conflicts with other parameters */ /* check if a parameter conflicts with other parameters */
if (ase_awk_tab_find ( if (ase_awk_tab_find (
@ -1437,7 +1433,6 @@ static int add_global (
{ {
ase_size_t nglobals; ase_size_t nglobals;
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
/* check if it conflict with a builtin function name */ /* check if it conflict with a builtin function name */
@ -1457,8 +1452,17 @@ static int add_global (
name, len); name, len);
return -1; return -1;
} }
/* check if it conflict with a function name
* caught in the function call table */
if (ase_awk_tab_find (&awk->parse.afns, 0, name, len) != (ase_size_t)-1)
{
SETERRARG (
awk, ASE_AWK_EAFNRED, line,
name, len);
return -1;
}
} }
#endif
/* check if it conflicts with other global variable names */ /* check if it conflicts with other global variable names */
if (find_global (awk, name, len) != (ase_size_t)-1) if (find_global (awk, name, len) != (ase_size_t)-1)
@ -1603,7 +1607,6 @@ static ase_awk_t* collect_locals (ase_awk_t* awk, ase_size_t nlocals)
local = ASE_STR_BUF(&awk->token.name); local = ASE_STR_BUF(&awk->token.name);
local_len = ASE_STR_LEN(&awk->token.name); local_len = ASE_STR_LEN(&awk->token.name);
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
ase_bool_t iscur = ase_false; ase_bool_t iscur = ase_false;
@ -1632,8 +1635,17 @@ static ase_awk_t* collect_locals (ase_awk_t* awk, ase_size_t nlocals)
local, local_len); local, local_len);
return ASE_NULL; return ASE_NULL;
} }
/* check if it conflict with a function name
* caught in the function call table */
if (ase_awk_tab_find (&awk->parse.afns, 0, local, local_len) != (ase_size_t)-1)
{
SETERRARG (
awk, ASE_AWK_EAFNRED, awk->token.line,
local, local_len);
return ASE_NULL;
}
} }
#endif
/* check if it conflicts with a paremeter name */ /* check if it conflicts with a paremeter name */
n = ase_awk_tab_find (&awk->parse.params, 0, local, local_len); n = ase_awk_tab_find (&awk->parse.params, 0, local, local_len);
@ -3154,10 +3166,9 @@ static ase_awk_nde_t* parse_primary_ident (ase_awk_t* awk, ase_size_t line)
if (awk->option & ASE_AWK_IMPLICIT) if (awk->option & ASE_AWK_IMPLICIT)
{ {
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
ase_bool_t iscur; ase_bool_t iscur = ase_false;
/* the name should not conflict with a function name */ /* the name should not conflict with a function name */
/* check if it is a builtin function */ /* check if it is a builtin function */
@ -3181,8 +3192,13 @@ static ase_awk_nde_t* parse_primary_ident (ase_awk_t* awk, ase_size_t line)
SETERRARG (awk, ASE_AWK_EAFNRED, line, name_dup, name_len); SETERRARG (awk, ASE_AWK_EAFNRED, line, name_dup, name_len);
goto exit_func; goto exit_func;
} }
if (ase_awk_tab_find (&awk->parse.afns, 0, name_dup, name_len) != (ase_size_t)-1)
{
SETERRARG (awk, ASE_AWK_EAFNRED, line, name_dup, name_len);
goto exit_func;
}
} }
#endif
nde->type = ASE_AWK_NDE_NAMED; nde->type = ASE_AWK_NDE_NAMED;
nde->line = line; nde->line = line;
@ -3319,7 +3335,6 @@ static ase_awk_nde_t* parse_hashidx (
if (awk->option & ASE_AWK_IMPLICIT) if (awk->option & ASE_AWK_IMPLICIT)
{ {
#if 0
if (awk->option & ASE_AWK_UNIQUEFN) if (awk->option & ASE_AWK_UNIQUEFN)
{ {
ase_bool_t iscur = ase_false; ase_bool_t iscur = ase_false;
@ -3345,8 +3360,13 @@ static ase_awk_nde_t* parse_hashidx (
SETERRARG (awk, ASE_AWK_EAFNRED, line, name, name_len); SETERRARG (awk, ASE_AWK_EAFNRED, line, name, name_len);
goto exit_func; goto exit_func;
} }
if (ase_awk_tab_find (&awk->parse.afns, 0, name, name_len) != (ase_size_t)-1)
{
SETERRARG (awk, ASE_AWK_EAFNRED, line, name, name_len);
goto exit_func;
}
} }
#endif
nde->type = ASE_AWK_NDE_NAMEDIDX; nde->type = ASE_AWK_NDE_NAMEDIDX;
nde->line = line; nde->line = line;
@ -3481,14 +3501,18 @@ static ase_awk_nde_t* parse_fncall (
call->args = head; call->args = head;
call->nargs = nargs; call->nargs = nargs;
if ((awk->option & ASE_AWK_EXPLICIT) && if (((awk->option & ASE_AWK_EXPLICIT) &&
!(awk->option & ASE_AWK_IMPLICIT) && !(awk->option & ASE_AWK_IMPLICIT)) ||
ase_awk_tab_adduniq (&awk->parse.afns, name, name_len) == (ase_size_t)-1) (awk->option & ASE_AWK_UNIQUEFN))
{ {
ASE_AWK_FREE (awk, call); if (ase_awk_tab_adduniq (
if (head != ASE_NULL) ase_awk_clrpt (awk, head); &awk->parse.afns, name, name_len) == (ase_size_t)-1)
SETERRLIN (awk, ASE_AWK_ENOMEM, line); {
return ASE_NULL; ASE_AWK_FREE (awk, call);
if (head != ASE_NULL) ase_awk_clrpt (awk, head);
SETERRLIN (awk, ASE_AWK_ENOMEM, line);
return ASE_NULL;
}
} }
} }