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

Non-generator method after generator method is treated as generator method #2388

Closed
arai-a opened this Issue May 15, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@arai-a
Copy link
Contributor

arai-a commented May 15, 2015

If an object literal contains a generator method and subsequent non-generator method, that non-generator method is parsed as generator method, and it shows an error about missing yield statement.

Test case:

var obj = {
  *gen() {
    yield 1;
  },
  non_gen() {
  }
};

Expected result:
It passes.

Actual result:
It shows following error

test.js: line 6, col 3, A generator function shall contain a yield statement.

arai-a added a commit to arai-a/jshint that referenced this issue May 15, 2015

[[FIX]] Reset generator flag for each method definition
This patch fixes the handling of non-generator method after generator method.
For examle:

    var a = {
      *gen() {
        yield 1;
      },
      non_gen() {
      }
    };

Here, non_gen was treated as a generator function, since generator flag `g`
wasn't reset to false when `*` wasn't found before method name.

Fixes jshint#2388

arai-a added a commit to arai-a/jshint that referenced this issue May 15, 2015

[[FIX]] Reset generator flag for each method definition
This patch fixes the handling of non-generator method after generator method.
For examle:

    var a = {
      *gen() {
        yield 1;
      },
      non_gen() {
      }
    };

Here, non_gen was treated as a generator function, since generator flag `g`
wasn't reset to false when `*` wasn't found before method name.

Fixes jshint#2388

arai-a added a commit to arai-a/jshint that referenced this issue May 15, 2015

[[FIX]] Reset generator flag for each method definition
This patch fixes the handling of non-generator method after generator method.
For examle:

    var a = {
      *gen() {
        yield 1;
      },
      non_gen() {
      }
    };

Here, non_gen was treated as a generator function, since generator flag `g`
wasn't reset to false when `*` wasn't found before method name.

Fixes jshint#2388

arai-a added a commit to arai-a/jshint that referenced this issue May 15, 2015

[[FIX]] Reset generator flag for each method definition
This patch fixes the handling of non-generator method after generator method.
For examle:

    var a = {
      *gen() {
        yield 1;
      },
      non_gen() {
      }
    };

Here, non_gen was treated as a generator function, since generator flag `g`
wasn't reset to false when `*` wasn't found before method name.

Fixes jshint#2388

@caitp caitp closed this in 2444a04 May 15, 2015

jugglinmike added a commit to jugglinmike/jshint that referenced this issue Jun 3, 2015

[[FIX]] Reset generator flag for each method definition
This patch fixes the handling of non-generator method after generator method.
For examle:

    var a = {
      *gen() {
        yield 1;
      },
      non_gen() {
      }
    };

Here, non_gen was treated as a generator function, since generator flag `g`
wasn't reset to false when `*` wasn't found before method name.

Closes jshint#2388
Closes jshint#2389
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment