Beispiel #1
0
        public void Visit(BeliefDeclarationNode node)
        {
            var argTypes = node.Args.Select(a => typeof(int)).ToArray();
            var field    = typeBuilder.DefineField(node.Name, TupleUtils.MakeTupleType(argTypes), FieldAttributes.Public);

            symbolTable.Register(node.Name, new FieldEntry(field));
        }
Beispiel #2
0
        public static void EmitTupleGetItem(this ILGenerator il, Type[] argTypes, int idx)
        {
            MethodInfo getItemMeth;

            if (!tupleGetItemMethods.TryGetValue(argTypes, out getItemMeth))
            {
                var tupleOf = TupleUtils.MakeTupleType(argTypes);
                getItemMeth = tupleOf.GetMethod("get_Item" + (idx + 1));
                tupleGetItemMethods.Add(argTypes, getItemMeth);
            }

            il.Emit(OpCodes.Call, getItemMeth);
        }