Skip to content
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

Ensure that instrumentation works with functions that return coroutines. #10

Open
jmalloc opened this issue Jan 13, 2017 · 1 comment
Open
Assignees

Comments

@jmalloc
Copy link
Member

jmalloc commented Jan 13, 2017

That is:

use Generator as Coroutine;

function a() : Coroutine
{
   yield 1;
}

/**
 * This function is annotated as coroutine, but is not actually a generator,
 * which is probably tripping up the stack trace generator.
 */
function b() : Coroutine
{
    return a();
}

FYI @ezzatron

@jmalloc jmalloc added the defect label Jan 13, 2017
@jmalloc jmalloc self-assigned this Jan 13, 2017
@jmalloc
Copy link
Member Author

jmalloc commented Jan 13, 2017

The problem is that the tracing code injections a yield statement, changing this non-generator to a generator. This may be a little involved to fix properly, as the instrumentor will need to travserse the AST to look for existing yield statements before outputting the start of the instrumentation code.

As a workaround, simply annotate the outer function's return value as Generator instead of Coroutine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant