bug fix #471
This commit is contained in:
parent
03656f90f1
commit
aaebcf48c9
|
|
@ -33,6 +33,16 @@ begin
|
|||
raise new Exception;
|
||||
end;
|
||||
|
||||
type
|
||||
TClass=class
|
||||
|
||||
function f(a: integer := 1; b: integer := 2): integer;
|
||||
begin
|
||||
Result:=2;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
assert(test3=4);
|
||||
assert(test(2)=3);
|
||||
|
|
@ -48,4 +58,7 @@ assert(k = 6);
|
|||
tt(ff);
|
||||
assert(ArrRandomReal <> nil);
|
||||
assert(ArrRandomReal.Any = true);
|
||||
var obj := new TClass;
|
||||
var l := obj.f;
|
||||
assert(l = 2);
|
||||
end.
|
||||
|
|
@ -14940,7 +14940,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if (is_event)
|
||||
AddError(get_location(_var_def_statement), "EVENT_MUST_HAVE_TYPE");
|
||||
expression_node cn = convert_strong_to_constant_or_function_call_for_varinit(convert_strong(_var_def_statement.inital_value));
|
||||
expression_node cn = convert_strong_to_constant_or_function_call_for_varinit(convert_strong(_var_def_statement.inital_value));
|
||||
if (cn is constant_node)
|
||||
(cn as constant_node).SetType(DeduceType(cn.type, get_location(_var_def_statement.inital_value)));
|
||||
inital_value = cn;
|
||||
|
|
|
|||
|
|
@ -4113,6 +4113,12 @@ namespace PascalABCCompiler.TreeRealization
|
|||
if (cnfn.num_of_default_parameters == cnfn.parameters.Count)
|
||||
return bfc;
|
||||
}
|
||||
else if (bfc.function is common_method_node)
|
||||
{
|
||||
common_method_node cmn = bfc.function as common_method_node;
|
||||
if (cmn.num_of_default_parameters == cmn.parameters.Count)
|
||||
return bfc;
|
||||
}
|
||||
else if (bfc.function is compiled_function_node)
|
||||
{
|
||||
compiled_function_node cfn = bfc.function as compiled_function_node;
|
||||
|
|
|
|||
Loading…
Reference in a new issue