- Home /
help fix expando object .js file error.
Can someone help me fix a compilation error in expandoobject.js. This is on the unify site from 2009 and allows you to create dot notation objects in javascript rather than hashtables. The file seems to be outdated. The error I'm getting is:
**Boo.Lang.IQuackFu is not a class 'extends' can only be used with classes.
Here is the code
import System.Reflection;
class ExpandoObject extends Boo.Lang.IQuackFu { private var _data : Hashtable; function QuackInvoke(name : String, args : Object[]) : Object { var t : System.Type = this.GetType(); var at = new System.Type[args.Length]; for (var i=0;i
// First test if the method is defined statically
var mi : MethodInfo = t.GetMethod(name, at);
if(mi)
return mi.Invoke(this, args);
else {
// If not -- throw an error. TODO: Support extending the object with closures.
var s = "(";
for (var j=0;j<at.Length;j++)
s+=at[j]+((j<at.Length-1)?", ":"");
s+=")";
throw System.MissingMethodException("Method '"+name+s+"' not found in class "+this.GetType());
}
}
function QuackGet( name : String, params : Object[] ) : Object {
var t : System.Type = this.GetType();
var fi : FieldInfo = t.GetField(name);
// First test if the field is defined statically
if (fi) {
return fi.GetValue(this);
}
else {
// If not, read the value from a local hash
return _data[name];
}
}
function QuackSet( name : String, params : Object[], value : Object ) : Object {
var t : System.Type = this.GetType();
var fi : FieldInfo = t.GetField(name);
// First test if the field is defined statically
if (fi) {
fi.SetValue(this, value);
}
else {
// If not, store the value in a local hash
_data[name]=value;
}
return value;
}
// Constructor
function ExpandoObject() {
_data = new Hashtable();
}
}
Comment