1 // 2 // IILVisitor.cs 3 // 4 // Authors: 5 // Alexander Chebaturkin (chebaturkin@gmail.com) 6 // 7 // Copyright (C) 2011 Alexander Chebaturkin 8 // 9 // Permission is hereby granted, free of charge, to any person obtaining 10 // a copy of this software and associated documentation files (the 11 // "Software"), to deal in the Software without restriction, including 12 // without limitation the rights to use, copy, modify, merge, publish, 13 // distribute, sublicense, and/or sell copies of the Software, and to 14 // permit persons to whom the Software is furnished to do so, subject to 15 // the following conditions: 16 // 17 // The above copyright notice and this permission notice shall be 18 // included in all copies or substantial portions of the Software. 19 // 20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 // 28 29 using System.Collections.Generic; 30 using Mono.CodeContracts.Static.DataStructures; 31 32 namespace Mono.CodeContracts.Static.AST.Visitors { 33 interface IILVisitor<TLabel, TSource, TDest, TData, TResult> : 34 IExpressionILVisitor<TLabel, TSource, TDest, TData, TResult>, 35 ISyntheticILVisitor<TLabel, TSource, TDest, TData, TResult> { Arglist(TLabel pc, TDest dest, TData data)36 TResult Arglist (TLabel pc, TDest dest, TData data); Branch(TLabel pc, TLabel target, bool leavesExceptionBlock, TData data)37 TResult Branch (TLabel pc, TLabel target, bool leavesExceptionBlock, TData data); BranchCond(TLabel pc, TLabel target, BranchOperator bop, TSource value1, TSource value2, TData data)38 TResult BranchCond (TLabel pc, TLabel target, BranchOperator bop, TSource value1, TSource value2, TData data); BranchTrue(TLabel pc, TLabel target, TSource cond, TData data)39 TResult BranchTrue (TLabel pc, TLabel target, TSource cond, TData data); BranchFalse(TLabel pc, TLabel target, TSource cond, TData data)40 TResult BranchFalse (TLabel pc, TLabel target, TSource cond, TData data); Break(TLabel pc, TData data)41 TResult Break (TLabel pc, TData data); 42 43 TResult Call<TypeList, ArgList> (TLabel pc, Method method, bool virt, TypeList extraVarargs, TDest dest, ArgList args, TData data) 44 where TypeList : IIndexable<TypeNode> 45 where ArgList : IIndexable<TSource>; 46 47 TResult Calli<TypeList, ArgList> (TLabel pc, TypeNode returnType, TypeList argTypes, bool instance, TDest dest, TSource functionPointer, ArgList args, TData data) 48 where TypeList : IIndexable<TypeNode> 49 where ArgList : IIndexable<TSource>; 50 CheckFinite(TLabel pc, TDest dest, TSource source, TData data)51 TResult CheckFinite (TLabel pc, TDest dest, TSource source, TData data); CopyBlock(TLabel pc, TSource destAddress, TSource srcAddress, TSource len, TData data)52 TResult CopyBlock (TLabel pc, TSource destAddress, TSource srcAddress, TSource len, TData data); EndFilter(TLabel pc, TSource decision, TData data)53 TResult EndFilter (TLabel pc, TSource decision, TData data); EndFinally(TLabel pc, TData data)54 TResult EndFinally (TLabel pc, TData data); Jmp(TLabel pc, Method method, TData data)55 TResult Jmp (TLabel pc, Method method, TData data); LoadArg(TLabel pc, Parameter argument, bool isOld, TDest dest, TData data)56 TResult LoadArg (TLabel pc, Parameter argument, bool isOld, TDest dest, TData data); LoadArgAddress(TLabel pc, Parameter argument, bool isOld, TDest dest, TData data)57 TResult LoadArgAddress (TLabel pc, Parameter argument, bool isOld, TDest dest, TData data); LoadLocal(TLabel pc, Local local, TDest dest, TData data)58 TResult LoadLocal (TLabel pc, Local local, TDest dest, TData data); LoadLocalAddress(TLabel pc, Local local, TDest dest, TData data)59 TResult LoadLocalAddress (TLabel pc, Local local, TDest dest, TData data); Nop(TLabel pc, TData data)60 TResult Nop (TLabel pc, TData data); Pop(TLabel pc, TSource source, TData data)61 TResult Pop (TLabel pc, TSource source, TData data); Return(TLabel pc, TSource source, TData data)62 TResult Return (TLabel pc, TSource source, TData data); StoreArg(TLabel pc, Parameter argument, TSource source, TData data)63 TResult StoreArg (TLabel pc, Parameter argument, TSource source, TData data); StoreLocal(TLabel pc, Local local, TSource source, TData data)64 TResult StoreLocal (TLabel pc, Local local, TSource source, TData data); Switch(TLabel pc, TypeNode type, IEnumerable<Pair<object, TLabel>> cases, TSource value, TData data)65 TResult Switch (TLabel pc, TypeNode type, IEnumerable<Pair<object, TLabel>> cases, TSource value, TData data); Box(TLabel pc, TypeNode type, TDest dest, TSource source, TData data)66 TResult Box (TLabel pc, TypeNode type, TDest dest, TSource source, TData data); 67 68 TResult ConstrainedCallvirt<TypeList, ArgList> (TLabel pc, Method method, TypeNode constraint, TypeList extraVarargs, TDest dest, ArgList args, TData data) 69 where TypeList : IIndexable<TypeNode> 70 where ArgList : IIndexable<TSource>; 71 CastClass(TLabel pc, TypeNode type, TDest dest, TSource obj, TData data)72 TResult CastClass (TLabel pc, TypeNode type, TDest dest, TSource obj, TData data); CopyObj(TLabel pc, TypeNode type, TSource destPtr, TSource sourcePtr, TData data)73 TResult CopyObj (TLabel pc, TypeNode type, TSource destPtr, TSource sourcePtr, TData data); Initobj(TLabel pc, TypeNode type, TSource ptr, TData data)74 TResult Initobj (TLabel pc, TypeNode type, TSource ptr, TData data); LoadElement(TLabel pc, TypeNode type, TDest dest, TSource array, TSource index, TData data)75 TResult LoadElement (TLabel pc, TypeNode type, TDest dest, TSource array, TSource index, TData data); LoadField(TLabel pc, Field field, TDest dest, TSource obj, TData data)76 TResult LoadField (TLabel pc, Field field, TDest dest, TSource obj, TData data); LoadFieldAddress(TLabel pc, Field field, TDest dest, TSource obj, TData data)77 TResult LoadFieldAddress (TLabel pc, Field field, TDest dest, TSource obj, TData data); LoadLength(TLabel pc, TDest dest, TSource array, TData data)78 TResult LoadLength (TLabel pc, TDest dest, TSource array, TData data); LoadStaticField(TLabel pc, Field field, TDest dest, TData data)79 TResult LoadStaticField (TLabel pc, Field field, TDest dest, TData data); LoadStaticFieldAddress(TLabel pc, Field field, TDest dest, TData data)80 TResult LoadStaticFieldAddress (TLabel pc, Field field, TDest dest, TData data); LoadTypeToken(TLabel pc, TypeNode type, TDest dest, TData data)81 TResult LoadTypeToken (TLabel pc, TypeNode type, TDest dest, TData data); LoadFieldToken(TLabel pc, Field type, TDest dest, TData data)82 TResult LoadFieldToken (TLabel pc, Field type, TDest dest, TData data); LoadMethodToken(TLabel pc, Method type, TDest dest, TData data)83 TResult LoadMethodToken (TLabel pc, Method type, TDest dest, TData data); 84 85 TResult NewArray<ArgList> (TLabel pc, TypeNode type, TDest dest, ArgList lengths, TData data) 86 where ArgList : IIndexable<TSource>; 87 88 TResult NewObj<ArgList> (TLabel pc, Method ctor, TDest dest, ArgList args, TData data) 89 where ArgList : IIndexable<TSource>; 90 MkRefAny(TLabel pc, TypeNode type, TDest dest, TSource obj, TData data)91 TResult MkRefAny (TLabel pc, TypeNode type, TDest dest, TSource obj, TData data); RefAnyType(TLabel pc, TDest dest, TSource source, TData data)92 TResult RefAnyType (TLabel pc, TDest dest, TSource source, TData data); RefAnyVal(TLabel pc, TypeNode type, TDest dest, TSource source, TData data)93 TResult RefAnyVal (TLabel pc, TypeNode type, TDest dest, TSource source, TData data); Rethrow(TLabel pc, TData data)94 TResult Rethrow (TLabel pc, TData data); StoreElement(TLabel pc, TypeNode type, TSource array, TSource index, TSource value, TData data)95 TResult StoreElement (TLabel pc, TypeNode type, TSource array, TSource index, TSource value, TData data); StoreField(TLabel pc, Field field, TSource obj, TSource value, TData data)96 TResult StoreField (TLabel pc, Field field, TSource obj, TSource value, TData data); StoreStaticField(TLabel pc, Field field, TSource value, TData data)97 TResult StoreStaticField (TLabel pc, Field field, TSource value, TData data); Throw(TLabel pc, TSource exception, TData data)98 TResult Throw (TLabel pc, TSource exception, TData data); Unbox(TLabel pc, TypeNode type, TDest dest, TSource obj, TData data)99 TResult Unbox (TLabel pc, TypeNode type, TDest dest, TSource obj, TData data); UnboxAny(TLabel pc, TypeNode type, TDest dest, TSource obj, TData data)100 TResult UnboxAny (TLabel pc, TypeNode type, TDest dest, TSource obj, TData data); 101 } 102 } 103