Skip to content

Commit

Permalink
Revert changes to assert-against-attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Mar 28, 2024
1 parent 8644d5f commit e967187
Showing 1 changed file with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function assertAgainstAttrs(env: EmberASTPluginEnvironment): ASTP
name: 'assert-against-attrs',

visitor: {
Block: {
Program: {
enter(node: AST.Program) {
updateBlockParamsStack(node.blockParams);
},
Expand Down Expand Up @@ -74,27 +74,15 @@ export default function assertAgainstAttrs(env: EmberASTPluginEnvironment): ASTP
}

function isAttrs(node: AST.PathExpression, symbols: string[]) {
let name = node.head.original;
let name = node.parts[0];

if (name && symbols.indexOf(name) !== -1) {
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();
if (node.this === true) {
node.parts.shift();
node.original = node.original.slice(5);
}

Expand Down

0 comments on commit e967187

Please sign in to comment.