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

feat(espower): disambiguate between function calls and async/yield expressions #23

Merged

Conversation

jamestalmage
Copy link
Contributor

In order to fully disambiguate the contextual keywords async
and yield, we need to pass along some additional context to
power-assert-formatter. Specifically whether the enclosing function
is async or a generator.

This adds two new properties to the context passed to assert._expr()

  • async: true if the function enclosing the assertion is an async function
  • generator: true if the function enclosing the assertion is a generator

In both cases, we do not set a property if the enclosing function is not
a generator/async (i.e. we never pass async:false). This is primarily
to avoid having to rewrite a bunch of existing unit tests.

…pressions

In order to fully disambiguate the contextual keywords `async`
and `yield`, we need to pass along some addtional context to
power-assert-formatter. Specifically whether the enclosing function
is async or a generator.

This adds two new properties to the context passed to `assert._expr()`

 - `async: true` if the function enclosing the assertion is an async function
 - `generator: true` if the function enclosing the assertion is a generator

In both cases, we do not set a property if the enclosing function is not
a generator/async (i.e. we never pass `async:false`). This is primarily
to avoid having to rewrite a bunch of existing unit tests.
@twada
Copy link
Member

twada commented Nov 6, 2015

@jamestalmage Looks good to me now.
Committing build/espower.js makes you annoying. Sorry for inconvenience 😔

@jamestalmage
Copy link
Contributor Author

I'm starting to see the convenience of this: https://github.com/babel/babel/blob/master/doc/design/monorepo.md

@twada
Copy link
Member

twada commented Nov 6, 2015

Yeah now I know the Pros (and Cons) of monorepo approach.

@jamestalmage
Copy link
Contributor Author

@twada this is ready.
I had to push the espower to get some other stuff working.
Do you want me to drop that commit?

@jamestalmage jamestalmage force-pushed the disambiguate-async-and-yield branch from 9fdcb7d to 398585f Compare November 6, 2015 08:46
@twada
Copy link
Member

twada commented Nov 6, 2015

@jamestalmage I appreciate your kind offer.
Would you drop the last commit? (committing espower.js one)
I'll merge and release espower 1.2.1 ASAP.

@jamestalmage
Copy link
Contributor Author

@twada Already done!

@twada
Copy link
Member

twada commented Nov 6, 2015

@jamestalmage Oh you are responding so quickly!

twada added a commit that referenced this pull request Nov 6, 2015
feat(espower): disambiguate between function calls and async/yield expressions
@twada twada merged commit e6409d1 into power-assert-js:master Nov 6, 2015
@jamestalmage jamestalmage deleted the disambiguate-async-and-yield branch November 6, 2015 08:54
@jamestalmage
Copy link
Contributor Author

This is probably a minor bump instead of a patch.
So 1.3.0

@jamestalmage jamestalmage restored the disambiguate-async-and-yield branch November 6, 2015 08:56
@twada
Copy link
Member

twada commented Nov 6, 2015

Not a bugfix but a feature?

jamestalmage added a commit to jamestalmage/empower that referenced this pull request Nov 6, 2015
Adds support for monitoring the `asyn` and `generator` flags set by espower.

See power-assert-js/espower#23
@jamestalmage
Copy link
Contributor Author

Sure - it is a bugfix I guess.

@jamestalmage
Copy link
Contributor Author

1.2.1 is fine.

@twada
Copy link
Member

twada commented Nov 6, 2015

Okay It'll be 1.2.1

@jamestalmage jamestalmage deleted the disambiguate-async-and-yield branch November 6, 2015 09:04
jamestalmage added a commit to jamestalmage/empower that referenced this pull request Nov 6, 2015
Adds support for monitoring the `asyn` and `generator` flags set by espower.

See power-assert-js/espower#23
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.

2 participants