Changeset 283

Show
Ignore:
Timestamp:
04/15/08 10:22:26 (8 months ago)
Author:
JarrettBillingsley
Message:

Fixed bad bug with MDState.callMethod, as well as slicing bugs with StringBuffer?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/minid/baselib.d

    r257 r283  
    856856        public int opSlice(MDState s, uint numParams) 
    857857        { 
    858             s.push(s.getContext!(MDStringBuffer)()[s.getParam!(int)(0) .. s.getParam!(int)(1)]); 
     858            int lo, hi; 
     859             
     860            if(s.isParam!("null")(0)) 
     861                lo = 0; 
     862            else 
     863                lo = s.getParam!(int)(0); 
     864 
     865            if(s.isParam!("null")(1)) 
     866                hi = -1; 
     867            else 
     868                hi = s.getParam!(int)(1); 
     869 
     870            s.push(s.getContext!(MDStringBuffer)()[lo .. hi]); 
    859871            return 1; 
    860872        } 
     
    862874        public int opSliceAssign(MDState s, uint numParams) 
    863875        { 
    864             s.getContext!(MDStringBuffer)()[s.getParam!(int)(0) .. s.getParam!(int)(1)] = s.getParam!(dchar[])(2); 
     876            int lo, hi; 
     877             
     878            if(s.isParam!("null")(0)) 
     879                lo = 0; 
     880            else 
     881                lo = s.getParam!(int)(0); 
     882 
     883            if(s.isParam!("null")(1)) 
     884                hi = -1; 
     885            else 
     886                hi = s.getParam!(int)(1); 
     887 
     888            s.getContext!(MDStringBuffer)()[lo .. hi] = s.getParam!(dchar[])(2); 
    865889            return 0; 
    866890        } 
     
    10301054                hi += mLength; 
    10311055 
    1032             if(lo < 0 || lo > hi || hi >= mLength) 
     1056            if(lo < 0 || lo > hi || hi > mLength) 
    10331057                throw new MDException("Invalid indices: {} .. {}", lo, hi); 
    10341058 
     
    10441068                hi += mLength; 
    10451069 
    1046             if(lo < 0 || lo > hi || hi >= mLength) 
     1070            if(lo < 0 || lo > hi || hi > mLength) 
    10471071                throw new MDException("Invalid indices: {} .. {}", lo, hi); 
    10481072 
  • trunk/minid/types.d

    r282 r283  
    39693969        else 
    39703970        { 
    3971             mStackIndex = funcSlot + numReturns; 
     3971            mStackIndex = mCurrentAR.base + funcSlot + numReturns; 
    39723972            return numReturns; 
    39733973        } 
     
    39903990        else 
    39913991        { 
    3992             mStackIndex = funcSlot + numReturns; 
     3992            mStackIndex = mCurrentAR.base + funcSlot + numReturns; 
    39933993            return numReturns; 
    39943994        }