fix: class events ... in class functions & add new test for inherited; and class event

Signed-off-by: Slav76 <GavrikVA@gmail.com>
This commit is contained in:
Slav76 2015-10-18 00:11:21 +10:00
parent b34004a47a
commit 26eda5f7ef
3 changed files with 18 additions and 3 deletions

View file

@ -1,11 +1,19 @@
type TClass = class
type
TestEventHandler = procedure(value: integer);
TClass = class
class event TestEvent: TestEventHandler;
class a : integer := 4;
class property Prop1 : integer read a write a;
class constructor Create;
begin
TestEvent+= TestEventHandler(set_Prop1);
assert(a=4);
TestEvent(5);
assert(a=5);
end;
class property Prop1 : integer read a write a;
end;
var t : TClass;

View file

@ -2,7 +2,14 @@ type TClass = class
public function ToString: string; override;
begin
inherited ToString();
Result := 'tt'+inherited ToString;
var s0: string;
s0 := inherited ToString();
var s: string := 'ss' + inherited ToString();
end;
end;

View file

@ -14489,7 +14489,7 @@ namespace PascalABCCompiler.TreeConverter
//return convertion_data_and_alghoritms.create_full_function_call(new expressions_list(),
// si,lloc,blocks.converted_type,blocks.top_function,false);
if (!(si.sym_info is common_in_function_function_node))
return make_delegate_wrapper(null, si, lloc, false);
return make_delegate_wrapper(null, si, lloc, ((si.sym_info is common_method_node) && ((common_method_node)si.sym_info).IsStatic));
return convertion_data_and_alghoritms.create_full_function_call(new expressions_list(),
si,lloc,context.converted_type,context.top_function,false);
}