Skip to content

Commit

Permalink
fixup! improve ngWalker by preventing an error when a class has no name.
Browse files Browse the repository at this point in the history
  • Loading branch information
wKoza committed Mar 10, 2019
1 parent c9786b2 commit a9aeed5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/angular/metadataReader.ts
Expand Up @@ -97,9 +97,9 @@ export class MetadataReader {
const name = nameExpression && isStringLiteralLike(nameExpression) ? nameExpression.text : undefined;

const pureExpression = getDecoratorPropertyInitializer(dec, 'pure');
const isBoolean = pureExpression && isBooleanLiteralLike(pureExpression);
const pure = pureExpression && isBooleanLiteralLike(pureExpression) ? pureExpression : undefined;

return new PipeMetadata(d, dec, name, isBoolean ? (pureExpression as ts.BooleanLiteral) : undefined);
return new PipeMetadata(d, dec, name, pure);
}

protected readModuleMetadata(d: ts.ClassDeclaration, dec: ts.Decorator): DirectiveMetadata {
Expand Down
3 changes: 1 addition & 2 deletions src/noPipeImpureRule.ts
Expand Up @@ -38,8 +38,7 @@ export class ClassMetadataWalker extends NgWalker {
}

private validatePipe(metadata: PipeMetadata): void {
if (!metadata.pure) return;
if (metadata.pure!.kind !== SyntaxKind.FalseKeyword) return;
if (!metadata.pure || metadata.pure.kind !== SyntaxKind.FalseKeyword) return;

const className = getClassName(metadata.controller)!;

Expand Down

0 comments on commit a9aeed5

Please sign in to comment.