|
@@ -423,7 +423,6 @@ type
|
|
Function ParseRecordDecl(Parent: TPasElement; Const NamePos: TPasSourcePos; Const TypeName : string; const Packmode : TPackMode = pmNone) : TPasRecordType;
|
|
Function ParseRecordDecl(Parent: TPasElement; Const NamePos: TPasSourcePos; Const TypeName : string; const Packmode : TPackMode = pmNone) : TPasRecordType;
|
|
function ParseEnumType(Parent: TPasElement; Const NamePos: TPasSourcePos; const TypeName: String): TPasEnumType;
|
|
function ParseEnumType(Parent: TPasElement; Const NamePos: TPasSourcePos; const TypeName: String): TPasEnumType;
|
|
function ParseSetType(Parent: TPasElement; Const NamePos: TPasSourcePos; const TypeName: String; AIsPacked : Boolean = False): TPasSetType;
|
|
function ParseSetType(Parent: TPasElement; Const NamePos: TPasSourcePos; const TypeName: String; AIsPacked : Boolean = False): TPasSetType;
|
|
- function ParseSpecializeType(Parent: TPasElement; Const TypeName: String): TPasSpecializeType;
|
|
|
|
Function ParseClassDecl(Parent: TPasElement; Const NamePos: TPasSourcePos; Const AClassName: String; AObjKind: TPasObjKind; PackMode : TPackMode= pmNone): TPasType;
|
|
Function ParseClassDecl(Parent: TPasElement; Const NamePos: TPasSourcePos; Const AClassName: String; AObjKind: TPasObjKind; PackMode : TPackMode= pmNone): TPasType;
|
|
Function ParseProperty(Parent : TPasElement; Const AName : String; AVisibility : TPasMemberVisibility; IsClassField: boolean) : TPasProperty;
|
|
Function ParseProperty(Parent : TPasElement; Const AName : String; AVisibility : TPasMemberVisibility; IsClassField: boolean) : TPasProperty;
|
|
function ParseRangeType(AParent: TPasElement; Const NamePos: TPasSourcePos; Const TypeName: String; Full: Boolean = True): TPasRangeType;
|
|
function ParseRangeType(AParent: TPasElement; Const NamePos: TPasSourcePos; Const TypeName: String; Full: Boolean = True): TPasRangeType;
|
|
@@ -1589,8 +1588,9 @@ begin
|
|
end;
|
|
end;
|
|
Ref:=ResolveTypeReference(Name,ST);
|
|
Ref:=ResolveTypeReference(Name,ST);
|
|
ST.DestType:=Ref;
|
|
ST.DestType:=Ref;
|
|
|
|
+ Ref:=nil;
|
|
ReadSpecializeArguments(ST);
|
|
ReadSpecializeArguments(ST);
|
|
- if TypeName<>'' then
|
|
|
|
|
|
+ if TypeName='' then
|
|
Engine.FinishScope(stTypeDef,ST);
|
|
Engine.FinishScope(stTypeDef,ST);
|
|
Result:=ST;
|
|
Result:=ST;
|
|
finally
|
|
finally
|
|
@@ -1611,8 +1611,10 @@ begin
|
|
begin
|
|
begin
|
|
Result := TPasAliasType(CreateElement(TPasAliasType, TypeName, Parent, NamePos));
|
|
Result := TPasAliasType(CreateElement(TPasAliasType, TypeName, Parent, NamePos));
|
|
TPasAliasType(Result).DestType:=Ref;
|
|
TPasAliasType(Result).DestType:=Ref;
|
|
|
|
+ Ref:=nil;
|
|
TPasAliasType(Result).Expr:=Expr;
|
|
TPasAliasType(Result).Expr:=Expr;
|
|
Expr.Parent:=Result;
|
|
Expr.Parent:=Result;
|
|
|
|
+ Expr:=nil;
|
|
if TypeName<>'' then
|
|
if TypeName<>'' then
|
|
begin
|
|
begin
|
|
ok:=false;
|
|
ok:=false;
|
|
@@ -1665,12 +1667,13 @@ function TPasParser.ParseTypeReference(Parent: TPasElement; NeedExpr: boolean;
|
|
// c) TPasType, Expr<>nil
|
|
// c) TPasType, Expr<>nil
|
|
var
|
|
var
|
|
Name: String;
|
|
Name: String;
|
|
- IsSpecialize: Boolean;
|
|
|
|
|
|
+ IsSpecialize, ok: Boolean;
|
|
ST: TPasSpecializeType;
|
|
ST: TPasSpecializeType;
|
|
begin
|
|
begin
|
|
Result:=nil;
|
|
Result:=nil;
|
|
Expr:=nil;
|
|
Expr:=nil;
|
|
ST:=nil;
|
|
ST:=nil;
|
|
|
|
+ ok:=false;
|
|
try
|
|
try
|
|
if CurToken=tkspecialize then
|
|
if CurToken=tkspecialize then
|
|
begin
|
|
begin
|
|
@@ -1695,9 +1698,9 @@ begin
|
|
Expr:=nil;
|
|
Expr:=nil;
|
|
// read nested specialize arguments
|
|
// read nested specialize arguments
|
|
ReadSpecializeArguments(ST);
|
|
ReadSpecializeArguments(ST);
|
|
|
|
+ NextToken;
|
|
Result:=ST;
|
|
Result:=ST;
|
|
ST:=nil;
|
|
ST:=nil;
|
|
- NextToken;
|
|
|
|
end
|
|
end
|
|
else if IsSpecialize then
|
|
else if IsSpecialize then
|
|
CheckToken(tkLessThan)
|
|
CheckToken(tkLessThan)
|
|
@@ -1707,8 +1710,10 @@ begin
|
|
if not NeedExpr then
|
|
if not NeedExpr then
|
|
ReleaseAndNil(TPasElement(Expr){$IFDEF CheckPasTreeRefCount},'CreateElement'{$ENDIF});
|
|
ReleaseAndNil(TPasElement(Expr){$IFDEF CheckPasTreeRefCount},'CreateElement'{$ENDIF});
|
|
end;
|
|
end;
|
|
|
|
+ ok:=true;
|
|
finally
|
|
finally
|
|
- if ST<>nil then St.Release{$IFDEF CheckPasTreeRefCount}('CreateElement'){$ENDIF};
|
|
|
|
|
|
+ if ST<>nil then ST.Release{$IFDEF CheckPasTreeRefCount}('CreateElement'){$ENDIF};
|
|
|
|
+ if (not ok) and (Result<>nil) then Result.Release{$IFDEF CheckPasTreeRefCount}('CreateElement'){$ENDIF};
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1825,7 +1830,10 @@ begin
|
|
tkInterface:
|
|
tkInterface:
|
|
Result := ParseClassDecl(Parent, NamePos, TypeName, okInterface,PM);
|
|
Result := ParseClassDecl(Parent, NamePos, TypeName, okInterface,PM);
|
|
tkSpecialize:
|
|
tkSpecialize:
|
|
- Result:=ParseSpecializeType(Parent,TypeName);
|
|
|
|
|
|
+ begin
|
|
|
|
+ NextToken;
|
|
|
|
+ Result:=ParseSimpleType(Parent,CurSourcePos,TypeName);
|
|
|
|
+ end;
|
|
tkClass:
|
|
tkClass:
|
|
begin
|
|
begin
|
|
isHelper:=false;
|
|
isHelper:=false;
|
|
@@ -4227,24 +4235,6 @@ begin
|
|
until (CurToken=tkSemicolon);
|
|
until (CurToken=tkSemicolon);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TPasParser.ParseSpecializeType(Parent: TPasElement;
|
|
|
|
- const TypeName: String): TPasSpecializeType;
|
|
|
|
-
|
|
|
|
-var
|
|
|
|
- ok: Boolean;
|
|
|
|
-begin
|
|
|
|
- NextToken;
|
|
|
|
- Result:=ParseSimpleType(Parent,CurSourcePos,TypeName) as TPasSpecializeType;
|
|
|
|
- ok:=false;
|
|
|
|
- try
|
|
|
|
- Engine.FinishScope(stTypeDef,Result);
|
|
|
|
- ok:=true;
|
|
|
|
- finally
|
|
|
|
- if not ok then
|
|
|
|
- Result.Release{$IFDEF CheckPasTreeRefCount}('CreateElement'){$ENDIF};
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
function TPasParser.ParseProcedureType(Parent: TPasElement;
|
|
function TPasParser.ParseProcedureType(Parent: TPasElement;
|
|
const NamePos: TPasSourcePos; const TypeName: String; const PT: TProcType
|
|
const NamePos: TPasSourcePos; const TypeName: String; const PT: TProcType
|
|
): TPasProcedureType;
|
|
): TPasProcedureType;
|