Autocompletion problem in functions within blocks (with macro)

30 views
Skip to first unread message

Andreas Söderlund

unread,
Feb 8, 2014, 10:33:14 PM2/8/14
to haxe...@googlegroups.com
Hello, I'm using a build macro for rewriting classes, and have noticed there are some autocompletion problems in FlashDevelop when using a syntax like this:

class Test {
    var testVar = {
        function innerFunction() {
            // Indentation in here doesn't work properly.
        }
    }
}

What happens behind the scenes is that testVar and innerFunction are replaced by a method, "testVar_innerFunction", with the function body of innerFunction. This seems to confuse either the Haxe compiler or the FD autocompletion. When entering code inside innerFunction, the indentation resets to the level of the function definition (not indented as the comment).

Perhaps the compiler reports the nesting level incorrectly somehow when autocompleting because of the macro rewrite? This is how to reproduce:
  1. Install haxedci from command line: haxelib install haxedci
  2. Download this repository: https://github.com/ciscoheat/haxedci-example
  3. Open the project and and a context class, for example dci.examples.moneytransfer.contexts.MoneyTransfer
  4. Add code to the function transfer, or add a new function in a role and test there.

Andreas Söderlund

unread,
Feb 8, 2014, 10:43:40 PM2/8/14
to haxe...@googlegroups.com
Additionally, I'm getting frequent compiler errors when accessing fields, similar to:

C:\HaxeToolkit\haxe/std/haxe/macro/Printer.hx:45: lines 45-71 : { } should be String
C:\HaxeToolkit\haxe/std/neko/_std/sys/FileSystem.hx:56: characters 2-6 : { } should be sys._FileSystem.FileKind
C:\HaxeToolkit\haxe/std/neko/_std/sys/FileSystem.hx:53: lines 53-60 : Missing return sys._FileSystem.FileKind

The common part for the errors is "{ } should be T", which appears in all kinds of classes.

Reply all
Reply to author
Forward
0 new messages