Conversation
…ct/neo-devpack-dotnet into Branch_lights_trycatch
| else if (_type.DeclaringType.FullName.Contains("Exception")) | ||
| { | ||
| //对异常对象要留一个,因为catch 会处理这个栈 | ||
| _Convert1by1(VM.OpCode.NOP, src, to);//空白 |
There was a problem hiding this comment.
If we use the optimizer to delete NOP, does that affect this?
There was a problem hiding this comment.
do not worry,optimzer is safe to delete any NOP
|
@lightszero dalao, vm has merged the try-catch pr, we can continue this pr now. 😂 |
|
go go go |
|
@Tommo-L many unittest had fail, help |
Ok, I'll help fix these ut. |
|
This pr blocked by #219, as neo-core have merged the offset pr, most ut need to adjust. |
|
Can we supports catching details of exceptions? like: try
{
}
catch (Exception ex)
{
Runtime.Notify("error:" + ex.Message);
} |
we can do that next step. |
|
@lightszero need your help, I have tried to fix it but failed, I need more time. Could you have a look? public static object tryWithTwoFinally()
{
int v = 0;
try
{
try
{
v++;
}
catch
{
v += 2;
}
finally
{
v += 3;
}
}
catch
{
v += 4;
}
finally
{
v += 5;
}
return v;
}Found by @ProDog |
|
got it,I will check that. |
|
It's a new ut. The current ut all are passed. Should I send a new PR to add the new ut. And the source code is here, #186 (comment) |
|
you could direct add ut in this pr. |
|
Plz, merge this pr #261, I don't have the authorization to push commit directly. |
|
@Tommo-L done,it worked. |
|
Need your last test @ProDog |
Cool, I have tested it passed. |
* parseTryCatch * fix try endpos problem * add parse code for no catch and no finally * update trycatch * add a unittest * fix compile error on compiler * fix compiler about trycatch * fix opcodes * fix optimizer for try catch * open optimize for trycatch unittest * Fix format * fix UT (#255) * add try-finally ut (#259) * add try-finally ut * format, translate * fix try-finally and add try-catch * refactor code * keep only one try-catch matched * add commont for exception paramcount. * Update src/Neo.Compiler.MSIL/MSIL/Converter.cs * Update src/Neo.Compiler.MSIL/MSIL/Converter.cs * add try-catch failure ut (#261) * fix some skip leaves problem. * Reduce changes Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: ShawnYun <42930111+ShawnYun@users.noreply.github.com> Co-authored-by: Luchuan <luchuan@neo.org>
* parseTryCatch * fix try endpos problem * add parse code for no catch and no finally * update trycatch * add a unittest * fix compile error on compiler * fix compiler about trycatch * fix opcodes * fix optimizer for try catch * open optimize for trycatch unittest * Fix format * fix UT (#255) * add try-finally ut (#259) * add try-finally ut * format, translate * fix try-finally and add try-catch * refactor code * keep only one try-catch matched * add commont for exception paramcount. * Update src/Neo.Compiler.MSIL/MSIL/Converter.cs * Update src/Neo.Compiler.MSIL/MSIL/Converter.cs * add try-catch failure ut (#261) * fix some skip leaves problem. * Reduce changes Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: ShawnYun <42930111+ShawnYun@users.noreply.github.com> Co-authored-by: Luchuan <luchuan@neo.org>
working