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

Add support for nested invocation with :: #59

Merged
merged 6 commits into from
Apr 4, 2019

Conversation

rtablada
Copy link
Contributor

@rtablada rtablada commented Apr 2, 2019

No description provided.

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI failures on ember-source >= 3.4.0 < 3.10.0-beta.1 are because the AST transform that was updated here is not currently ran for ember-source >= 3.4.0, and the underlying system does not support template:components/foo::bar as a valid name.

The fix is to add another AST transform that runs only on ember-source < 3.10.0-alpha.1 that transforms from this:

<Foo::Bar />

To:

{{#let (component 'foo/bar') as |FooBar_AGLPLYFL|}}
<FooBar_AGLPLYFL />
{{/let}}

@rtablada
Copy link
Contributor Author

rtablada commented Apr 3, 2019

@rwjblue yeah I didn't see that I only had run default try scenario and didn't catch. I wondered if the AST was noop in 3.4+.

Updating to the two AST approach.

index.js Outdated Show resolved Hide resolved
Co-Authored-By: rtablada <[email protected]>
Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm whipping up some tweaks to the transform, will push in a minute so you can review and let me know what you think...

lib/ast-nested-transform.js Outdated Show resolved Hide resolved
rwjblue added 2 commits April 4, 2019 09:57
* Ensures only one `let` is ever created
* Reuses the same yielded block param for every invocation of the same
  underlying component
* Ensures that `Foo::Bar::Baz` works (arbitrary nesting levels)
* Uses custom suffix to ensure no block param collisions exist
@rwjblue
Copy link
Member

rwjblue commented Apr 4, 2019

@rtablada - Ready for review, lemme know what you think...

Also, you can poke at the transform and see it "live" here:

https://astexplorer.net/#/gist/0590eb883edfcd163b183514df4cc717

@rwjblue rwjblue force-pushed the rt/ast-for-nesting branch from 1d7ed15 to 386f2eb Compare April 4, 2019 14:02
@rtablada
Copy link
Contributor Author

rtablada commented Apr 4, 2019

@rwjblue looks good! I used the ast transformer to debug live to build this!

@rwjblue rwjblue merged commit e6a6582 into ember-polyfills:master Apr 4, 2019
@rwjblue rwjblue added the enhancement New feature or request label Apr 8, 2019
@rwjblue rwjblue changed the title AST Transform for Nested Invocation with :: Add support for nested invocation with :: Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants