back2dos / tinkerbell

MIT License
83 stars 8 forks source link

error with AST.Build #1

Closed francescoagati closed 12 years ago

francescoagati commented 12 years ago
#if macro 
import haxe.macro.Expr;
import tink.macro.tools.AST;
#end

class Main {

  @:macro static public function setter(e:Expr, field:String) {
      return AST.build( {
          var tmp = $e;
          function (v) {
              return $e.eval__field = v;
          }
      });
  }

  public static function main(){
    var o = { foo: 5 };
    var s = setter(o, 'foo');
  }

}

with this code i have this error:

tink/macro/tools/Printer.hx:57: characters 9-18 : This constructor is not part of the enum haxe.macro.ComplexType tink/macro/tools/Printer.hx:159: characters 10-20 : This constructor is not part of the enum haxe.macro.ExprDef tink/macro/tools/Printer.hx:138: lines 138-236 : String should be Void tink/macro/tools/Printer.hx:51: characters 4-8 : String should be Void

Is for haxe 2.0.8 Optional arguments in type?

back2dos commented 12 years ago

Hi francesco,

TOptional is not included ComplexType in haXe 2.08 yet, but it's already in the docs. I think it was mostly included for encoding optional type parameters in function signatures.

I'm afraid you will have to use a nightly build or build haXe yourself. Also, I think we can expect a haXe 2.09 some time soon :)

francescoagati commented 12 years ago

thank resolved :-)