mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 16:09:25 +02:00
pastojs: filer: restore global shortref names
git-svn-id: trunk@49053 -
This commit is contained in:
parent
50cb5707ef
commit
e89e010155
@ -7576,8 +7576,11 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
for i:=0 to length(PrecompiledVars)-1 do
|
for i:=0 to length(PrecompiledVars)-1 do
|
||||||
if PrecompiledVars[i].Name=aName then
|
begin
|
||||||
exit(PrecompiledVars[i]);
|
Result:=PrecompiledVars[i];
|
||||||
|
if Result.Name=aName then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
if not WithParents then
|
if not WithParents then
|
||||||
exit(nil);
|
exit(nil);
|
||||||
Result:=inherited FindPrecompiledVar(aName,WithParents);
|
Result:=inherited FindPrecompiledVar(aName,WithParents);
|
||||||
@ -7589,8 +7592,11 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
for i:=0 to length(PrecompiledVars)-1 do
|
for i:=0 to length(PrecompiledVars)-1 do
|
||||||
if PrecompiledVars[i].Element=El then
|
begin
|
||||||
exit(PrecompiledVars[i]);
|
Result:=PrecompiledVars[i];
|
||||||
|
if Result.Element=El then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
if not WithParents then
|
if not WithParents then
|
||||||
exit(nil);
|
exit(nil);
|
||||||
Result:=inherited FindPrecompiledVar(El, WithParents);
|
Result:=inherited FindPrecompiledVar(El, WithParents);
|
||||||
@ -7623,6 +7629,7 @@ function TFunctionContext.AddLocalVar(aName: string; El: TPasElement;
|
|||||||
var
|
var
|
||||||
l: Integer;
|
l: Integer;
|
||||||
Ident, V: TFCLocalIdentifier;
|
Ident, V: TFCLocalIdentifier;
|
||||||
|
PV: TPas2JSStoredLocalVar;
|
||||||
begin
|
begin
|
||||||
Ident:=FindLocalVar(aName,true);
|
Ident:=FindLocalVar(aName,true);
|
||||||
if Ident<>nil then
|
if Ident<>nil then
|
||||||
@ -7644,7 +7651,15 @@ begin
|
|||||||
raise EPas2JS.Create('[20200608131330] "'+aName+'" El='+GetObjPath(El));
|
raise EPas2JS.Create('[20200608131330] "'+aName+'" El='+GetObjPath(El));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end
|
||||||
|
else if aKind=cvkGlobal then
|
||||||
|
begin
|
||||||
|
// check precompiled names
|
||||||
|
PV:=FindPrecompiledVar(El,true);
|
||||||
|
if PV<>nil then
|
||||||
|
aName:=PV.Name;
|
||||||
end;
|
end;
|
||||||
|
// add
|
||||||
l:=length(LocalVars);
|
l:=length(LocalVars);
|
||||||
SetLength(LocalVars,l+1);
|
SetLength(LocalVars,l+1);
|
||||||
Result:=TFCLocalIdentifier.Create(aName,El,aKind);
|
Result:=TFCLocalIdentifier.Create(aName,El,aKind);
|
||||||
@ -17016,6 +17031,7 @@ begin
|
|||||||
AddToSourceElements(ConstSrcElems,Lit);
|
AddToSourceElements(ConstSrcElems,Lit);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if coShortRefGlobals in Options then
|
if coShortRefGlobals in Options then
|
||||||
CreateGlobalAlias_List(ImplJS.ShortRefs,AContext);
|
CreateGlobalAlias_List(ImplJS.ShortRefs,AContext);
|
||||||
// precompiled body
|
// precompiled body
|
||||||
|
Loading…
Reference in New Issue
Block a user