Forum > Free Pascal

Feature announcement: Function References and Anonymous Functions

<< < (9/9)

Peter H:
Hi, I noticed this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    procedure(const aArg: String)    begin         Writeln(aArg);    end('Hello World'); 
is not supported by codetools.
It says:
project1.lpr(26,5) Error: unexpected keyword "procedure"

Also this compiles, but is not accepted by codetools:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---p:= function foo:integer      begin         foo:= 4711;      end; 
It does accept this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---i:= function:integer      begin         Result:= 4711;      end(); 
Just for the records, it is not an important problem.

Edit:
Compilable and runnable example attached.

PascalDragon:
Best report it as an issue for Lazarus then.

Peter H:
I have done this now, was a lot of work create account.
GitLab is not for beginners and casual programmers like me.
I put the code in, cleanly formatted as seen here, and when I submitted it formatting was destroyed.
Then you have to read several pages about GitLab Markdown language before you learn how to fix this.

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39871

Navigation

[0] Message Index

[*] Previous page

Go to full version