Пример #1
0
        public BoundExpression BindExpression(AST.Expression expr, BoundAccess access)
        {
            var bound = BindExpressionCore(expr, access).WithAccess(access);

            bound.PhpSyntax = expr;

            return(bound);
        }
Пример #2
0
        public static ConstantValue TryGetConstantValue(PhpCompilation compilation, AST.Expression value)
        {
            if (value is AST.Literal)
            {
                return(CreateConstant((AST.Literal)value));
            }
            if (value is AST.GlobalConstUse)
            {
                return(CreateConstant((AST.GlobalConstUse)value));
            }

            return(null);
        }
Пример #3
0
 BoundExpression BindExpression(AST.Expression expr) => BindExpression(expr, BoundAccess.Read);
Пример #4
0
        BoundExpression BindExpressionCore(AST.Expression expr, BoundAccess access)
        {
            Debug.Assert(expr != null);

            if (expr is AST.Literal)
            {
                return(BindLiteral((AST.Literal)expr).WithAccess(access));
            }
            if (expr is AST.VarLikeConstructUse)
            {
                return(BindVarLikeConstructUse((AST.VarLikeConstructUse)expr, access));
            }
            if (expr is AST.BinaryEx)
            {
                return(BindBinaryEx((AST.BinaryEx)expr).WithAccess(access));
            }
            if (expr is AST.AssignEx)
            {
                return(BindAssignEx((AST.AssignEx)expr, access));
            }
            if (expr is AST.UnaryEx)
            {
                return(BindUnaryEx((AST.UnaryEx)expr, access));
            }
            if (expr is AST.IncDecEx)
            {
                return(BindIncDec((AST.IncDecEx)expr).WithAccess(access));
            }
            if (expr is AST.ConditionalEx)
            {
                return(BindConditionalEx((AST.ConditionalEx)expr).WithAccess(access));
            }
            if (expr is AST.ConcatEx)
            {
                return(BindConcatEx((AST.ConcatEx)expr).WithAccess(access));
            }
            if (expr is AST.IncludingEx)
            {
                return(BindIncludeEx((AST.IncludingEx)expr).WithAccess(access));
            }
            if (expr is AST.InstanceOfEx)
            {
                return(BindInstanceOfEx((AST.InstanceOfEx)expr).WithAccess(access));
            }
            if (expr is AST.PseudoConstUse)
            {
                return(BindPseudoConst((AST.PseudoConstUse)expr).WithAccess(access));
            }
            if (expr is AST.IssetEx)
            {
                return(BindIsSet((AST.IssetEx)expr).WithAccess(access));
            }
            if (expr is AST.ExitEx)
            {
                return(BindExitEx((AST.ExitEx)expr).WithAccess(access));
            }
            if (expr is AST.ConstantUse)
            {
                return(BindConstUse((AST.ConstantUse)expr).WithAccess(access));
            }
            if (expr is AST.ListEx)
            {
                return(BindListEx((AST.ListEx)expr).WithAccess(access));
            }
            if (expr is AST.EmptyEx)
            {
                return(BindIsEmptyEx((AST.EmptyEx)expr).WithAccess(access));
            }

            throw new NotImplementedException(expr.GetType().FullName);
        }