Small refactorings

This commit is contained in:
Michael Schimmel
2026-01-13 23:51:41 +01:00
parent 2cc5e53394
commit b3ca67428d
3 changed files with 14 additions and 26 deletions
+14 -23
View File
@@ -44,9 +44,6 @@ type
private
FCurrentContext: TTypeContext;
FLog: ICompilerLog;
FRootScope: IExecutionScope;
function CreateContextChain(L: IScopeLayout): TTypeContext;
// Helpers for Null Propagation
function PrepareBaseType(const BaseNode: IAstNode; out IsOptional: Boolean): IStaticType;
@@ -174,34 +171,28 @@ begin
FSlotTypes[SlotIndex] := AType;
end;
{ TTypeChecker }
constructor TTypeChecker.Create(const RootLayout: IScopeLayout; const RootScope: IExecutionScope; const ALog: ICompilerLog);
function TTypeChecker.CreateContextChain(L: IScopeLayout): TTypeContext;
var
p: TTypeContext;
desc: IScopeDescriptor;
begin
if L = nil then
exit(nil);
p := CreateContextChain(L.Parent);
desc := nil;
if (L.Parent = nil) and Assigned(FRootScope) then
function CreateChain(L: IScopeLayout): TTypeContext;
begin
desc := FRootScope.Descriptor;
if L = nil then
exit(nil);
Result :=
TTypeContext.Create(
CreateChain(L.Parent),
L,
[],
if (L.Parent = nil) and Assigned(RootScope) then RootScope.Descriptor
else nil
);
end;
Result := TTypeContext.Create(p, L, [], desc);
end;
constructor TTypeChecker.Create(const RootLayout: IScopeLayout; const RootScope: IExecutionScope; const ALog: ICompilerLog);
begin
inherited Create;
FLog := ALog;
FRootScope := RootScope;
FCurrentContext := CreateContextChain(RootLayout);
FCurrentContext := CreateChain(RootLayout);
if FCurrentContext = nil then
FCurrentContext := TTypeContext.Create(nil, nil, [], nil);
end;
-2
View File
@@ -151,8 +151,6 @@ begin
akLambdaExpression: Result := 'FN';
akRecordLiteral: Result := 'RECORD';
akPipe: Result := 'PIPE';
// NEW:
akIndexer: Result := 'INDEXER';
akMemberAccess: Result := 'MEMBER';
akTuple: Result := 'TUPLE';
-1
View File
@@ -488,7 +488,6 @@ end;
function TAstDumper.VisitCreateSeries(const Node: IAstNode): TVoid;
begin
// REFACTORED: Log the structure of the definition
Log('CreateSeries', Node);
Indent;
Log('Definition:');