예제 #1
0
 private static NewDelegatePrototype DecodeNewDelegate(IReadOnlyList <LNode> data, DecoderState state)
 {
     return(NewDelegatePrototype.Create(
                state.DecodeType(data[0]),
                state.DecodeMethod(data[1]),
                state.DecodeBoolean(data[2]),
                state.DecodeMethodLookup(data[3])));
 }
예제 #2
0
 private static IReadOnlyList <LNode> EncodeNewDelegate(NewDelegatePrototype value, EncoderState state)
 {
     return(new LNode[]
     {
         state.Encode(value.ResultType),
         state.Encode(value.Callee),
         state.Encode(value.HasThisArgument),
         state.Encode(value.Lookup)
     });
 }
예제 #3
0
 /// <summary>
 /// Creates a new-delegate instruction.
 /// </summary>
 /// <param name="delegateType">
 /// The type of the resulting delegate or function pointer.
 /// </param>
 /// <param name="callee">
 /// The method called by the resulting delegate or function
 /// pointer.
 /// </param>
 /// <param name="thisArgument">
 /// The 'this' argument, if any. A <c>null</c> value means that
 /// there is no 'this' argument.
 /// </param>
 /// <param name="lookup">
 /// The method implementation lookup technique to use.
 /// </param>
 /// <returns>
 /// A new-delegate instruction.
 /// </returns>
 public static Instruction CreateNewDelegate(
     IType delegateType,
     IMethod callee,
     ValueTag thisArgument,
     MethodLookup lookup)
 {
     return(NewDelegatePrototype
            .Create(delegateType, callee, thisArgument != null, lookup)
            .Instantiate(thisArgument));
 }