• Home
  • Raw
  • Download

Lines Matching full:symbol

42 export const SYMBOL = 'Symbol';  constant
111 // when type equals `typeof <Enum>`, only symbol contains information about it's type.
112 const isEnumSymbol = tsType.symbol && this.isEnum(tsType.symbol);
118 static isEnum(tsSymbol: ts.Symbol): boolean {
145 followIfAliased(sym: ts.Symbol): ts.Symbol {
152 private readonly trueSymbolAtLocationCache = new Map<ts.Node, ts.Symbol | null>();
154 trueSymbolAtLocation(node: ts.Node): ts.Symbol | undefined {
180 static symbolHasDuplicateName(symbol: ts.Symbol, tsDeclKind: ts.SyntaxKind): boolean {
183 * Type Checker merges all declarations with the same name in one scope into one symbol.
184 * Thus, check whether the symbol of certain declaration has any declaration with
187 const symbolDecls = symbol?.getDeclarations();
239 static isTypeSymbol(symbol: ts.Symbol | undefined): boolean {
241 !!symbol &&
242 !!symbol.flags &&
243 … ((symbol.flags & ts.SymbolFlags.Class) !== 0 || (symbol.flags & ts.SymbolFlags.Interface) !== 0)
267 const symbol = tsType.symbol; constant
268 if (!symbol) {
271 const name = this.tsTypeChecker.getFullyQualifiedName(symbol);
272 if (this.isGlobalSymbol(symbol) && TYPED_ARRAYS.includes(name)) {
275 const decl = TsUtils.getDeclaration(symbol);
277 …tils.isArkTSCollectionsClassOrInterfaceDeclaration(decl) && TYPED_ARRAYS.includes(symbol.getName())
298 if (!tsType.symbol?.declarations) {
306 for (const tsTypeDecl of tsType.symbol.declarations) {
329 static isPrototypeSymbol(symbol: ts.Symbol | undefined): boolean {
330 return !!symbol && !!symbol.flags && (symbol.flags & ts.SymbolFlags.Prototype) !== 0;
333 static isFunctionSymbol(symbol: ts.Symbol | undefined): boolean {
334 return !!symbol && !!symbol.flags && (symbol.flags & ts.SymbolFlags.Function) !== 0;
339 …!!tsType && !!tsType.symbol && !!tsType.symbol.flags && (tsType.symbol.flags & ts.SymbolFlags.Inte…
371 static isMethodAssignment(tsSymbol: ts.Symbol | undefined): boolean {
377 static getDeclaration(tsSymbol: ts.Symbol | undefined): ts.Declaration | undefined {
546 if (!typeA.symbol?.declarations) {
550 for (const typeADecl of typeA.symbol.declarations) {
715 if (tsType.symbol && tsType.isClassOrInterface() && tsType.symbol.name === 'Object') {
739 if (type.symbol.members === undefined) {
745 type.symbol.members.forEach((value) => {
763 if (type.symbol.members === undefined) {
772 type.symbol.members.forEach((value) => {
793 if (type.isClass() && type.symbol.declarations && type.symbol.declarations.length > 0) {
794 const declClass = type.symbol.declarations[0] as ts.ClassDeclaration;
830 findProperty(type: ts.Type, name: string): ts.Symbol | undefined {
949 getPropertySymbol(type: ts.Type, prop: ts.PropertyAssignment): ts.Symbol | undefined {
1082 parentSymbolCache = new Map<ts.Symbol, string | undefined>();
1084 getParentSymbolName(symbol: ts.Symbol): string | undefined {
1085 const cached = this.parentSymbolCache.get(symbol);
1090 const name = this.tsTypeChecker.getFullyQualifiedName(symbol);
1093 this.parentSymbolCache.set(symbol, result);
1097 isGlobalSymbol(symbol: ts.Symbol): boolean {
1098 const parentName = this.getParentSymbolName(symbol);
1102 isSymbolAPI(symbol: ts.Symbol): boolean {
1103 const parentName = this.getParentSymbolName(symbol);
1105 const name = parentName ? parentName : symbol.escapedName;
1106 return name === SYMBOL || name === SYMBOL_CONSTRUCTOR;
1108 return !!parentName && (parentName === SYMBOL || parentName === SYMBOL_CONSTRUCTOR);
1111 isSymbolIterator(symbol: ts.Symbol): boolean {
1113 const name = symbol.name;
1114 const parName = this.getParentSymbolName(symbol);
1115 return (parName === SYMBOL || parName === SYMBOL_CONSTRUCTOR) && name === ITERATOR;
1117 return this.isSymbolAPI(symbol) && symbol.name === ITERATOR;
1121 const symbol = this.trueSymbolAtLocation(expr); constant
1122 return !!symbol && this.isSymbolIterator(symbol);
1315 * in this case will resolve to origin 'Record' symbol.
1329 const symbol = type.symbol; constant
1330 if (!symbol) {
1333 const name = this.tsTypeChecker.getFullyQualifiedName(symbol);
1334 return name === 'Error' && this.isGlobalSymbol(symbol);
1369 isLibrarySymbol(sym: ts.Symbol | undefined): boolean {
1462 let sym: ts.Symbol | undefined = type.symbol;
1523 return this.isLibrarySymbol(type.symbol);
1570 static getSymbolDeclarationTypeNode(sym: ts.Symbol): ts.TypeNode | undefined {
1583 static symbolHasEsObjectType(sym: ts.Symbol): boolean {
1588 static isEsObjectSymbol(sym: ts.Symbol): boolean {
1613 getSymbolOfCallExpression(callExpr: ts.CallExpression): ts.Symbol | undefined {
1629 return type.symbol && (type.symbol.flags & ts.SymbolFlags.Class) !== 0;
1636 const symbol = this.trueSymbolAtLocation(expr); constant
1637 return !symbol || (symbol.flags & ts.SymbolFlags.Class) === 0;
1703 const sym = type.symbol;
1708 const sym = type.symbol;
1713 const sym = type.symbol;
1718 const symbol = this.trueSymbolAtLocation(expr); constant
1719 const isEnumMember = !!symbol && !!(symbol.flags & ts.SymbolFlags.EnumMember);
1889 * symbol in case of type reference node.
2020 static isConstEnum(sym: ts.Symbol | undefined): boolean {
2067 const symbol = type.aliasSymbol ?? type.getSymbol(); constant
2068 if (symbol?.declarations === undefined || symbol.declarations.length < 1) {
2072 return TsUtils.isArkTSISendableDeclaration(symbol.declarations[0]);
2111 const symbol = type.aliasSymbol ?? type.getSymbol(); constant
2112 if (symbol?.declarations === undefined || symbol.declarations.length < 1) {
2116 return this.isArkTSCollectionsArrayLikeDeclaration(symbol.declarations[0]);
2268 findIdentifierNameForSymbol(symbol: ts.Symbol): string | undefined {
2269 let name = TsUtils.getIdentifierNameFromString(symbol.name);
2270 if (name === undefined || name === symbol.name) {
2274 const parentType = this.getTypeByProperty(symbol);
2324 private getTypeByProperty(symbol: ts.Symbol): ts.Type | undefined {
2325 if (symbol.declarations === undefined) {
2329 for (const propDecl of symbol.declarations) {
2347 static isPropertyOfInternalClassOrInterface(symbol: ts.Symbol): boolean {
2348 if (symbol.declarations === undefined) {
2352 for (const propDecl of symbol.declarations) {
2382 const symbol = tsType.symbol; constant
2383 const name = this.tsTypeChecker.getFullyQualifiedName(symbol);
2384 return name === 'String' && this.isGlobalSymbol(symbol);
2388 const sym = type.symbol;
2555 const decls = funcDecl.symbol.getDeclarations();