mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 20:34:01 +02:00
codetools: anonymous functions in pas2js
git-svn-id: trunk@59832 -
This commit is contained in:
parent
7a3b00d295
commit
07ff5d447e
@ -251,6 +251,7 @@ type
|
||||
function ReadClosure(ExceptionOnError, CreateNodes: boolean): boolean;
|
||||
function WordIsPropertyEnd: boolean;
|
||||
function AllowAttributes: boolean; inline;
|
||||
function AllowClosures: boolean; inline;
|
||||
public
|
||||
CurSection: TCodeTreeNodeDesc;
|
||||
|
||||
@ -1045,8 +1046,7 @@ begin
|
||||
SaveRaiseEndOfSourceExpected(20170421195401);
|
||||
end else if UpAtomIs('WITH') then
|
||||
ReadWithStatement(true,true)
|
||||
else if (UpAtomIs('PROCEDURE') or UpAtomIs('FUNCTION'))
|
||||
and (cmsClosures in Scanner.CompilerModeSwitches) then
|
||||
else if (UpAtomIs('PROCEDURE') or UpAtomIs('FUNCTION')) and AllowClosures then
|
||||
ReadClosure(true,true);
|
||||
until false;
|
||||
except
|
||||
@ -2994,7 +2994,7 @@ begin
|
||||
and (TryType=ttExcept) then begin
|
||||
ReadOnStatement(true,CreateNodes);
|
||||
end else if (UpAtomIs('PROCEDURE') or UpAtomIs('FUNCTION'))
|
||||
and (cmsClosures in Scanner.CompilerModeSwitches) then begin
|
||||
and AllowClosures then begin
|
||||
ReadClosure(true,CreateNodes);
|
||||
end else begin
|
||||
// check for unexpected keywords
|
||||
@ -6188,6 +6188,12 @@ begin
|
||||
Result:=Scanner.CompilerMode in [cmDELPHI,cmDELPHIUNICODE,cmOBJFPC];
|
||||
end;
|
||||
|
||||
function TPascalParserTool.AllowClosures: boolean;
|
||||
begin
|
||||
Result:=(cmsClosures in Scanner.CompilerModeSwitches)
|
||||
or (Scanner.PascalCompiler=pcPas2js);
|
||||
end;
|
||||
|
||||
procedure TPascalParserTool.ValidateToolDependencies;
|
||||
begin
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user