support of System.Diagnostics.Conditional

This commit is contained in:
Ivan Bondarev 2021-08-10 21:23:15 +02:00
parent 5865d3d431
commit 89f9751d33
9 changed files with 61 additions and 3 deletions

View file

@ -159,7 +159,7 @@ namespace PascalABCCompiler
} }
} }
catch catch (Exception ex)
{ {
Remove(so.Ident); Remove(so.Ident);
} }

View file

@ -7262,6 +7262,8 @@ namespace PascalABCCompiler.NETGenerator
//вызов статического метода //вызов статического метода
public override void visit(SemanticTree.ICommonStaticMethodCallNode value) public override void visit(SemanticTree.ICommonStaticMethodCallNode value)
{ {
if (comp_opt.dbg_attrs == DebugAttributes.Release && has_debug_conditional_attr(helper.GetMethod(value.static_method).mi))
return;
//if (save_debug_info) //if (save_debug_info)
//MarkSequencePoint(value.Location); //MarkSequencePoint(value.Location);
IExpressionNode[] real_parameters = value.real_parameters; IExpressionNode[] real_parameters = value.real_parameters;

View file

@ -0,0 +1,8 @@
function f(i: integer): boolean;
begin
end;
begin
if f then
exit;
end.

View file

@ -0,0 +1,8 @@
function f(i: integer): boolean;
begin
end;
begin
while f do
exit;
end.

View file

@ -0,0 +1,9 @@
function f(i: integer): boolean;
begin
end;
begin
repeat
until f;
end.

View file

@ -0,0 +1,12 @@
function f(i: integer): string;
begin
end;
procedure p(s: string);
begin
end;
begin
p(f);
end.

View file

@ -0,0 +1,8 @@
function f(i: integer): string;
begin
end;
begin
writeln(f.GetType);
end.

View file

@ -0,0 +1,10 @@
function f(i: integer): integer;
begin
end;
begin
case f of
1: writeln(2);
end;
end.

View file

@ -15666,7 +15666,7 @@ namespace PascalABCCompiler.TreeConverter
{ {
expression_node condition = convert_strong(_if_node.condition); expression_node condition = convert_strong(_if_node.condition);
condition = convertion_data_and_alghoritms.convert_type(condition, SystemLibrary.SystemLibrary.bool_type); condition = convertion_data_and_alghoritms.convert_type(condition, SystemLibrary.SystemLibrary.bool_type);
try_convert_typed_expression_to_function_call(ref condition, true);
// SSM 29/08/16 // SSM 29/08/16
/*var cc = condition as bool_const_node; /*var cc = condition as bool_const_node;
if (cc != null && cc.constant_value == false && _if_node.else_body == null) if (cc != null && cc.constant_value == false && _if_node.else_body == null)
@ -15722,7 +15722,7 @@ namespace PascalABCCompiler.TreeConverter
{ {
expression_node expr = convert_strong(_while_node.expr); expression_node expr = convert_strong(_while_node.expr);
expr = convertion_data_and_alghoritms.convert_type(expr, SystemLibrary.SystemLibrary.bool_type); expr = convertion_data_and_alghoritms.convert_type(expr, SystemLibrary.SystemLibrary.bool_type);
try_convert_typed_expression_to_function_call(ref expr, true);
CheckToEmbeddedStatementCannotBeADeclaration(_while_node.statements); CheckToEmbeddedStatementCannotBeADeclaration(_while_node.statements);
while_node wn = new while_node(expr, get_location(_while_node)); while_node wn = new while_node(expr, get_location(_while_node));
@ -15770,6 +15770,7 @@ namespace PascalABCCompiler.TreeConverter
rep.body = st; rep.body = st;
expression_node expr = convert_strong(_repeat_node.expr); expression_node expr = convert_strong(_repeat_node.expr);
expr = convertion_data_and_alghoritms.convert_type(expr, SystemLibrary.SystemLibrary.bool_type); expr = convertion_data_and_alghoritms.convert_type(expr, SystemLibrary.SystemLibrary.bool_type);
try_convert_typed_expression_to_function_call(ref expr, true);
rep.condition = expr; rep.condition = expr;
context.cycle_stack.pop(); context.cycle_stack.pop();
return_value(rep); return_value(rep);