יחידה:ParamValidator: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
duplicate only if both have values |
||
| שורה 200: | שורה 200: | ||
for p_name, value in pairs( t_args ) do | for p_name, value in pairs( t_args ) do | ||
local tp_param, noval, numeric, table_name = td_params[p_name] or all_aliases[p_name], util.empty( value ), tonumber( p_name ) | local tp_param, noval, numeric, table_name = td_params[p_name] or all_aliases[p_name], util.empty( value ), tonumber( p_name ) | ||
local hasval = not noval | |||
if not tp_param then -- not in TD: this is called undeclared | if not tp_param then -- not in TD: this is called undeclared | ||
| שורה 206: | שורה 207: | ||
noval and numeric and 'empty-undeclared-numeric' or | noval and numeric and 'empty-undeclared-numeric' or | ||
noval and not numeric and 'empty-undeclared' or | noval and not numeric and 'empty-undeclared' or | ||
hasval and numeric and 'undeclared-numeric' or | |||
'undeclared' -- tzvototi nishar. | 'undeclared' -- tzvototi nishar. | ||
else -- in td: test for deprecation and mistype. if deprecated, no further tests | else -- in td: test for deprecation and mistype. if deprecated, no further tests | ||
table_name = tp_param.deprecated and | table_name = tp_param.deprecated and hasval and 'deprecated' | ||
or tp_param.deprecated and noval and 'empty-deprecated' | or tp_param.deprecated and noval and 'empty-deprecated' | ||
or not compatible( tp_param.type, value ) and 'incompatible' | or not compatible( tp_param.type, value ) and 'incompatible' | ||
or already_seen[tp_param] and 'duplicate' | or already_seen[tp_param] and hasval and 'duplicate' | ||
already_seen[tp_param] = | already_seen[tp_param] = hasval | ||
end | end | ||
-- report it. | -- report it. | ||