Пример #1
0
        /// <summary>
        /// Helper method for creating a deref instruction on a given object, typically used for
        /// validating the null-state of an object prior to calling a member method of it.
        /// </summary>
        /// <param name="objectToDereference">Variable corresponding to the object to
        /// dereference.</param>
        /// <param name="type">The type of the object being dereferenced.</param>
        /// <param name="state">The program state for the SIL instruction.</param>
        /// <returns>SIL instruction representing the dereference.</returns>
        protected static Load CreateDereference(VarExpression objectToDereference,
                                                Typ type,
                                                ProgramState state)
        {
            var noId = state.GetIdentifier(Identifier.IdentKind.None);

            return(new Load(identifierAssignedTo: noId,
                            lvalue: objectToDereference,
                            type: type.StripPointer(),
                            location: state.CurrentLocation));
        }