ciscoheat/dataclass

Invalid field access with any function out of properties

Closed this issue · 5 comments

// Main.hx

class Main {
    static public function main() {
        var rootNode = new models.SNode({text: 'Home'});
    }
}

// SNode.hx

package models;

@:expose
@:keep

class SNode extends SModel implements dataclass.DataClass {
    static private var template_id : String = 'node_template';

    public var text : String = '';
    public var done : Bool = false;

    public function new(data) {
        super(data);
    }
}

// SModel.hx

package models;

import js.Browser;

class SModel {
    static private var template_id : Null<String>;
    static private var template : Null<haxe.Template>;

    public function new(data) {
        if (template_id != null) set_template();
    }

    public function function_that_fail_compiling() {} // any titile

    static private function set_template() {
        var template_element = Browser.document.getElementById(template_id);
        template = new haxe.Template(template_element.innerHTML);
    }
}
# build.hxml
-cp js/haxe
-main Main
-lib dataclass
-js js/app.js
-dce full
~/project $ haxe build.hxml 
/home/user/haxelib/dataclass/0,21,0/dataclass/macros/Builder.hx:385: characters 16-22 : Invalid field access : index
/usr/share/haxe/std/neko/_std/Array.hx:282: characters 7-13 : Called from
/home/user/haxelib/dataclass/0,21,0/dataclass/macros/Builder.hx:409: characters 9-68 : Called from
/home/user/haxelib/dataclass/0,21,0/dataclass/macros/Builder.hx:413: lines 413-439 : Called from
/home/user/haxelib/dataclass/0,21,0/dataclass/macros/Builder.hx:399: characters 19-47 : Called from
/home/user/haxelib/dataclass/0,21,0/dataclass/macros/Builder.hx:29: characters 24-51 : Called from
/home/user/haxelib/dataclass/0,21,0/dataclass/DataClass.hx:3: characters 2-11 : Called from
Aborted

There is no error if there is no function function_that_fail_compiling for SModel.

Thanks, the problem was that an empty method like that has no type/kind defined, and I didn't account for that. A new haxelib version has been released.

A new haxelib version has been released.

I'm sorry, but I do not understand: the recent version of haxelib broke DataClass and it will be fixed in the DataClass or be fixed in some already released version of haxelib?

I have fixed the problem, all you need to do is upgrade the library in
haxelib and it should work.

Den mån 27 juni 2016 10:47Alexander Popov notifications@github.com skrev:

A new haxelib version has been released.

I'm sorry, but I do not understand: the recent version of haxelib broke
DataClass and it will be fixed in the DataClass or be fixed in some already
released version of haxelib?


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#7 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAH9kiOqNKvB9Qro24vntaVKPRE461Bmks5qP442gaJpZM4I-sZb
.

Oh, thank you! I'll check tonight.

Yay! It's working, thanks!