tests for virtual properties
This commit is contained in:
parent
787e0cf6a8
commit
948632cb43
28
TestSuite/errors/err0228.pas
Normal file
28
TestSuite/errors/err0228.pas
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{$reference 'PresentationFramework.dll'}
|
||||
{$reference 'WindowsBase.dll'}
|
||||
{$reference 'PresentationCore.dll'}
|
||||
{$reference 'WindowsFormsIntegration.dll'}
|
||||
|
||||
{$apptype windows}
|
||||
uses System.Windows;
|
||||
uses System.Windows.Media;
|
||||
|
||||
type
|
||||
MyVisualHostBase = class(FrameworkElement)
|
||||
public function getCnt: integer;
|
||||
begin
|
||||
Result := VisualChildrenCount;
|
||||
end;
|
||||
end;
|
||||
MyVisualHost = class(MyVisualHostBase)
|
||||
|
||||
function getVisualChildrenCount: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
protected property VisualChildrenCount2: integer read getVisualChildrenCount; override;
|
||||
end;
|
||||
begin
|
||||
var obj: MyVisualHostBase := new MyVisualHost;
|
||||
assert(obj.getCnt=1);
|
||||
end.
|
||||
28
TestSuite/property4.pas
Normal file
28
TestSuite/property4.pas
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{$reference 'PresentationFramework.dll'}
|
||||
{$reference 'WindowsBase.dll'}
|
||||
{$reference 'PresentationCore.dll'}
|
||||
{$reference 'WindowsFormsIntegration.dll'}
|
||||
|
||||
{$apptype windows}
|
||||
uses System.Windows;
|
||||
uses System.Windows.Media;
|
||||
|
||||
type
|
||||
MyVisualHostBase = class(FrameworkElement)
|
||||
public function getCnt: integer;
|
||||
begin
|
||||
Result := VisualChildrenCount;
|
||||
end;
|
||||
end;
|
||||
MyVisualHost = class(MyVisualHostBase)
|
||||
|
||||
function getVisualChildrenCount: integer;
|
||||
begin
|
||||
Result := 1;
|
||||
end;
|
||||
protected property VisualChildrenCount: integer read getVisualChildrenCount; override;
|
||||
end;
|
||||
begin
|
||||
var obj: MyVisualHostBase := new MyVisualHost;
|
||||
assert(obj.getCnt=1);
|
||||
end.
|
||||
|
|
@ -3945,7 +3945,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
//pn.loc=get_location(_simple_property.property_name);
|
||||
if (_simple_property.attr == SyntaxTree.definition_attribute.Static)
|
||||
pn.polymorphic_state = SemanticTree.polymorphic_state.ps_static;
|
||||
if (_simple_property.virt_over_none_attr == proc_attribute.attr_virtual)
|
||||
if (_simple_property.virt_over_none_attr == proc_attribute.attr_virtual || _simple_property.virt_over_none_attr == proc_attribute.attr_override)
|
||||
pn.polymorphic_state = SemanticTree.polymorphic_state.ps_virtual;
|
||||
|
||||
parameter_list pal_big = new parameter_list();
|
||||
|
|
|
|||
Loading…
Reference in a new issue