// Generates code to fetch the value of a named constant or variable
        // and push it on to the stack.
        // currentLevel is the routine level where the vname occurs.
        // frameSize is the anticipated size of the local stack frame when
        // the constant or variable is fetched at run-time.
        // valSize is the size of the constant or variable's value.

        void EncodeFetch(Identifier identifier, Frame frame, int valSize)
        {
            IFetchableEntity baseObject = identifier.Declaration.Entity as IFetchableEntity;

            // If indexed = true, code will have been generated to load an index
            // value.
            if (valSize > 255)
            {
                errorReporter.ReportMessage("can't load values larger than 255 words");
                valSize = 255; // to allow code generation to continue
            }
            baseObject.EncodeFetch(emitter, frame, valSize, identifier);
        }
Beispiel #2
0
        // Generates code to fetch the value of a named constant or variable
        // and push it on to the stack.
        // currentLevel is the routine level where the vname occurs.
        // frameSize is the anticipated size of the local stack frame when
        // the constant or variable is fetched at run-time.
        // valSize is the size of the constant or variable's value.

        void EncodeFetch(Vname vname, Frame frame, int valSize)
        {
            IFetchableEntity baseObject = vname.Visit(this, frame);

            // If indexed = true, code will have been generated to load an index
            // value.
            if (valSize > 255)
            {
                _errorReporter.ReportRestriction("can't load values larger than 255 words");
                valSize = 255; // to allow code generation to continue
            }
            baseObject.EncodeFetch(_emitter, frame, valSize, vname);
        }