| Issue 44: | var (dynamic,dynamic) something | |
| 1 person starred this issue and may be notified of changes. | Back to list |
This problem happens when defining a variable with (dynamic, ...)
properties. The code generated by the compiler should look dynamically for
the function, not statically (this is the case on cpp, on php I don't
really know what's going on)
Please complete the following class with minimal code reproducing the
problem :
class Main
{
public static function main(): Void
{
var a = new Test();
trace(a.aa);
}
}
class Test implements Dynamic
{
public function new():Void
{
for (f in Type.getInstanceFields(Type.getClass(this)))
{
var t = this;
var fun = function() return t.resolve(f);
Reflect.setField(this, "get_" + f, fun);
}
}
function resolve(str:String):Dynamic
{
trace(str);
return null;
}
public var aa(dynamic, dynamic):String;
}
Please provide any additional information below.
On PHP, the output is:
[internal function]: _hx_error_handler(2, 'call_user_func(...',
'/Users/cw/temp/...', 21, Array)
on CPP, I get a compile-time cpp error:
In member function 'virtual Dynamic Test_obj::__Field(const String&)':
./src/Test.cpp:95: error: 'get_aa' was not declared in this scope
./src/Test.cpp: In member function 'virtual Dynamic
Test_obj::__SetField(const String&, const Dynamic&)': ./src/Test.cpp:108:
error: 'set_aa' was not declared in this scope Called from line 1 Called
from BuildTool.hx line 840 Called from BuildTool.hx line 433 Called from a
C function Called from BuildTool.hx line 456 Called from BuildTool.hx line
529 Called from BuildTool.hx line 561 Called from BuildTool.hx line 166
Uncaught exception - Error : 256 - build cancelled
Please choose the PLATFORM on which it occur in "Labels" below.
cpp, php
Aug 9, 2010
Project Member
#1
gameh...@gmail.com
Aug 9, 2010
(No comment was entered for this change.)
Status:
Fixed
|