Microsoft.CSharp.RuntimeBinder.Semantics.ExprFactory.CreateWrap C# (CSharp) Method

CreateWrap() public method

public CreateWrap ( Scope pCurrentScope, EXPR pOptionalExpression ) : Microsoft.CSharp.RuntimeBinder.Semantics.EXPRWRAP
pCurrentScope Scope
pOptionalExpression EXPR
return Microsoft.CSharp.RuntimeBinder.Semantics.EXPRWRAP
        public EXPRWRAP CreateWrap(
            Scope pCurrentScope,
            EXPR pOptionalExpression
        )
        {
            EXPRWRAP rval = new EXPRWRAP();
            rval.kind = ExpressionKind.EK_WRAP;
            rval.type = null;
            rval.flags = 0;
            rval.SetOptionalExpression(pOptionalExpression);
            if (pOptionalExpression != null)
            {
                rval.setType(pOptionalExpression.type);
            }
            rval.flags |= EXPRFLAG.EXF_LVALUE;

            Debug.Assert(rval != null);
            return (rval);
        }
        public EXPRWRAP CreateWrapNoAutoFree(Scope pCurrentScope, EXPR pOptionalWrap)

Usage Example

示例#1
0
        private static Expr CreateWraps(ExprBoundLambda anonmeth)
        {
            Expr sequence = null;

            for (Symbol sym = anonmeth.ArgumentScope.firstChild; sym != null; sym = sym.nextChild)
            {
                if (!(sym is LocalVariableSymbol local))
                {
                    continue;
                }

                Debug.Assert(anonmeth.Expression != null);
                Expr create = GenerateParameter(local.name.Text, local.GetType());
                local.wrap = ExprFactory.CreateWrap(create);
                Expr save = ExprFactory.CreateSave(local.wrap);
                if (sequence == null)
                {
                    sequence = save;
                }
                else
                {
                    sequence = ExprFactory.CreateSequence(sequence, save);
                }
            }

            return(sequence);
        }