示例#1
0
        /*
         * CODE FOR ALTERNATE IMPL : please ignore.  I will remove when confortable with current.
         */

        /// <summary>  not used in current impl
        /// *
        /// Constructor for alternate impl where VelProxy class would make new
        /// VMProxyArg objects, and use this contructor to avoid reparsing the
        /// reference args
        /// *
        /// that impl also had the VMProxyArg carry it's context
        /// </summary>
        public VMProxyArg(VMProxyArg model, InternalContextAdapter c)
        {
            usercontext      = c;
            contextReference = model.ContextReference;
            callerReference  = model.CallerReference;
            nodeTree         = model.NodeTree;
            staticObject     = model.StaticObject;
            type             = model.Type;

            if (nodeTree != null)
            {
                numTreeChildren = nodeTree.jjtGetNumChildren();
            }

            if (type == ParserTreeConstants.JJTREFERENCE)
            {
                if (numTreeChildren == 0)
                {
                    /*
                     *  use the reference node to do this...
                     */
                    singleLevelRef = ((ASTReference)nodeTree).RootString;
                }
            }
        }
示例#2
0
        /// <summary>  ctor for current impl
        /// *
        /// takes the reference literal we are proxying for, the literal
        /// the VM we are for is called with...
        /// *
        /// </summary>
        /// <param name="contextRef">reference arg in the definition of the VM, used in the VM
        /// </param>
        /// <param name="callerRef"> reference used by the caller as an arg to the VM
        /// </param>
        /// <param name="t"> type of arg : JJTREFERENCE, JJTTRUE, etc
        ///
        /// </param>
        public VMProxyArg(RuntimeServices rs, String contextRef, String callerRef, int t)
        {
            rsvc = rs;

            contextReference = contextRef;
            callerReference  = callerRef;
            type             = t;

            /*
             *  make our AST if necessary
             */
            setup();

            /*
             *  if we are multi-node tree, then save the size to
             *  avoid fn call overhead
             */
            if (nodeTree != null)
            {
                numTreeChildren = nodeTree.jjtGetNumChildren();
            }

            /*
             *  if we are a reference, and 'scalar' (i.e. $foo )
             *  then get the de-dollared ref so we can
             *  hit our context directly, avoiding the AST
             */
            if (type == ParserTreeConstants.JJTREFERENCE)
            {
                if (numTreeChildren == 0)
                {
                    /*
                     * do this properly and use the Reference node
                     */
                    singleLevelRef = ((ASTReference)nodeTree).RootString;
                }
            }
        }