Skip to content

Commit

Permalink
Update lape
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Aug 4, 2023
1 parent 4ee9b5d commit a080c08
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
10 changes: 8 additions & 2 deletions Source/codetools/msimplepaspar.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3551,8 +3551,9 @@ procedure TmwSimplePasPar.TypeDeclaration;
end else
NextToken();

if (Lexer.TokenID = tokType) then
if (Lexer.TokenID in [tokType, tokStrict]) then
begin
NextToken();
ExplicitType;
Exit;
end;
Expand Down Expand Up @@ -3627,7 +3628,7 @@ procedure TmwSimplePasPar.TypeName;

procedure TmwSimplePasPar.ExplicitType;
begin
Expected(tokType);
//Expected(tokType);
TypeIdentifer;
end;

Expand Down Expand Up @@ -3670,6 +3671,11 @@ procedure TmwSimplePasPar.TypeKind;
end else
PointerType;
end;
tokStrict:
begin
NextToken;
TypeKind;
end;
end;
end;

Expand Down
26 changes: 22 additions & 4 deletions Source/codetools/simba.ide_codetools_insight.pas
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,36 @@ function TCodeinsight.GetMethodsOfType(Typ: String): TDeclarationArray;

function TCodeinsight.GetMembersOfType(Decl: TDeclaration): TDeclarationArray;

function FilterStaticMethods(const Arr: TDeclarationArray; NeedFilter: Boolean): TDeclarationArray;
var
I, C: Integer;
begin
if (Length(Arr) = 0) or (not NeedFilter) then
Exit(Arr);

C := 0;
SetLength(Result, Length(Arr));
for I := 0 to High(Arr) do
if not Arr[I].isStaticMethod then
begin
Result[C] := Arr[I];
Inc(C);
end;
SetLength(Result, C);
end;

procedure CheckRecord(Decl: TDeclaration);
begin
Result := Result + Decl.Items.GetByClass(TDeclaration_Var);
end;

procedure CheckMethods(Decl: TDeclaration);
procedure CheckMethods(Decl: TDeclaration; RemoveStatic: Boolean);
var
Include: TCodeParser;
begin
for Include in GetIncludes() do
Result := Result + Include.TypeMethods.Get(Decl.Name);
Result := Result + FScriptParser.TypeMethods.Get(Decl.Name);
Result := Result + FilterStaticMethods(Include.TypeMethods.Get(Decl.Name), RemoveStatic);
Result := Result + FilterStaticMethods(FScriptParser.TypeMethods.Get(Decl.Name), RemoveStatic);

Include := GetArrayHelpers(Decl);
if (Include <> nil) then
Expand Down Expand Up @@ -365,7 +383,7 @@ function TCodeinsight.GetMembersOfType(Decl: TDeclaration): TDeclarationArray;
begin
if (Decl is TDeclaration_TypeRecord) then
CheckRecord(Decl);
CheckMethods(Decl);
CheckMethods(Decl, Depth>0);

ParentDecl := GetParent(Decl);
if (ParentDecl <> Decl) then
Expand Down
2 changes: 1 addition & 1 deletion Source/script/simba.script_compiler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function TSimbaScript_Compiler.addClassConstructor(Obj, Params: lpString; Func:

procedure TSimbaScript_Compiler.addClass(Name: lpString; Parent: lpString);
begin
addGlobalType(Format('type %s', [Parent]), Name);
addGlobalType(Format('strict %s', [Parent]), Name);
end;

procedure TSimbaScript_Compiler.addClassVar(Obj, Item, Typ: lpString; ARead: Pointer; AWrite: Pointer; Arr: Boolean; ArrType: lpString);
Expand Down

0 comments on commit a080c08

Please sign in to comment.