Exemplo n.º 1
0
        BoundExpression BindConstUse(AST.ConstantUse x)
        {
            if (x is AST.GlobalConstUse)
            {
                return(BindGlobalConstUse((AST.GlobalConstUse)x));
            }

            if (x is AST.ClassConstUse)
            {
                var cx    = (AST.ClassConstUse)x;
                var dtype = cx.TypeRef as AST.DirectTypeRef;
                if (dtype != null && cx.Name.Equals("class"))   // Type::class ~ "Type"
                {
                    return(new BoundLiteral(dtype.ClassName.ToString()));
                }

                var typeref = BindTypeRef(cx.TypeRef);

                return(BoundFieldRef.CreateClassConst(typeref, new BoundVariableName(cx.Name)));
            }

            throw ExceptionUtilities.UnexpectedValue(x);
        }
Exemplo n.º 2
0
        /*/// <summary>
         * /// Called when derived class visited.
         * /// </summary>
         * /// <param name="x"></param>
         * virtual public void VisitVarLikeConstructUse(VarLikeConstructUse x)
         * {
         *  // base for variable use
         * }*/

        /// <summary>
        /// Called when derived class visited.
        /// </summary>
        /// <param name="x"></param>
        virtual public void VisitConstantUse(ConstantUse x)
        {
            // base for constant use
        }