XSharpPublic
XSharpPublic copied to clipboard
Macro compiler cannot compile strongly typed codeblocks
Macro compiler throws an error when compiling a string containing a strongly typed codeblock
FUNCTION Start() AS VOID
LOCAL cb AS CODEBLOCK
cb := MCompile( "{|a , b | a * b}" ) // OK
? Eval(cb ,3,4)
cb := MCompile( "{|a AS INT , b AS INT | a * b}" ) // Macrocompiler (1,5): error XM0100: Expected '|'
? Eval(cb ,3,4)
XSharp.MacroCompiler.CompilationError
Macrocompiler (1,5): error XM0100: Expected '|'
Callstack :
XSharp.Runtime.MacroCompiler.[Method XSharp.Runtime.MacroCompiler.CompileCodeblock(macro:System.String, lAllowSingleQuotes:System.Boolean, module:System.Reflection.Module):XSharp._Codeblock]
[Method XSharp.RT.Functions.MCompile(cString:System.String, lAllowSingleQuotes:System.Boolean):XSharp._Codeblock]
[Method XSharp.RT.Functions.MCompile(cString:System.String):XSharp._Codeblock]
I can make a quick change to allow it to parse (and ignore) the parameter type declaration. Parsing and respecting them will require much more work, and it will not make a big difference in performance.
It's not of any priority, but yes, if it can be easily made to parse (and ignore) them, it would be nice
Confirmed fixed.