Skip to content

Commit

Permalink
Proper fix without deleting tests -- thanks @chancancode!
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Mar 27, 2024
1 parent d328f73 commit f1f4fd7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Expand Up @@ -1269,7 +1269,7 @@ moduleFor(

['@test non-block with properties on this.attrs']() {
this.registerComponent('non-block', {
template: 'In layout - someProp: {{this.attrs.someProp}}{{log this.attrs}}',
template: 'In layout - someProp: {{this.attrs.someProp}}',
});

this.render('{{non-block someProp=this.prop}}', {
Expand Down
Expand Up @@ -80,6 +80,18 @@ function isAttrs(node: AST.PathExpression, symbols: string[]) {
return false;
}

if (name === 'this' && node.head.type === 'ThisHead' && node.tail.includes('attrs')) {
// node.tail will be attrs.foo
// this makes it just foo (this.foo for the passed in node)
node.tail.shift();

// Deliberately do not say this is an "attrs" node.
// See this Deprecation RFC: https://github.com/emberjs/rfcs/pull/1016
// and this discussion here:
// https://github.com/emberjs/ember.js/pull/20671
return false;
}

if (name === 'attrs') {
if (node.head.type === 'ThisHead') {
node.tail.shift();
Expand Down

0 comments on commit f1f4fd7

Please sign in to comment.