Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/src/compiler_analyzer/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ function analyzeExprPostOp1(scope: SymbolScope, exprPostOp: NodeExprPostOp1, exp

// ('[' [IDENTIFIER ':'] ASSIGN {',' [IDENTIFIER ':' ASSIGN} ']')
function analyzeExprPostOp2(scope: SymbolScope, exprPostOp: NodeExprPostOp2, exprValue: ResolvedType, exprRange: TokenRange) {
const args = exprPostOp.indexerList.map(indexer => analyzeAssign(scope, indexer.assign));
const args = exprPostOp.indexingList.map(indexer => analyzeAssign(scope, indexer.assign));
return analyzeOperatorAlias(
scope,
exprPostOp.nodeRange.end,
Expand Down
13 changes: 6 additions & 7 deletions server/src/compiler_analyzer/hoist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import {
AccessModifier,
funcHeadDestructor,
isFunctionHeadReturnValue,
isFuncHeadReturnValue,
NodeClass,
NodeEnum,
NodeFunc,
Expand All @@ -33,9 +33,8 @@ import {findSymbolWithParent, insertSymbolObject, tryInsertSymbolObject} from ".
import {ResolvedType} from "./resolvedType";
import {getGlobalSettings} from "../code/settings";
import {builtinSetterValueToken, builtinThisToken, tryGetBuiltInType} from "./symbolBuiltin";
import {Mutable} from "../utils/utilities";
import {TokenIdentifier, TokenKind, TokenObject} from "../compiler_tokenizer/tokenObject";
import {getIdentifierInType} from "../compiler_parser/nodesUtils";
import {TokenIdentifier, TokenObject} from "../compiler_tokenizer/tokenObject";
import {getIdentifierInNodeType} from "../compiler_parser/nodesUtils";
import {
analyzeFunc,
AnalyzeQueue,
Expand Down Expand Up @@ -183,14 +182,14 @@ function hoistClassTemplateTypes(scope: SymbolScope, types: NodeType[] | undefin
const templateTypes: TokenObject[] = [];
for (const type of types ?? []) {
insertSymbolObject(scope.symbolMap, SymbolType.create({
declaredPlace: getIdentifierInType(type),
declaredPlace: getIdentifierInNodeType(type),
declaredScope: scope,
sourceNode: undefined,
membersScope: undefined,
isTypeParameter: true,
}));

templateTypes.push(getIdentifierInType(type));
templateTypes.push(getIdentifierInNodeType(type));
}
return templateTypes;
}
Expand Down Expand Up @@ -274,7 +273,7 @@ function hoistFunc(
) {
if (nodeFunc.head === funcHeadDestructor) return;

const returnType = isFunctionHeadReturnValue(nodeFunc.head) ? analyzeType(
const returnType = isFuncHeadReturnValue(nodeFunc.head) ? analyzeType(
parentScope,
nodeFunc.head.returnType) : undefined;
const symbol: SymbolFunction = SymbolFunction.create({
Expand Down
10 changes: 5 additions & 5 deletions server/src/compiler_parser/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export interface NodeFunc extends NodesBase {
readonly nodeName: NodeName.Func;
readonly entity: EntityAttribute | undefined;
readonly accessor: AccessModifier | undefined;
readonly head: FuncHeads;
readonly head: FuncHead;
readonly identifier: TokenObject;
readonly paramList: NodeParamList;
readonly isConst: boolean;
Expand All @@ -179,9 +179,9 @@ export type FuncHeadDestructor = typeof funcHeadDestructor;
export const funcHeadConstructor = Symbol();
export type FuncHeadConstructor = typeof funcHeadConstructor;

export type FuncHeads = FuncHeadReturnValue | FuncHeadDestructor | FuncHeadConstructor;
export type FuncHead = FuncHeadReturnValue | FuncHeadDestructor | FuncHeadConstructor;

export function isFunctionHeadReturnValue(head: FuncHeads): head is FuncHeadReturnValue {
export function isFuncHeadReturnValue(head: FuncHead): head is FuncHeadReturnValue {
return head !== funcHeadDestructor && head !== funcHeadConstructor;
}

Expand Down Expand Up @@ -471,10 +471,10 @@ export function isMemberMethodInPostOp(member: NodeFuncCall | TokenObject | unde
export interface NodeExprPostOp2 extends NodesBase {
readonly nodeName: NodeName.ExprPostOp;
readonly postOp: 2;
readonly indexerList: ParsedPostIndexer[];
readonly indexingList: ParsedPostIndexing[];
}

export interface ParsedPostIndexer {
export interface ParsedPostIndexing {
readonly identifier: TokenObject | undefined,
readonly assign: NodeAssign
}
Expand Down
22 changes: 5 additions & 17 deletions server/src/compiler_parser/nodesUtils.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
import {TokenObject} from "../compiler_tokenizer/tokenObject";
import {EntityAttribute, FunctionAttribute, NodeType, ReferenceModifier} from "./nodes";
import {Mutable} from "../utils/utilities";

export function setEntityAttribute(attribute: Mutable<EntityAttribute>, token: 'shared' | 'external' | 'abstract' | 'final') {
if (token === 'shared') attribute.isShared = true;
else if (token === 'external') attribute.isExternal = true;
else if (token === 'abstract') attribute.isAbstract = true;
else if (token === 'final') attribute.isFinal = true;
}
import {EntityAttribute, NodeType, ReferenceModifier} from "./nodes";

export function isEntityModifierForClass(modifier: EntityAttribute) {
return modifier.isAbstract || modifier.isFinal;
}

export function setFunctionAttribute(attribute: Mutable<FunctionAttribute>, token: 'override' | 'final' | 'explicit' | 'property') {
if (token === 'override') attribute.isOverride = true;
else if (token === 'final') attribute.isFinal = true;
else if (token === 'explicit') attribute.isExplicit = true;
else if (token === 'property') attribute.isProperty = true;
}

export function stringifyNodeType(type: NodeType): string {
let str = type.isConst ? 'const ' : '';
str += type.dataType.identifier.text;
if (type.typeTemplates.length > 0) {
str += '<' + type.typeTemplates.map(stringifyNodeType).join(', ') + '>';
}

if (type.isArray) {
str += '[]';
}

if (type.refModifier !== undefined) {
str += (type.refModifier === ReferenceModifier.AtConst ? '@const' : '@');
}

return str;
}

export function getIdentifierInType(type: NodeType): TokenObject {
export function getIdentifierInNodeType(type: NodeType): TokenObject {
return type.dataType.identifier;
}
29 changes: 0 additions & 29 deletions server/src/compiler_parser/parsedCache.ts

This file was deleted.

Loading