コード例 #1
0
ファイル: IrMethod.cs プロジェクト: deepankarsharma/Flame
        /// <summary>
        /// Creates a Flame IR method from an appropriately-encoded
        /// LNode.
        /// </summary>
        /// <param name="node">The node to decode.</param>
        /// <param name="decoder">The decoder to use.</param>
        private IrMethod(LNode node, DecoderState decoder)
            : base(node, decoder)
        {
            this.isStaticCache = new Lazy <bool>(() =>
                                                 decoder.DecodeBoolean(node.Args[1]));

            var methodDecoder = decoder.WithScope(new TypeParent(this));

            this.genericParameterCache = new Lazy <IReadOnlyList <IGenericParameter> >(() =>
                                                                                       node.Args[2].Args.EagerSelect(methodDecoder.DecodeGenericParameterDefinition));
            this.returnParameterCache = new Lazy <Parameter>(() =>
                                                             methodDecoder.DecodeParameter(node.Args[3]));
            this.parameterCache = new Lazy <IReadOnlyList <Parameter> >(() =>
                                                                        node.Args[4].Args.EagerSelect(methodDecoder.DecodeParameter));
            this.baseMethodCache = new Lazy <IReadOnlyList <IMethod> >(() =>
                                                                       node.Args[5].Args.EagerSelect(methodDecoder.DecodeMethod));
            this.methodBodyCache = new Lazy <MethodBody>(() =>
                                                         node.ArgCount > 6
                ? new MethodBody(
                                                             ReturnParameter,
                                                             Parameter.CreateThisParameter(this.ParentType),
                                                             Parameters,
                                                             methodDecoder.DecodeFlowGraph(node.Args[6]))
                : null);
        }
コード例 #2
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])));
 }
コード例 #3
0
 /// <summary>
 /// Creates a Flame IR field from an appropriately-encoded
 /// LNode.
 /// </summary>
 /// <param name="node">The node to decode.</param>
 /// <param name="decoder">The decoder to use.</param>
 private IrField(LNode node, DecoderState decoder)
     : base(node, decoder)
 {
     this.isStaticCache = new Lazy <bool>(() =>
                                          decoder.DecodeBoolean(node.Args[1]));
     this.fieldTypeCache = new Lazy <IType>(() =>
                                            decoder.DecodeType(node.Args[2]));
 }
コード例 #4
0
 private static StorePrototype DecodeStore(IReadOnlyList <LNode> data, DecoderState state)
 {
     if (data.Count >= 3)
     {
         return(StorePrototype.Create(
                    state.DecodeType(data[0]),
                    state.DecodeBoolean(data[1]),
                    state.DecodeAlignment(data[2])));
     }
     else if (data.Count >= 2)
     {
         return(StorePrototype.Create(
                    state.DecodeType(data[0]),
                    state.DecodeBoolean(data[1])));
     }
     else
     {
         return(StorePrototype.Create(state.DecodeType(data[0])));
     }
 }