diff --git a/TestSuite/CompilationSamples/15.pas b/TestSuite/CompilationSamples/15.pas index 23206ab8b..0ceff2fc1 100644 --- a/TestSuite/CompilationSamples/15.pas +++ b/TestSuite/CompilationSamples/15.pas @@ -1,4 +1,4 @@ -// Игра в 15 +// Игра в 15 uses GraphABC,ABCObjects,ABCButtons; const diff --git a/TestSuite/defaultconstr1.pas b/TestSuite/defaultconstr1.pas new file mode 100644 index 000000000..6d6d3d3e3 --- /dev/null +++ b/TestSuite/defaultconstr1.pas @@ -0,0 +1,13 @@ +type A = class +i: integer; +procedure p; + begin + var w := new A; + w.i := 2; + assert(w.i = 2); + end; +end; +begin +var obj := new A; +obj.p; +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index d36d7f2e6..fb7643ce9 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -3748,21 +3748,30 @@ namespace PascalABCCompiler.TreeConverter } if (SemanticRules.OrderIndependedMethodNames) { - visit_class_member_realizations(_class_body); - } - if (!context.converted_type.is_value && !context.converted_type.IsInterface) - { - generate_inherit_constructors(); - } - if (!context.converted_type.IsInterface && context.converted_type.static_constr == null) - { - //generate_static_constructor(); - } - if (!context.converted_type.IsInterface && !context.converted_type.has_default_constructor) - { - generate_default_constructor(); + if (!context.converted_type.is_value && !context.converted_type.IsInterface) + { + generate_inherit_constructors(); + } + if (!context.converted_type.IsInterface && !context.converted_type.has_default_constructor) + { + generate_default_constructor(); + } + + visit_class_member_realizations(_class_body); } + if (!SemanticRules.OrderIndependedMethodNames) + { + if (!context.converted_type.is_value && !context.converted_type.IsInterface) + { + generate_inherit_constructors(); + } + if (!context.converted_type.IsInterface && !context.converted_type.has_default_constructor) + { + generate_default_constructor(); + } + } + } private bool disable_order_independ;