mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 23:09:18 +02:00
pastojs: typecast string(apointer), pointer(astring)
git-svn-id: trunk@39975 -
This commit is contained in:
parent
74a0ce450e
commit
481a8bee0c
@ -8764,6 +8764,12 @@ begin
|
||||
Result:=ConvertElement(Param,AContext);
|
||||
exit;
|
||||
end
|
||||
else if ParamResolved.BaseType=btPointer then
|
||||
begin
|
||||
// string(aPointer) -> value
|
||||
Result:=ConvertElement(Param,AContext);
|
||||
exit;
|
||||
end
|
||||
else if IsParamPas2JSBaseType then
|
||||
begin
|
||||
if JSBaseType=pbtJSValue then
|
||||
@ -8843,14 +8849,20 @@ begin
|
||||
begin
|
||||
if JSBaseType=pbtJSValue then
|
||||
begin
|
||||
// convert jsvalue to pointer -> pass through
|
||||
// convert jsvalue to pointer -> value
|
||||
Result:=ConvertElement(Param,AContext);
|
||||
exit;
|
||||
end;
|
||||
end
|
||||
else if ParamResolved.BaseType in btAllJSStrings then
|
||||
begin
|
||||
// pointer(aString) -> value
|
||||
Result:=ConvertElement(Param,AContext);
|
||||
exit;
|
||||
end
|
||||
else if ParamResolved.BaseType=btContext then
|
||||
begin
|
||||
// convert user type/value to pointer -> pass through
|
||||
// convert user type/value to pointer -> value
|
||||
Result:=ConvertElement(Param,AContext);
|
||||
exit;
|
||||
end;
|
||||
|
@ -17938,6 +17938,7 @@ begin
|
||||
' C: tclass;',
|
||||
' a: tarrint;',
|
||||
' p: Pointer = nil;',
|
||||
' s: string;',
|
||||
'begin',
|
||||
' p:=p;',
|
||||
' p:=nil;',
|
||||
@ -17954,6 +17955,8 @@ begin
|
||||
' a:=TArrInt(p);',
|
||||
' p:=n;',
|
||||
' p:=Pointer(a);',
|
||||
' p:=pointer(s);',
|
||||
' s:=string(p);',
|
||||
'']);
|
||||
ConvertProgram;
|
||||
CheckSource('TestPointer',
|
||||
@ -17970,6 +17973,7 @@ begin
|
||||
'this.C = null;',
|
||||
'this.a = [];',
|
||||
'this.p = null;',
|
||||
'this.s = "";',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
'$mod.p = $mod.p;',
|
||||
@ -17987,6 +17991,8 @@ begin
|
||||
'$mod.a = $mod.p;',
|
||||
'$mod.p = null;',
|
||||
'$mod.p = $mod.a;',
|
||||
'$mod.p = $mod.s;',
|
||||
'$mod.s = $mod.p;',
|
||||
'']));
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user