Water compilation problems

I tried latest Water compilation on my project created using VS (all compiles fine), but :

  1. it doesn’t compile ignoring Delphi compatibility options in project (I cannot set them too)
  2. it altered without asking all my compiled files changing code, e.g. adding multi “var” before variable in function calls so : FreeObject( stm ) is changed to FreeObject( varstm ). Fixit should be disabled by default.
  3. it changes coding of source file so I lost special characters from doc

Is there an option in Water to make a project settings compatible with VS and use all parameters, especially all from Delphi compatibility section? Or I need to switch to different build mode?

Artur,

hmm. can you send me a small sample project that shows this? This would be an EBuild issue, not a Water one, but as far as I can tell, EBuild passes the Delphi compatibility settings to the compiler just fine…

This is a side effect of the compiler not seeing the AllowLegacyOutParams option, ie ion problem #1. once we fix that, this will be taken care of as well.

can you elaborate on that? Water should persist the encoding of files, and default to UTF8 when files have nk specific encoding. It will always save an UTF8 header, when saving UTF8 files.

They should be… :frowning:

fwiw, this compiles fine for me in EBuild if I turn “allow legacy out and var” on:

namespace ConsoleApplication236;

interface

uses
  System.Linq;

type
  Program = class
  public
    class method Main(args: array of String): Int32;
    class method Foo(var s: String); empty;
  end;

implementation

class method Program.Main(args: array of String): Int32;
begin
  // add your own code here
  writeLn('The magic happens here.');
  var x: String := "test";
  Foo(x); // does not fail for missing "var"
end;

end.

ie if my project contains

    <AllowLegacyOutParams>True</AllowLegacyOutParams>

Thanks. I retested again and you are right, it works correctly. The problem was default parameters settings - missing parameters in project are True in VS. I added them to project and now Water compiles fine. And even web assembly project runs better than in VS.

Ah yes. we did change the defaults for these to false, for EBuild.

:wink: glad to hear!

One error though after clicking on html file

I tried some web assembly code from blog and for last line

var hdiv := WebAssembly.GetElementById("helloWorld");\
var text := WebAssembly.CreateTextNode( 'X=' + oWgsPoint2.X.ToString + ' Y=' + oWgsPoint2.Y.ToString);
hdiv.Call("appendChild", [text]);

I get error

!> Exception of type TypeError on thread 0001
!> Message: TypeError: Cannot read property 'apply' of undefined
!>     at imp.env.__island_call (http://127.0.0.1:50961/wasm/RemObjectsElements.js:339:35)
!>     at .Lmi_t31_RemObjects_d_Elements_d_System_d_EcmaScriptObject4_Callnsnt39_gt2a__RemObjects__d__Elements__d__System__d__Array__t__1o (wasm-function[2778]:618)
!>     at .Lmi_t31_RemObjects_d_Elements_d_System_d_EcmaScriptObject6_Invokensni32nt39_gt2a__RemObjects__d__Elements__d__System__d__Array__t__1o (wasm-function[2776]:102)
!>     at .L_intf__rtti_t31_RemObjects_d_Elements_d_System_d_EcmaScriptObject_vmthelper2 (wasm-function[2783]:248)
!>     at .Lms_t2f_RemObjects_d_Elements_d_System_d_DynamicHelpers6_Invokenonsni32nt39_gt2a__RemObjects__d__Elements__d__System__d__Array__t__1o (wasm-function[3357]:318)
!>     at mi_t18_TatukGIS__DK11_d_Program6_TestCS (wasm-function[3813]:2100)
!>     at imp.env.__island_invoke (http://127.0.0.1:50961/wasm/RemObjectsElements.js:434:38)
!>     at .Lms_t2c_RemObjects_d_Elements_d_System_d_WebAssemblyc_InvokeMethodnp_vnt39_gt2a__RemObjects__d__Elements__d__System__d__Array__t__1o (wasm-function[2659]:589)
!>     at .Lmi_t2b_RemObjects_d_Elements_d_System_d_MethodInfo6_Invokenont39_gt2a__RemObjects__d__Elements__d__System__d__Array__t__1o (wasm-function[2651]:2583)
!>     at .Lmi_tnt2c_RemObjects_d_Elements_d_System_d_WebAssembly18__l__g_c____DisplayClass117__l_GetProxyFor_g_b____2nt31_RemObjects_d_Elements_d_System_d_EcmaScriptObject (wasm-function[2827]:960)

#> (edb)

Yeah, I think I know what that is. the HTML syntax highlighter supports mixing different highlighters (Javascript, CSS, as all s code (for ASP.NET), and there’s a couple parts of that that I haven’t been able to cleanly port from Fire to Water yet (because WPF’s FormattedText class is too limited and I don’t know how to work around yet without changing everything. That said, can you send me the HTML file in question so I can make sure thats the problem? And I’ll make sure that at least it won’t crash, for the next beta… thanx!

This has been improved, since we now have dynamic support. just use

hide.appendChild(text);

That said, not sure f thats the problem, if not Carlo or Diego will need to check, tomorrow…

Here is index.html context

<html>
    <head>
      <title>TatukGIS_DK11 Test Page</title>
		<script lang="javascript" src="wasm/RemObjectsElements.js"></script>
		<script lang="javascript" src="wasm/TatukGIS_DK11.js"></script>
    </head>
    <body>
      <h1>TatukGIS_DK11 Test Page</h1>
	<div id="helloWorld"/>
	<script lang="javascript">
    TatukGIS_DK11.instantiate("wasm/TatukGIS_DK11.wasm").then(function (result) {
      console.log("WebAssembly file TatukGIS_DK11.wasm has been loaded.");
      var program = result.Program();
      console.log("Program created.");
      program.TestCS();
      console.log("Program TestCS done.");
		});
	</script>
    </body>
</html>

yes, appendChild works.

1 Like

Fixed (the crash, not the actual nested highlighting).