fix #1267
This commit is contained in:
parent
5fa839c0f7
commit
fc73ed2a5d
|
|
@ -3031,7 +3031,7 @@ begin
|
|||
Result.high := high;
|
||||
end;
|
||||
|
||||
[System.Diagnostics.DebuggerStepThrough]
|
||||
//[System.Diagnostics.DebuggerStepThrough]
|
||||
function CreateObjDiapason(low, high: object): Diapason;
|
||||
begin
|
||||
Result.clow := low;
|
||||
|
|
@ -3041,9 +3041,39 @@ end;
|
|||
[System.Diagnostics.DebuggerStepThrough]
|
||||
function CreateSet(params elems: array of object): TypedSet;
|
||||
begin
|
||||
var chars := false;
|
||||
var strings := false;
|
||||
var others := false;
|
||||
foreach var x in elems do
|
||||
begin
|
||||
if (x is char) or (x is Diapason) and (Diapason(x).clow is char) then
|
||||
chars := true
|
||||
else if x is string then
|
||||
strings := true
|
||||
else
|
||||
begin
|
||||
others := true;
|
||||
break
|
||||
end;
|
||||
end;
|
||||
|
||||
Result := new TypedSet();
|
||||
for var i := 0 to elems.Length - 1 do
|
||||
Result.IncludeElement(elems[i]);
|
||||
|
||||
if chars and strings and not others then
|
||||
foreach var x in elems do
|
||||
if x is char then
|
||||
Result.IncludeElement(x.ToString)
|
||||
else if (x is Diapason) and (Diapason(x).clow is char) then
|
||||
begin
|
||||
var c1 := char(Diapason(x).clow);
|
||||
var c2 := char(Diapason(x).chigh);
|
||||
for var cc := c1 to c2 do
|
||||
Result.IncludeElement(cc.ToString)
|
||||
end
|
||||
else Result.IncludeElement(x)
|
||||
else
|
||||
foreach var x in elems do
|
||||
Result.IncludeElement(x);
|
||||
end;
|
||||
|
||||
[System.Diagnostics.DebuggerStepThrough]
|
||||
|
|
|
|||
1589
TestSuite/CompilationSamples/PT4MakerNetX.pas
Normal file
1589
TestSuite/CompilationSamples/PT4MakerNetX.pas
Normal file
File diff suppressed because it is too large
Load diff
64
TestSuite/exceptions4.pas
Normal file
64
TestSuite/exceptions4.pas
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
var i: integer;
|
||||
|
||||
procedure test;
|
||||
begin
|
||||
try
|
||||
raise new Exception;
|
||||
finally
|
||||
i := 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure test2;
|
||||
begin
|
||||
try
|
||||
|
||||
finally
|
||||
i := 3;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure test3;
|
||||
begin
|
||||
try
|
||||
while true do
|
||||
try
|
||||
raise new Exception;
|
||||
finally
|
||||
i := 4;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure test4;
|
||||
begin
|
||||
try
|
||||
raise new Exception
|
||||
finally
|
||||
try
|
||||
raise new System.NotSupportedException;
|
||||
except
|
||||
i := 5;
|
||||
end;
|
||||
end;
|
||||
i := 6;
|
||||
end;
|
||||
|
||||
begin
|
||||
try
|
||||
test;
|
||||
except
|
||||
Inc(i);
|
||||
end;
|
||||
assert(i = 2);
|
||||
test2;
|
||||
assert(i = 3);
|
||||
test3;
|
||||
assert(i = 4);
|
||||
try
|
||||
test4;
|
||||
except
|
||||
end;
|
||||
assert(i = 5);
|
||||
end.
|
||||
|
|
@ -1881,18 +1881,19 @@ namespace PascalABCCompiler.TreeConverter
|
|||
statement_node finally_stmt = convert_strong(try_hndlr_finally.stmt_list);
|
||||
context.leave_code_block();
|
||||
stm.statements.AddElement(finally_stmt);
|
||||
|
||||
basic_function_call bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_not as basic_function_node,null);
|
||||
bfc.parameters.AddElement(new local_block_variable_reference(tmp_var,null));
|
||||
stm.statements.AddElement(new if_node(bfc,new rethrow_statement_node(null),null,null));
|
||||
exception_filter ef = new exception_filter(filter_type, lvr, stm, null);
|
||||
efl.AddElement(ef);
|
||||
//efl.AddElement(ef);
|
||||
bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_assign as basic_function_node,null);
|
||||
bfc.parameters.AddElement(new local_block_variable_reference(tmp_var,null));
|
||||
bfc.parameters.AddElement(new bool_const_node(true,null));
|
||||
|
||||
(try_statements as statements_list).statements.AddElement(bfc);
|
||||
(try_statements as statements_list).statements.AddElement(new throw_statement_node(current_catch_excep,null));
|
||||
return_value(new try_block(try_statements, null, efl, loc));
|
||||
//(try_statements as statements_list).statements.AddElement(bfc);
|
||||
//(try_statements as statements_list).statements.AddElement(new throw_statement_node(current_catch_excep,null));
|
||||
return_value(new try_block(try_statements, finally_stmt, efl, loc));
|
||||
context.leave_exception_handlers();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue