Ejemplo n.º 1
0
  @Override
  public void visitFunctionDeclaration(FunctionDeclarationTree tree) {
    newFunctionScope(tree);

    skipBlock(tree.body());
    super.visitFunctionDeclaration(tree);

    leaveScope();
  }
  @Test
  public void generator() throws Exception {
    FunctionDeclarationTree tree = parse("function* g() {}", Kind.GENERATOR_DECLARATION);

    assertThat(tree.is(Kind.GENERATOR_DECLARATION)).isTrue();
    assertThat(tree.functionKeyword().text()).isEqualTo("function");
    assertThat(tree.starToken()).isNotNull();
    assertThat(tree.parameters()).isNotNull();
    assertThat(tree.body()).isNotNull();
  }