bug fix #806
This commit is contained in:
parent
aed5af2618
commit
b6aa4d9c90
22
TestSuite/events4.pas
Normal file
22
TestSuite/events4.pas
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
var a: integer;
|
||||
type
|
||||
t1 = class
|
||||
event p:procedure;
|
||||
|
||||
procedure p1;
|
||||
begin
|
||||
self.p();
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure test;
|
||||
begin
|
||||
a := 1;
|
||||
end;
|
||||
|
||||
begin
|
||||
var o := new t1;
|
||||
o.p += test;
|
||||
o.p1;
|
||||
assert(a = 1);
|
||||
end.
|
||||
|
|
@ -9060,8 +9060,14 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
private expression_node expression_value_reciving(SyntaxTree.ident id_right, List<SymbolInfo> sil, expression_node en, bool expected_delegate)
|
||||
{
|
||||
definition_node dn = context.check_name_node_type(id_right.name, sil?.FirstOrDefault(), get_location(id_right), general_node_type.variable_node,
|
||||
general_node_type.function_node, general_node_type.property_node, general_node_type.constant_definition);
|
||||
general_node_type[] node_types;
|
||||
if (en is this_node)
|
||||
node_types = new general_node_type[] { general_node_type.variable_node,
|
||||
general_node_type.function_node, general_node_type.property_node, general_node_type.constant_definition, general_node_type.event_node};
|
||||
else
|
||||
node_types = new general_node_type[] { general_node_type.variable_node,
|
||||
general_node_type.function_node, general_node_type.property_node, general_node_type.constant_definition};
|
||||
definition_node dn = context.check_name_node_type(id_right.name, sil?.FirstOrDefault(), get_location(id_right), node_types);
|
||||
switch (dn.general_node_type)
|
||||
{
|
||||
/*case general_node_type.constant_defenition:
|
||||
|
|
@ -9152,6 +9158,30 @@ namespace PascalABCCompiler.TreeConverter
|
|||
//throw new ConstMemberCannotBeAccessedWithAnInstanceReference((class_constant_definition)dn, get_location(id_right));
|
||||
return ((constant_definition_node)dn).const_value;
|
||||
}
|
||||
case general_node_type.event_node:
|
||||
{
|
||||
if (dn.semantic_node_type == semantic_node_type.compiled_event)
|
||||
{
|
||||
compiled_event ce = (compiled_event)dn;
|
||||
if (ce.is_static)
|
||||
{
|
||||
//throw new NonStaticAndStaticEvevnt();
|
||||
}
|
||||
nonstatic_event_reference ser = new nonstatic_event_reference(en, ce, get_location(id_right));
|
||||
return ser;
|
||||
}
|
||||
else if (dn.semantic_node_type == semantic_node_type.common_event)
|
||||
{
|
||||
common_event ce = (common_event)dn;
|
||||
if (ce.is_static)
|
||||
{
|
||||
//throw new NonStaticAndStaticEvevnt();
|
||||
}
|
||||
nonstatic_event_reference ser = new nonstatic_event_reference(en, ce, get_location(id_right));
|
||||
return ser;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw new CompilerInternalError("Invalid class member");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue