-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add trycatch support #186
add trycatch support #186
Conversation
…ct/neo-devpack-dotnet into Branch_lights_trycatch
@@ -1348,11 +1348,24 @@ private int _ConvertNewObj(OpCode src, NeoMethod to) | |||
} | |||
else if (_type.DeclaringType.FullName.Contains("Exception")) | |||
{ | |||
//对异常对象要留一个,因为catch 会处理这个栈 | |||
_Convert1by1(VM.OpCode.NOP, src, to);//空白 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use the optimizer to delete NOP
, does that affect this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if DEBUG ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
Insert1(VM.OpCode.DROP, "", to); | ||
ConvertPushString("usererror", src, to); | ||
} | ||
else if (pcount == 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!= and remove the empty block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a comment for it.
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. |
working