asm...end - block is not a single statement

I found (in TMS Web Core 1.6) that an asm...end block in the sourcecode is not a single pascal statement, so one have to be cautious when using it in conditional statements.

For example the code

  if USEPDF then
  asm
    const { jsPDF } = window.jspdf;
    const doc = new jsPDF();
    doc.setFont("courier", "normal");
    doc.setFontSize(12);
  end;

compiles to (when USEPDF equals False)

  if (false) const { jsPDF } = window.jspdf;
  const doc = new jsPDF();
  doc.setFont("courier", "normal");
  doc.setFontSize(12);

I didn't find any information regarding this behaviour in the (TMS Web Core and pas2js) documentation, so I am not sure if this is a bug or a feature.

Regards,
Meik Stoll

Then I am sure you will love this :smile:

Procedure ILoveThis;
Begin
 Try
  //
 Except on E:Exception do
  ASM var i = 5 or whatever you want; END;
  Console.Log('Damned')
 End;
End;

Isn't this a nice error the transpiler gives you?. Took me hours to solve...

We'll bring this to the attention of the pas2js team.