mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-11-04 00:07:19 +01:00 
			
		
		
		
	Remove duplicate code in Sqrat Var for the the StackStrF type.
This commit is contained in:
		@@ -1021,7 +1021,7 @@ public:
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
/// Used to get and push StackStrF types to and from the stack
 | 
			
		||||
/// Used to get and push StackStrF types to and from the stack (StackStrF is always a reference)
 | 
			
		||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
template<>
 | 
			
		||||
struct Var<StackStrF &> {
 | 
			
		||||
@@ -1055,39 +1055,10 @@ struct Var<StackStrF &> {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
/// Used to get and push StackStrF types to and from the stack
 | 
			
		||||
/// Used to get and push StackStrF types to and from the stack (StackStrF is always a reference)
 | 
			
		||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
template<>
 | 
			
		||||
struct Var<const StackStrF&> {
 | 
			
		||||
 | 
			
		||||
    StackStrF value; ///< The actual value of get operations
 | 
			
		||||
 | 
			
		||||
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
    /// Attempts to get the value off the stack at idx as a string
 | 
			
		||||
    ///
 | 
			
		||||
    /// \param vm  Target VM
 | 
			
		||||
    /// \param idx Index trying to be read
 | 
			
		||||
    ///
 | 
			
		||||
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
    Var(HSQUIRRELVM vm, SQInteger idx) : value(vm, idx, false) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
    /// Called by Sqrat::PushVar to put a string on the stack
 | 
			
		||||
    ///
 | 
			
		||||
    /// \param vm    Target VM
 | 
			
		||||
    /// \param value Value to push on to the VM's stack
 | 
			
		||||
    ///
 | 
			
		||||
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
    static void push(HSQUIRRELVM vm, const StackStrF& value) {
 | 
			
		||||
        if (sq_isstring(value.mObj)) {
 | 
			
		||||
            sq_pushobject(vm, value.mObj);
 | 
			
		||||
        } else {
 | 
			
		||||
            sq_pushstring(vm, value.mPtr, value.mLen);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct Var<const StackStrF &> : Var<StackStrF &> {Var(HSQUIRRELVM vm, SQInteger idx) : Var<StackStrF &>(vm, idx) {}};
 | 
			
		||||
 | 
			
		||||
// Non-referencable type definitions
 | 
			
		||||
template<class T> struct is_referencable {static const bool value = true;};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user