Browse Source

fcl-passrc: added pekSpecialize for consistency with the other expression

git-svn-id: trunk@38275 -
Mattias Gaertner 7 years ago
parent
commit
6ffa463b43
2 changed files with 7 additions and 4 deletions
  1. 3 2
      packages/fcl-passrc/src/pastree.pp
  2. 4 2
      packages/fcl-passrc/src/pparser.pp

+ 3 - 2
packages/fcl-passrc/src/pastree.pp

@@ -167,7 +167,7 @@ type
 
   TPasExprKind = (pekIdent, pekNumber, pekString, pekSet, pekNil, pekBoolConst,
      pekRange, pekUnary, pekBinary, pekFuncParams, pekArrayParams, pekListOfExp,
-     pekInherited, pekSelf);
+     pekInherited, pekSelf, pekSpecialize);
 
   TExprOpCode = (eopNone,
                  eopAdd,eopSubtract,eopMultiply,eopDivide, eopDiv,eopMod, eopPower,// arithmetic
@@ -1487,7 +1487,8 @@ const
       'ArrayParams',
       'ListOfExp',
       'Inherited',
-      'Self');
+      'Self',
+      'Specialize');
 
   OpcodeStrings : Array[TExprOpCode] of string = (
         '','+','-','*','/','div','mod','**',

+ 4 - 2
packages/fcl-passrc/src/pparser.pp

@@ -758,7 +758,7 @@ procedure TPasTreeContainer.FinishScope(ScopeType: TPasScopeType;
   El: TPasElement);
 begin
   if ScopeType=stModule then ; // avoid compiler warning
-  if Assigned(El) then 
+  if Assigned(El) and (CurrentParser<>nil) then
     El.SourceEndLinenumber := CurrentParser.CurSourcePos.Row;
 end;
 
@@ -1280,7 +1280,7 @@ begin
       end
     else
       UngetToken;
-    Result.DestType:=TPasStringType(CreateElement(TPasStringType,'string',Parent));
+    Result.DestType:=TPasStringType(CreateElement(TPasStringType,'string',Result));
     TPasStringType(Result.DestType).LengthExpr:=LengthAsText;
     ok:=true;
   finally
@@ -1390,6 +1390,7 @@ begin
           Result := TPasAliasType(CreateElement(TPasAliasType, TypeName, Parent, NamePos));
           TPasAliasType(Result).DestType:=Ref;
           TPasAliasType(Result).Expr:=Expr;
+          Expr.Parent:=Result;
           if TypeName<>'' then
             Engine.FinishScope(stTypeDef,Result);
           end
@@ -2193,6 +2194,7 @@ begin
           begin
           // an inline specialization (e.g. A<B,C>)
           ISE:=TInlineSpecializeExpr(CreateElement(TInlineSpecializeExpr,'',AParent,SrcPos));
+          ISE.Kind:=pekSpecialize;
           ST:=TPasSpecializeType(CreateElement(TPasSpecializeType,'',ISE,SrcPos));
           ISE.DestType:=ST;
           ReadSpecializeArguments(ST);