public class FunctionObject : ScriptFunction {
- internal MethodAttributes attr;
internal string name;
internal string type_annot;
internal Type return_type;
internal FormalParameterList parameters;
internal Block body;
+ internal FunctionObject (string name)
+ {
+ this.name = name;
+ }
+
+ internal FunctionObject (MethodInfo info)
+ {
+ this.method = info;
+ this.name = info.Name;
+ this.attr = info.Attributes;
+ this.return_type = info.ReturnType;
+ }
+
internal FunctionObject (string name, FormalParameterList p, string ret_type, Block body)
{
//
- // FIXME:
+ // FIXME
// 1) Must collect the attributes given.
// 2) Check if they are semantically correct.
// 3) Assign those values to 'attr'.
StringBuilder sb = new StringBuilder ();
sb.Append ("function ");
- sb.Append (name + " ");
+ sb.Append (name);
sb.Append ("(");
if (parameters != null)
sb.Append (this.parameters.ToString ());
sb.Append (")");
- sb.Append (" : " + return_type);
- sb.Append ("{");
+ if (return_type != null && return_type != typeof (void))
+ sb.Append (" : " + return_type);
+ sb.Append (" {\n");
if (body != null)
sb.Append (body.ToString ());
+ else
+ sb.Append (" [native code]");
- sb.Append ("}");
+ sb.Append ("\n}");
return sb.ToString ();
}