+ OptAttributes = attrs;
+ }
+
+ public void Define (TypeContainer parent)
+ {
+ MethodAttributes attr = Modifiers.MethodAttr (ModFlags);
+
+ Type ret_type = parent.LookupType (Type, false);
+ Type [] param_types = FormalParameters.GetParameterInfo (parent);
+
+ GetMethodBuilder = parent.TypeBuilder.DefineMethod ("get_Item", attr, ret_type, param_types);
+ SetMethodBuilder = parent.TypeBuilder.DefineMethod ("set_Item", attr, ret_type, param_types);
+
+ Parameter [] p = FormalParameters.FixedParameters;
+
+ if (p != null) {
+ int i;
+
+ for (i = 0; i < p.Length; ++i) {
+ GetMethodBuilder.DefineParameter (i + 1, p [i].Attributes, p [i].Name);
+ SetMethodBuilder.DefineParameter (i + 1, p [i].Attributes, p [i].Name);
+ }
+
+ if (i != param_types.Length)
+ Console.WriteLine ("Implement type definition for params");
+ }
+
+ }
+
+ }
+
+ public class Operator {
+
+ const int AllowedModifiers =
+ Modifiers.PUBLIC |
+ Modifiers.STATIC;
+
+ public enum OpType {
+
+ // Unary operators
+ Bang,
+ Tilde,
+ Increment,
+ Decrement,
+ True,
+ False,
+
+ // Unary and Binary operators
+ Plus,
+ Minus,
+
+ // Binary operators
+ Star,
+ Div,
+ Percent,
+ BitAnd,
+ BitOr,
+ Carret,
+ ShiftLeft,
+ ShiftRight,
+ Eq,
+ NotEq,
+ GreaterThan,
+ LesserThan,
+ GreaterOrEq,
+ LesserOrEq,
+
+ // Implicit and Explicit
+ Implicit,
+ Explicit
+ };
+
+ public readonly OpType OperatorType;
+ public readonly string ReturnType;
+ public readonly string FirstArgType;
+ public readonly string FirstArgName;
+ public readonly string SecondArgType;
+ public readonly string SecondArgName;
+ public readonly int ModFlags;
+ public readonly Block Block;
+ public Attributes OptAttributes;
+ public MethodBuilder OperatorMethodBuilder;
+
+ public Operator (OpType type, string ret_type, int flags, string arg1type, string arg1name,
+ string arg2type, string arg2name, Block block, Attributes attrs)
+ {
+ OperatorType = type;
+ ReturnType = ret_type;
+ ModFlags = Modifiers.Check (AllowedModifiers, flags, Modifiers.PUBLIC);
+ FirstArgType = arg1type;
+ FirstArgName = arg1name;
+ SecondArgType = arg2type;
+ SecondArgName = arg2name;
+ Block = block;
+ OptAttributes = attrs;