Skip to content

Commit bbd1bec

Browse files
committed
Renamed 'ComplexType' -> 'CompoundType'
1 parent 7836adf commit bbd1bec

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

src/CrossScopeValidator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { ReferenceType } from './types/ReferenceType';
1111
import { getAllRequiredSymbolNames } from './types/ReferenceType';
1212
import type { TypeChainEntry, TypeChainProcessResult } from './interfaces';
1313
import { BscTypeKind } from './types/BscTypeKind';
14-
import { getAllTypesFromComplexType } from './types/helpers';
14+
import { getAllTypesFromCompoundType } from './types/helpers';
1515
import type { BscType } from './types/BscType';
1616
import type { BscFile } from './files/BscFile';
1717
import type { ClassStatement, ConstStatement, EnumMemberStatement, EnumStatement, InterfaceStatement, NamespaceStatement } from './parser/Statement';
@@ -222,7 +222,7 @@ export class CrossScopeValidator {
222222
}
223223

224224
if (isUnionType(symbol.typeChain[0].type) && symbol.typeChain[0].data.isInstance) {
225-
const allUnifiedTypes = getAllTypesFromComplexType(symbol.typeChain[0].type);
225+
const allUnifiedTypes = getAllTypesFromCompoundType(symbol.typeChain[0].type);
226226
for (const unifiedType of allUnifiedTypes) {
227227
unnamespacedNameLowers.push(joinTypeChainForKey(symbol.typeChain, unifiedType));
228228
}

src/astUtils/reflection.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ export function isRoStringType(value: any): value is InterfaceType {
340340
return isBuiltInType(value, 'roString');
341341
}
342342
export function isStringTypeLike(value: any): value is StringType | InterfaceType {
343-
return isStringType(value) || isRoStringType(value) || isComplexTypeOf(value, isStringTypeLike);
343+
return isStringType(value) || isRoStringType(value) || isCompoundTypeOf(value, isStringTypeLike);
344344
}
345345

346346
export function isTypedFunctionType(value: any): value is TypedFunctionType {
@@ -354,7 +354,7 @@ export function isRoFunctionType(value: any): value is InterfaceType {
354354
return value?.kind === BscTypeKind.RoFunctionType || isBuiltInType(value, 'roFunction');
355355
}
356356
export function isFunctionTypeLike(value: any): value is FunctionType | InterfaceType {
357-
return isFunctionType(value) || isRoFunctionType(value) || isComplexTypeOf(value, isFunctionTypeLike);
357+
return isFunctionType(value) || isRoFunctionType(value) || isCompoundTypeOf(value, isFunctionTypeLike);
358358
}
359359

360360
export function isBooleanType(value: any): value is BooleanType {
@@ -364,7 +364,7 @@ export function isRoBooleanType(value: any): value is InterfaceType {
364364
return isBuiltInType(value, 'roBoolean');
365365
}
366366
export function isBooleanTypeLike(value: any): value is BooleanType | InterfaceType {
367-
return isBooleanType(value) || isRoBooleanType(value) || isComplexTypeOf(value, isBooleanTypeLike);
367+
return isBooleanType(value) || isRoBooleanType(value) || isCompoundTypeOf(value, isBooleanTypeLike);
368368
}
369369

370370
export function isIntegerType(value: any): value is IntegerType {
@@ -374,7 +374,7 @@ export function isRoIntType(value: any): value is LongIntegerType {
374374
return isBuiltInType(value, 'roInt');
375375
}
376376
export function isIntegerTypeLike(value: any): value is IntegerType | InterfaceType {
377-
return isIntegerType(value) || isRoIntType(value) || isComplexTypeOf(value, isIntegerTypeLike);
377+
return isIntegerType(value) || isRoIntType(value) || isCompoundTypeOf(value, isIntegerTypeLike);
378378
}
379379

380380
export function isLongIntegerType(value: any): value is LongIntegerType {
@@ -384,7 +384,7 @@ export function isRoLongIntegerType(value: any): value is InterfaceType {
384384
return isBuiltInType(value, 'roLongInteger');
385385
}
386386
export function isLongIntegerTypeLike(value: any): value is LongIntegerType | InterfaceType {
387-
return isLongIntegerType(value) || isRoLongIntegerType(value) || isComplexTypeOf(value, isLongIntegerTypeLike);
387+
return isLongIntegerType(value) || isRoLongIntegerType(value) || isCompoundTypeOf(value, isLongIntegerTypeLike);
388388
}
389389

390390
export function isFloatType(value: any): value is FloatType {
@@ -394,7 +394,7 @@ export function isRoFloatType(value: any): value is InterfaceType {
394394
return isBuiltInType(value, 'roFloat');
395395
}
396396
export function isFloatTypeLike(value: any): value is FloatType | InterfaceType {
397-
return isFloatType(value) || isRoFloatType(value) || isComplexTypeOf(value, isFloatTypeLike);
397+
return isFloatType(value) || isRoFloatType(value) || isCompoundTypeOf(value, isFloatTypeLike);
398398
}
399399

400400
export function isDoubleType(value: any): value is DoubleType {
@@ -404,7 +404,7 @@ export function isRoDoubleType(value: any): value is InterfaceType {
404404
return isBuiltInType(value, 'roDouble');
405405
}
406406
export function isDoubleTypeLike(value: any): value is DoubleType | InterfaceType {
407-
return isDoubleType(value) || isRoDoubleType(value) || isComplexTypeOf(value, isDoubleTypeLike);
407+
return isDoubleType(value) || isRoDoubleType(value) || isCompoundTypeOf(value, isDoubleTypeLike);
408408
}
409409

410410
export function isInvalidType(value: any): value is InvalidType {
@@ -414,7 +414,7 @@ export function isRoInvalidType(value: any): value is InterfaceType {
414414
return isBuiltInType(value, 'roInvalid');
415415
}
416416
export function isInvalidTypeLike(value: any): value is InvalidType | InterfaceType {
417-
return isInvalidType(value) || isRoInvalidType(value) || isComplexTypeOf(value, isInvalidTypeLike);
417+
return isInvalidType(value) || isRoInvalidType(value) || isCompoundTypeOf(value, isInvalidTypeLike);
418418
}
419419

420420
export function isVoidType(value: any): value is VoidType {
@@ -486,7 +486,7 @@ export function isInheritableType(target): target is InheritableType {
486486
}
487487

488488
export function isCallFuncableType(target): target is CallFuncableType {
489-
return isInterfaceType(target) || isComponentType(target) || isComplexTypeOf(target, isCallFuncableType);
489+
return isInterfaceType(target) || isComponentType(target) || isCompoundTypeOf(target, isCallFuncableType);
490490
}
491491

492492
export function isCallableType(target): target is BaseFunctionType {
@@ -510,7 +510,7 @@ export function isNumberTypeLike(value: any): value is IntegerType | LongInteger
510510
isLongIntegerTypeLike(value) ||
511511
isFloatTypeLike(value) ||
512512
isDoubleTypeLike(value) ||
513-
isComplexTypeOf(value, isNumberTypeLike);
513+
isCompoundTypeOf(value, isNumberTypeLike);
514514
}
515515

516516
export function isPrimitiveType(value: any = false): value is IntegerType | LongIntegerType | FloatType | DoubleType | StringType | BooleanType | InterfaceType {
@@ -527,7 +527,7 @@ export function isPrimitiveTypeLike(value: any = false): value is IntegerType |
527527
}
528528

529529
export function isAssociativeArrayTypeLike(value: any): value is AssociativeArrayType | InterfaceType {
530-
return value?.kind === BscTypeKind.AssociativeArrayType || isBuiltInType(value, 'roAssociativeArray') || isComplexTypeOf(value, isAssociativeArrayTypeLike);
530+
return value?.kind === BscTypeKind.AssociativeArrayType || isBuiltInType(value, 'roAssociativeArray') || isCompoundTypeOf(value, isAssociativeArrayTypeLike);
531531
}
532532

533533
export function isBuiltInType(value: any, name: string): value is InterfaceType {
@@ -553,14 +553,14 @@ export function isUnionTypeOf(value: any, typeGuard: (val: any) => boolean) {
553553
return isUnionType(value) && value.types.every(typeGuard);
554554
}
555555

556-
export function isComplexTypeOf(value: any, typeGuard: (val: any) => boolean) {
556+
export function isCompoundTypeOf(value: any, typeGuard: (val: any) => boolean) {
557557
// TODO: add more complex type checks as needed, like IntersectionType
558558
return isTypeStatementTypeOf(value, typeGuard) ||
559559
isUnionTypeOf(value, typeGuard);
560560
}
561561

562562

563-
export function isComplexType(value: any): value is UnionType | IntersectionType {
563+
export function isCompoundType(value: any): value is UnionType | IntersectionType {
564564
return isUnionType(value) || isIntersectionType(value);
565565
}
566566

src/types/IntersectionType.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { GetTypeOptions, TypeCompatibilityData } from '../interfaces';
22
import { isDynamicType, isIntersectionType, isObjectType, isTypedFunctionType } from '../astUtils/reflection';
33
import { BscType } from './BscType';
44
import { IntersectionWithDefaultDynamicReferenceType, ReferenceType } from './ReferenceType';
5-
import { addAssociatedTypesTableAsSiblingToMemberTable, getAllTypesFromComplexType, isEnumTypeCompatible, isTypeWithPotentialDefaultDynamicMember, joinTypesString, reduceTypesForIntersectionType } from './helpers';
5+
import { addAssociatedTypesTableAsSiblingToMemberTable, getAllTypesFromCompoundType, isEnumTypeCompatible, isTypeWithPotentialDefaultDynamicMember, joinTypesString, reduceTypesForIntersectionType } from './helpers';
66
import { BscTypeKind } from './BscTypeKind';
77
import type { TypeCacheEntry } from '../SymbolTable';
88
import { SymbolTable } from '../SymbolTable';
@@ -198,7 +198,7 @@ export class IntersectionType extends BscType {
198198
* Used for transpilation
199199
*/
200200
toTypeString(): string {
201-
const uniqueTypeStrings = new Set<string>(getAllTypesFromComplexType(this).map(t => t.toTypeString()));
201+
const uniqueTypeStrings = new Set<string>(getAllTypesFromCompoundType(this).map(t => t.toTypeString()));
202202

203203
if (uniqueTypeStrings.size === 1) {
204204
return uniqueTypeStrings.values().next().value;

src/types/UnionType.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { GetTypeOptions, TypeCompatibilityData } from '../interfaces';
22
import { isDynamicType, isObjectType, isTypedFunctionType, isUnionType } from '../astUtils/reflection';
33
import { BscType } from './BscType';
44
import { ReferenceType } from './ReferenceType';
5-
import { addAssociatedTypesTableAsSiblingToMemberTable, findTypeUnion, findTypeUnionDeepCheck, getAllTypesFromComplexType, getUniqueType, isEnumTypeCompatible, joinTypesString } from './helpers';
5+
import { addAssociatedTypesTableAsSiblingToMemberTable, findTypeUnion, findTypeUnionDeepCheck, getAllTypesFromCompoundType, getUniqueType, isEnumTypeCompatible, joinTypesString } from './helpers';
66
import { BscTypeKind } from './BscTypeKind';
77
import type { TypeCacheEntry } from '../SymbolTable';
88
import { SymbolTable } from '../SymbolTable';
@@ -149,7 +149,7 @@ export class UnionType extends BscType {
149149
* Used for transpilation
150150
*/
151151
toTypeString(): string {
152-
const uniqueTypeStrings = new Set<string>(getAllTypesFromComplexType(this).map(t => t.toTypeString()));
152+
const uniqueTypeStrings = new Set<string>(getAllTypesFromCompoundType(this).map(t => t.toTypeString()));
153153

154154
if (uniqueTypeStrings.size === 1) {
155155
return uniqueTypeStrings.values().next().value;

src/types/helpers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { TypeCompatibilityData } from '../interfaces';
2-
import { isAnyReferenceType, isArrayDefaultTypeReferenceType, isAssociativeArrayTypeLike, isComplexType, isDynamicType, isEnumMemberType, isEnumType, isInheritableType, isInterfaceType, isIntersectionType, isObjectType, isReferenceType, isTypePropertyReferenceType, isUnionType, isUnionTypeOf, isVoidType } from '../astUtils/reflection';
2+
import { isAnyReferenceType, isArrayDefaultTypeReferenceType, isAssociativeArrayTypeLike, isCompoundType, isDynamicType, isEnumMemberType, isEnumType, isInheritableType, isInterfaceType, isIntersectionType, isObjectType, isReferenceType, isTypePropertyReferenceType, isUnionType, isUnionTypeOf, isVoidType } from '../astUtils/reflection';
33
import type { BscType } from './BscType';
44
import type { UnionType } from './UnionType';
55
import type { SymbolTable } from '../SymbolTable';
@@ -287,12 +287,12 @@ export function isNativeInterfaceCompatibleNumber(thisType: BscType, otherType:
287287
return false;
288288
}
289289

290-
export function getAllTypesFromComplexType(complex: UnionType | IntersectionType): BscType[] {
290+
export function getAllTypesFromCompoundType(complex: UnionType | IntersectionType): BscType[] {
291291
const results = [];
292292

293293
for (const type of complex.types) {
294-
if (isComplexType(type)) {
295-
results.push(...getAllTypesFromComplexType(type));
294+
if (isCompoundType(type)) {
295+
results.push(...getAllTypesFromCompoundType(type));
296296
} else {
297297
results.push(type);
298298
}

src/util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type { CallExpression, CallfuncExpression, DottedGetExpression, FunctionP
2525
import { LogLevel, createLogger } from './logging';
2626
import { isToken, type Identifier, type Token } from './lexer/Token';
2727
import { TokenKind } from './lexer/TokenKind';
28-
import { isAnyReferenceType, isBinaryExpression, isBooleanTypeLike, isBrsFile, isCallExpression, isCallableType, isCallfuncExpression, isClassType, isComplexType, isComponentType, isDottedGetExpression, isDoubleTypeLike, isDynamicType, isEnumMemberType, isExpression, isFloatTypeLike, isIndexedGetExpression, isIntegerTypeLike, isIntersectionType, isInvalidTypeLike, isLiteralString, isLongIntegerTypeLike, isNamespaceStatement, isNamespaceType, isNewExpression, isNumberTypeLike, isObjectType, isPrimitiveType, isReferenceType, isStatement, isStringTypeLike, isTypeExpression, isTypedArrayExpression, isTypedFunctionType, isUninitializedType, isUnionType, isVariableExpression, isVoidType, isXmlAttributeGetExpression, isXmlFile } from './astUtils/reflection';
28+
import { isAnyReferenceType, isBinaryExpression, isBooleanTypeLike, isBrsFile, isCallExpression, isCallableType, isCallfuncExpression, isClassType, isCompoundType, isComponentType, isDottedGetExpression, isDoubleTypeLike, isDynamicType, isEnumMemberType, isExpression, isFloatTypeLike, isIndexedGetExpression, isIntegerTypeLike, isIntersectionType, isInvalidTypeLike, isLiteralString, isLongIntegerTypeLike, isNamespaceStatement, isNamespaceType, isNewExpression, isNumberTypeLike, isObjectType, isPrimitiveType, isReferenceType, isStatement, isStringTypeLike, isTypeExpression, isTypedArrayExpression, isTypedFunctionType, isUninitializedType, isUnionType, isVariableExpression, isVoidType, isXmlAttributeGetExpression, isXmlFile } from './astUtils/reflection';
2929
import { WalkMode } from './astUtils/visitors';
3030
import { SourceNode } from 'source-map';
3131
import * as requireRelative from 'require-relative';
@@ -2203,7 +2203,7 @@ export class Util {
22032203
let typeString = chainItem.type?.toString();
22042204
let typeToFindStringFor = chainItem.type;
22052205
while (typeToFindStringFor) {
2206-
if (isComplexType(chainItem.type)) {
2206+
if (isCompoundType(chainItem.type)) {
22072207
typeString = `(${typeToFindStringFor.toString()})`;
22082208
break;
22092209
} else if (isCallableType(typeToFindStringFor)) {
@@ -2328,7 +2328,7 @@ export class Util {
23282328
}
23292329

23302330
public getCustomTypesInSymbolTree(setToFill: Set<BscType>, type: BscType, filter?: (t: BscType) => boolean) {
2331-
const subSymbolTypes = isComplexType(type)
2331+
const subSymbolTypes = isCompoundType(type)
23322332
? type.types
23332333
: type.getMemberTable()?.getAllSymbols(SymbolTypeFlag.runtime).map(sym => sym.type) ?? [];
23342334
for (const subSymbolType of subSymbolTypes) {

0 commit comments

Comments
 (0)