Browse Source

pastojs: typeinfo(classofvar)

git-svn-id: trunk@35864 -
Mattias Gaertner 8 years ago
parent
commit
db6e47a22c
2 changed files with 8 additions and 3 deletions
  1. 6 1
      packages/pastojs/src/fppas2js.pp
  2. 2 2
      packages/pastojs/tests/tcmodules.pas

+ 6 - 1
packages/pastojs/src/fppas2js.pp

@@ -2493,7 +2493,12 @@ begin
     else if C=TPasClassType then
       TIName:=Pas2JSBuiltInNames[pbitnTIClass]
     else if C=TPasClassOfType then
-      TIName:=Pas2JSBuiltInNames[pbitnTIClassRef]
+      begin
+      if rrfReadable in ParamResolved.Flags then
+        TIName:=Pas2JSBuiltInNames[pbitnTIClass]
+      else
+        TIName:=Pas2JSBuiltInNames[pbitnTIClassRef];
+      end
     else if C=TPasArrayType then
       begin
       if length(TPasArrayType(TypeEl).Ranges)>0 then

+ 2 - 2
packages/pastojs/tests/tcmodules.pas

@@ -12526,7 +12526,7 @@ begin
   Add('  tirecord:=typeinfo(trec);');
   Add('  ticlass:=typeinfo(obj);');
   Add('  ticlass:=typeinfo(tobject);');
-  Add('  ticlassref:=typeinfo(aclass);');
+  Add('  ticlass:=typeinfo(aclass);');
   Add('  ticlassref:=typeinfo(tclass);');
   ConvertProgram;
   CheckSource('TestRTTI_TypeInfo_ExtTypeInfoClasses3',
@@ -12556,7 +12556,7 @@ begin
     '$mod.tiRecord = $mod.$rtti["TRec"];',
     '$mod.tiClass = $mod.Obj.$rtti;',
     '$mod.tiClass = $mod.$rtti["TObject"];',
-    '$mod.tiClassRef = $mod.aClass.$rtti;',
+    '$mod.tiClass = $mod.aClass.$rtti;',
     '$mod.tiClassRef = $mod.$rtti["TClass"];',
     '']));
 end;