Skip to content

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

Description

@jmalloc

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

Activity

  1. self-assigned this
    on Jan 13, 2017
  2. jmalloc commented on Jan 13, 2017

    @jmalloc
    MemberAuthor

    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions