From ee2c050521f5293c337338af9d3c6c1bd1c4edaa Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 16 Jul 2018 08:42:03 +0100 Subject: [PATCH] fix(ivy): make ngtsc `ClassMember` `node` and `declaration` optional (#24897) Not all code formats have associated nodes and declarations for class members. PR Close #24897 --- packages/compiler-cli/src/ngtsc/host/src/reflection.ts | 4 ++-- packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/host/src/reflection.ts b/packages/compiler-cli/src/ngtsc/host/src/reflection.ts index d47f27c269..bfea18a9ac 100644 --- a/packages/compiler-cli/src/ngtsc/host/src/reflection.ts +++ b/packages/compiler-cli/src/ngtsc/host/src/reflection.ts @@ -53,9 +53,9 @@ export enum ClassMemberKind { */ export interface ClassMember { /** - * TypeScript reference to the class member itself. + * TypeScript reference to the class member itself, or null if it is not applicable. */ - node: ts.Node; + node: ts.Node|null; /** * Indication of which type of member this is (property, method, etc). diff --git a/packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts b/packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts index 66f4e66648..17b831087f 100644 --- a/packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts +++ b/packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts @@ -544,7 +544,7 @@ class StaticInterpreter { throw new Error(`attempting to call something that is not a function: ${lhs}`); } else if (!isFunctionOrMethodReference(lhs)) { throw new Error( - `calling something that is not a function declaration? ${ts.SyntaxKind[lhs.node.kind]}`); + `calling something that is not a function declaration? ${ts.SyntaxKind[lhs.node.kind]} (${node.getText()})`); } const fn = lhs.node;