Skip to content

Conversation

yglukhov
Copy link
Member

@yglukhov yglukhov commented May 4, 2018

Includes #7704.
Adds yield in try.

@dom96
Copy link
Contributor

dom96 commented May 4, 2018

I ripped out the try transformation from the async macro and ran into an internal error in the tasynctry test. Here is the branch in case you want to try, it's got the changes from this PR: https://github.com/nim-lang/Nim/tree/rip-out-try-async (you can merge it into your branch if you wish).

@dom96
Copy link
Contributor

dom96 commented May 5, 2018

@yglukhov btw, will yield in except be supported too? :)

@yglukhov
Copy link
Member Author

yglukhov commented May 5, 2018

@dom96, of course, it is in the tests already :)

@yglukhov yglukhov reopened this May 7, 2018
@yglukhov
Copy link
Member Author

yglukhov commented May 8, 2018

Known issues fixed. Please proceed with the review. asyncftpclient test failure looks unrelated.

@Araq Araq closed this May 8, 2018
@Araq Araq reopened this May 8, 2018
@dom96
Copy link
Contributor

dom96 commented May 8, 2018

The compiler doesn't crash anymore, but the async tests don't work with your transformation: https://github.com/nim-lang/Nim/tree/rip-out-try-async-2

@yglukhov
Copy link
Member Author

yglukhov commented May 8, 2018

@dom96, I've fixed one of the tests. The rest you should fix along with your transformation rip out.

@Araq
Copy link
Member

Araq commented May 9, 2018

So ... is this ready to be merged?

needsSplit = true

result = newNodeI(nkStmtListExpr, n.info)
if n.typ.isNil: internalError("lowerStmtListExprs: constr typ.isNil")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure nkArgList has no type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i just removed nkArgList from the case branch, since its not supposed to make it into the transformation anyway.


ctx.curExcHandlingState = exceptIdx

discard ctx.transformReturnsInTry(tryBody)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These discards are concerning. The result is not to be discarded unless ctx.transformReturnsInTry(tryBody) == tryBody. If so, this should be asserted.

@Araq Araq added the v1 label May 24, 2018
@Araq Araq added this to the v1 milestone May 24, 2018
@dom96 dom96 removed the v1 label May 30, 2018
@Araq Araq merged commit 3cbc07a into nim-lang:devel Jun 5, 2018
@yglukhov yglukhov deleted the yield-in-try branch June 5, 2018 17:59
@yglukhov yglukhov mentioned this pull request Jun 5, 2018
Araq pushed a commit that referenced this pull request Apr 18, 2024
fixes #4695

ref #15818

Since `nkState` is only for the main loop state labels and `nkGotoState`
is used only for dispatching the `:state` (since
#7770), it's feasible to rewrite the
loop body into a single case-based dispatcher, which enables support for
JS, VM backend. `nkState` Node is replaced by a label and Node pair and
`nkGotoState` is only used for intermediary processing. Backends only
need to implement `nkBreakState` and `closureIterSetupExc` to support
closure iterators.

pending #23484

<del> I also observed some performance boost for C backend in the
release mode (not in the danger mode though, I suppose the old
implementation is optimized into computed goto in the danger mode)
</del>

allPathsAsgnResult???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants