[Pas2js] Disable optimization in specific units/blocks

silvioprog silvioprog at gmail.com
Fri Jan 11 18:21:50 CET 2019


On Fri, Jan 11, 2019 at 1:38 PM warleyalex via Pas2js <
pas2js at lists.freepascal.org> wrote:

> OK.  Another thing is
>
> The pas2js compiler does neither parse, nor check the syntax of the JS, but
> I thing pascal methods should be recognized within ASM block.
>

Already mentioned by Mattias in last messages.

  p := @Myfunction; // we have to add this dummy variable ...


Sorry, but as I said -- and have been trying to explain by subject and by
last messages --: just any compiler option/keyword/directive to disable its
optimization in specific parts of the user (programmer) code, leaving them
untouchable, but not by cheating the compiler using ugly/dummy codes. A
good option would be ("*please_leave_my_asm_function_in_peace*" just to
make it comical):

*{$please_leave_my_asm_function_in_peace ON}*
procedure foo;
asm
  alert('leave me in peace, compiler!');
end;
*{$endif}*

that's all, the foo() would be available in the final application script
even enabling the full optimization of the compiler, cause the user code
would be kept as it is. This is possible in other languages by using
keywords (e.g: volatile), compiler annotations and/or pragmas/directives
(some tools allows special comments too).

best,

--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190111/f6838d8c/attachment.html>


More information about the Pas2js mailing list