Changeset 172

Show
Ignore:
Timestamp:
05/22/07 20:53:58 (2 years ago)
Author:
JarrettBillingsley
Message:

--

Files:

Legend:

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

    r170 r172  
    375375    } 
    376376 
    377     public static char[] toString(Type type) 
    378     { 
    379         return utf.toUTF8(tokenStrings[type]); 
    380     } 
    381  
    382377    public Token* expect(Type t) 
    383378    { 
     
    458453 
    459454        char firstChar = mSource.getc(); 
    460          
    461         if(mSource.eof() == false) 
     455 
     456        if(mSource.eof()) 
     457        { 
     458            if(firstChar == char.init) 
     459                mCharacter = 0; 
     460            else 
     461                mCharacter = firstChar; 
     462 
     463            mEncoding = Encoding.UTF8; 
     464            //mCharacter = firstChar; 
     465            //mCharacter = 0; 
     466        } 
     467        else 
    462468        { 
    463469            switch(firstChar) 
     
    552558            } 
    553559        } 
    554         else 
    555         { 
    556             mEncoding = Encoding.UTF8; 
    557             mCharacter = 0; 
    558         } 
    559          
     560 
    560561        if(mCharacter == '#') 
    561562        { 
     
    834835                        catch(ConvError e) 
    835836                        { 
     837                            //REACHABLE? 
    836838                            throw new MDCompileException(beginning, "Malformed binary int literal"); 
    837839                        } 
     
    863865                        catch(ConvError e) 
    864866                        { 
     867                            //REACHABLE? 
    865868                            throw new MDCompileException(beginning, "Malformed octal int literal"); 
    866869                        } 
     
    875878                        nextChar(); 
    876879 
    877                         if(!isHexDigit()
     880                        if(!isHexDigit() && mCharacter != '_'
    878881                            throw new MDCompileException(mLoc, "Hexadecimal digit expected, not '%s'", mCharacter); 
    879882 
     
    892895                        catch(ConvError e) 
    893896                        { 
     897                            //REACHABLE? 
    894898                            throw new MDCompileException(beginning, "Malformed hexadecimal int literal"); 
    895899                        } 
     
    931935            else if(mCharacter == '_') 
    932936            { 
     937                //REACHABLE? 
    933938                nextChar(); 
    934939                continue; 
     
    946951                nextChar(); 
    947952            } 
     953            else if(mCharacter == '_') 
     954                nextChar(); 
    948955            else 
    949956                throw new MDCompileException(mLoc, "Floating point literal '%s' must have at least one digit after decimal point", buf[0 .. i]); 
     
    973980                } 
    974981 
    975                 if(!isDecimalDigit()
     982                if(!isDecimalDigit() && mCharacter != '_'
    976983                    throw new MDCompileException(mLoc, "Exponent value expected in float literal '%s'", buf[0 .. i]); 
    977984 
     
    987994            } 
    988995            else if(mCharacter == '_') 
     996            { 
     997                nextChar(); 
    989998                continue; 
     999            } 
    9901000            else 
    9911001                break; 
     
    10001010            catch(ConvError e) 
    10011011            { 
     1012                //REACHABLE? 
    10021013                throw new MDCompileException(beginning, "Malformed int literal '%s'", buf[0 .. i]); 
    10031014            } 
     
    10211032            catch(ConvOverflowError e) 
    10221033            { 
     1034                //REACHABLE? 
     1035                // std.conv.toDouble doesn't throw ConvOverflowErrors. 
    10231036                throw new MDCompileException(beginning, "Numeric overflow"); 
    10241037            } 
     
    18461859    public static ClassDef currentClass() 
    18471860    { 
    1848         if(mClassDefIndex == 0) 
    1849             return null; 
    1850         else 
    1851             return mCurrentClass[mClassDefIndex - 1]; 
     1861        assert(mClassDefIndex != 0); 
     1862        return mCurrentClass[mClassDefIndex - 1]; 
    18521863    } 
    18531864 
     
    19571968    } 
    19581969     
    1959     public bool scopeHasUpval() 
    1960     { 
    1961         return mScope.hasUpval; 
     1970    public void closeUpvals(uint line) 
     1971    { 
     1972        if(mScope.hasUpval) 
     1973        { 
     1974            codeClose(line); 
     1975            mScope.hasUpval = false; 
     1976        } 
    19621977    } 
    19631978 
     
    19821997    public int* addCase(Location location, Expression v) 
    19831998    { 
    1984         if(mSwitch is null) 
    1985             throw new MDCompileException(location, "Case statements may not exist outside of a switch"); 
     1999        assert(mSwitch !is null); 
    19862000 
    19872001        MDValue val; 
     
    20132027    public void addDefault(Location location) 
    20142028    { 
    2015         if(mSwitch is null) 
    2016             throw new MDCompileException(location, "Default statements may not exist outside of a switch"); 
    2017  
    2018         if(mSwitch.defaultOffset != -1) 
    2019             throw new MDCompileException(location, "Multiple defaults in one switch"); 
    2020  
     2029        assert(mSwitch !is null); 
     2030        assert(mSwitch.defaultOffset == -1); 
     2031         
    20212032        mSwitch.defaultOffset = mCode.length - mSwitch.switchPC - 1; 
    20222033    } 
     
    28412852    } 
    28422853 
    2843     public void patchTrueTo(InstRef* i, InstRef* dest) 
    2844     { 
    2845         for(InstRef* t = i.trueList; t !is null; ) 
    2846         { 
    2847             patchJumpTo(t, dest); 
    2848  
    2849             InstRef* next = t.trueList; 
    2850             delete t; 
    2851             t = next; 
    2852         } 
    2853  
    2854         i.trueList = null; 
    2855     } 
    2856  
    28572854    public void patchTrueToHere(InstRef* i) 
    28582855    { 
     
    33053302                default: 
    33063303                    throw new MDCompileException(t.location, "Class method or field expected, not '%s'", t.toString()); 
    3307                     break; 
    33083304            } 
    33093305        } 
     
    34013397    public bool hasBase() 
    34023398    { 
    3403         return (mBaseClass !is null); 
     3399        return !mBaseClass.isNull(); 
    34043400    } 
    34053401} 
     
    35393535        mBody.codeGen(fs); 
    35403536        fs.codeI(mBody.mEndLocation.line, Op.Ret, 0, 1); 
    3541          
    35423537        fs.popScope(mBody.mEndLocation.line); 
    3543  
    35443538        s.pushClosure(fs); 
    35453539    } 
     
    36183612                s.codeGen(fs); 
    36193613            } 
    3620  
     3614             
    36213615            fs.codeI(mEndLocation.line, Op.Ret, 0, 1); 
    36223616        } 
     
    36823676    } 
    36833677 
    3684     public static Statement parse(ref Token* t
     3678    public static Statement parse(ref Token* t, bool needScope = true
    36853679    { 
    36863680        Location location = t.location; 
     
    37013695            case Token.Type.Local, Token.Type.Global, Token.Type.Function, Token.Type.Class: 
    37023696                return DeclarationStatement.parse(t); 
    3703                  
     3697 
    37043698            case Token.Type.LBrace: 
    37053699                CompoundStatement s = CompoundStatement.parse(t); 
    3706                 return new ScopeStatement(s.mLocation, s.mEndLocation, s); 
     3700                 
     3701                if(needScope) 
     3702                    return new ScopeStatement(s.mLocation, s.mEndLocation, s); 
     3703                else 
     3704                    return s; 
    37073705 
    37083706            case Token.Type.If: 
     
    41624160                    s.popToRegisters(mEndLocation.line, reg, mNames.length); 
    41634161 
    4164                     for(int r = reg + mNames.length; r >= reg; r--) 
     4162                    for(int r = reg + mNames.length - 1; r >= reg; r--) 
    41654163                        s.popMoveFromReg(mEndLocation.line, r); 
    41664164                } 
     
    42914289    public int opCmp(Object o) 
    42924290    { 
     4291        //USED? 
    42934292        Identifier other = cast(Identifier)o; 
    42944293        assert(other); 
     
    43154314                return idents[index].mName; 
    43164315        }, "."); 
    4317     } 
    4318      
    4319     public static dchar[][] toStringArray(Identifier[] idents) 
    4320     { 
    4321         dchar[][] ret = new dchar[][idents.length]; 
    4322          
    4323         foreach(i, ident; idents) 
    4324             ret[i] = ident.mName; 
    4325              
    4326         return ret; 
    43274316    } 
    43284317 
     
    45024491        t = t.expect(Token.Type.RParen); 
    45034492 
    4504         Statement whileBody = Statement.parse(t); 
     4493        Statement whileBody = Statement.parse(t, false); 
    45054494 
    45064495        return new WhileStatement(location, whileBody.mEndLocation, condition, whileBody); 
     
    45264515            InstRef* cond = mCondition.codeCondition(s); 
    45274516            s.invertJump(cond); 
    4528      
     4517 
    45294518            s.pushScope(); 
    45304519                s.patchTrueToHere(cond); 
     
    45334522                mBody.codeGen(s); 
    45344523                s.patchContinues(beginLoop); 
     4524                s.closeUpvals(mEndLocation.line); 
    45354525                s.codeJump(mEndLocation.line, beginLoop); 
    45364526                s.patchBreaksToHere(); 
     
    45804570        t = t.expect(Token.Type.Do); 
    45814571 
    4582         Statement doBody = Statement.parse(t); 
     4572        Statement doBody = Statement.parse(t, false); 
    45834573 
    45844574        t = t.expect(Token.Type.While); 
     
    46154605                s.setContinuable(); 
    46164606                mBody.codeGen(s); 
     4607                s.closeUpvals(mCondition.mLocation.line); 
    46174608                s.patchContinuesToHere(); 
    46184609                InstRef* cond = mCondition.codeCondition(s); 
     
    47684759        } 
    47694760 
    4770         Statement forBody = Statement.parse(t); 
     4761        Statement forBody = Statement.parse(t, false); 
    47714762 
    47724763        return new ForStatement(location, forBody.mEndLocation, init, condition, increment, forBody); 
     
    47774768        s.pushScope(); 
    47784769            s.setBreakable(); 
    4779              
    4780             s.pushScope(); 
    4781                 s.setContinuable(); 
    4782  
    4783                 foreach(init; mInit) 
     4770            s.setContinuable(); 
     4771 
     4772            foreach(init; mInit) 
     4773            { 
     4774                if(init.isDecl) 
     4775                    init.decl.codeGen(s); 
     4776                else 
    47844777                { 
    4785                     if(init.isDecl) 
    4786                         init.decl.codeGen(s); 
    4787                     else 
    4788                     { 
    4789                         init.init.codeGen(s); 
    4790                         s.popToNothing(); 
    4791                     } 
    4792                 } 
    4793      
    4794                 InstRef* beginLoop = s.getLabel(); 
    4795      
    4796                 InstRef* cond; 
    4797                  
    4798                 if(mCondition) 
    4799                 { 
    4800                     cond = mCondition.codeCondition(s); 
    4801                     s.invertJump(cond); 
    4802                     s.patchTrueToHere(cond); 
    4803                 } 
    4804      
    4805                 mBody.codeGen(s); 
    4806      
    4807                 s.patchContinuesToHere(); 
    4808  
    4809                 if(s.scopeHasUpval()) 
    4810                     s.codeClose(mLocation.line); 
    4811  
    4812                 foreach(inc; mIncrement) 
    4813                 { 
    4814                     inc.codeGen(s); 
     4778                    init.init.codeGen(s); 
    48154779                    s.popToNothing(); 
    48164780                } 
    4817             s.popScope(mEndLocation.line); 
     4781            } 
     4782 
     4783            InstRef* beginLoop = s.getLabel(); 
     4784            InstRef* cond; 
     4785 
     4786            if(mCondition) 
     4787            { 
     4788                cond = mCondition.codeCondition(s); 
     4789                s.invertJump(cond); 
     4790                s.patchTrueToHere(cond); 
     4791            } 
     4792 
     4793            mBody.codeGen(s); 
     4794 
     4795            s.closeUpvals(mLocation.line); 
     4796            s.patchContinuesToHere(); 
     4797 
     4798            foreach(inc; mIncrement) 
     4799            { 
     4800                inc.codeGen(s); 
     4801                s.popToNothing(); 
     4802            } 
    48184803 
    48194804            s.codeJump(mEndLocation.line, beginLoop); 
     
    48994884    public override void codeGen(FuncState s) 
    49004885    { 
     4886        uint baseReg = s.nextRegister(); 
     4887        uint loIndex; 
     4888        uint hi; 
     4889        uint step; 
     4890 
    49014891        s.pushScope(); 
    49024892            s.setBreakable(); 
    49034893            s.setContinuable(); 
    4904  
    4905             uint baseReg = s.nextRegister(); 
    4906             uint loIndex; 
    4907             uint hi; 
    4908             uint step; 
    49094894 
    49104895            loIndex = s.nextRegister(); 
     
    49254910            InstRef* beginJump = s.makeFor(mLocation.line, baseReg); 
    49264911            InstRef* beginLoop = s.getLabel(); 
    4927  
    4928             s.pushScope(); 
    4929                 s.insertLocal(mIndex); 
    4930                 s.activateLocals(1); 
    4931                 mBody.codeGen(s); 
    4932             s.popScope(mEndLocation.line); 
     4912             
     4913            s.insertLocal(mIndex); 
     4914            s.activateLocals(1); 
     4915 
     4916            mBody.codeGen(s); 
     4917         
     4918            s.closeUpvals(mEndLocation.line); 
     4919            s.patchContinuesToHere(); 
    49334920 
    49344921            s.patchJumpToHere(beginJump); 
    49354922            delete beginJump; 
    49364923 
    4937             s.patchContinuesToHere(); 
    4938  
    49394924            InstRef* gotoBegin = s.makeForLoop(mEndLocation.line, baseReg); 
    49404925            s.patchJumpTo(gotoBegin, beginLoop); 
     
    49444929 
    49454930            s.patchBreaksToHere(); 
    4946  
    4947             s.popRegister(step); 
    4948             s.popRegister(hi); 
    4949             s.popRegister(loIndex); 
    49504931        s.popScope(mEndLocation.line); 
     4932 
     4933        s.popRegister(step); 
     4934        s.popRegister(hi); 
     4935        s.popRegister(loIndex); 
    49514936    } 
    49524937     
     
    51175102            InstRef* beginLoop = s.getLabel(); 
    51185103 
    5119             s.pushScope(); 
    5120                 foreach(Identifier i; mIndices) 
    5121                     s.insertLocal(i); 
    5122                      
    5123                 s.activateLocals(mIndices.length); 
    5124                 mBody.codeGen(s); 
    5125             s.popScope(mEndLocation.line); 
     5104            foreach(Identifier i; mIndices) 
     5105                s.insertLocal(i); 
     5106 
     5107            s.activateLocals(mIndices.length); 
     5108            mBody.codeGen(s); 
    51265109 
    51275110            s.patchJumpToHere(beginJump); 
    51285111            delete beginJump; 
    5129              
     5112 
     5113            s.closeUpvals(mEndLocation.line); 
    51305114            s.patchContinuesToHere(); 
    5131  
    51325115            s.codeI(mEndLocation.line, Op.Foreach, baseReg, mIndices.length); 
    51335116            InstRef* gotoBegin = s.makeJump(mEndLocation.line, Op.Je); 
     
    51385121             
    51395122            s.patchBreaksToHere(); 
    5140  
    5141             s.popRegister(control); 
    5142             s.popRegister(invState); 
    5143             s.popRegister(generator); 
    51445123        s.popScope(mEndLocation.line); 
     5124         
     5125        s.popRegister(control); 
     5126        s.popRegister(invState); 
     5127        s.popRegister(generator); 
    51455128    } 
    51465129     
     
    57785761                exp = new OpEqExp(location, location, Op.SubEq, exp, new IntExp(location, 1)); 
    57795762            } 
     5763            else if(t.type == Token.Type.OrOr) 
     5764                exp = OrOrExp.parse(t, exp); 
     5765            else if(t.type == Token.Type.AndAnd) 
     5766                exp = AndAndExp.parse(t, exp); 
    57805767        } 
    57815768 
     
    57875774    public static Expression[] parseArguments(ref Token* t) 
    57885775    { 
    5789         Expression[] args = new Expression[5]; 
    5790         uint i = 0; 
    5791  
    5792         void add(Expression arg) 
    5793         { 
    5794             if(i >= args.length) 
    5795                 args.length = args.length * 2; 
    5796  
    5797             args[i] = arg; 
    5798             i++; 
    5799         } 
    5800  
    5801         add(Expression.parse(t)); 
     5776        List!(Expression) args; 
     5777        args.add(Expression.parse(t)); 
    58025778 
    58035779        while(t.type == Token.Type.Comma) 
    58045780        { 
    58055781            t = t.nextToken; 
    5806             add(Expression.parse(t)); 
    5807         } 
    5808  
    5809         args.length = i; 
    5810         return args; 
     5782            args.add(Expression.parse(t)); 
     5783        } 
     5784 
     5785        return args.toArray(); 
    58115786    } 
    58125787 
     
    58555830    public void codeGen(FuncState s) 
    58565831    { 
    5857         assert(false, "unimplemented codeGen"); 
     5832        assert(false, "unimplemented codeGen: " ~ this.classinfo.name); 
    58585833    } 
    58595834 
    58605835    public InstRef* codeCondition(FuncState s) 
    58615836    { 
    5862         assert(false, "unimplemented codeCondition"); 
     5837        assert(false, "unimplemented codeCondition: " ~ this.classinfo.name); 
    58635838    } 
    58645839 
    58655840    public void checkToNothing() 
    58665841    { 
     5842        //REACHABLE? 
    58675843        throw new MDCompileException(mLocation, "Expression cannot exist on its own"); 
    58685844    } 
     
    59805956        t = t.expect(Token.Type.Assign); 
    59815957 
    5982         rhs = OrOrExp.parse(t); 
     5958        rhs = Expression.parse(t); 
    59835959 
    59845960        foreach(exp; lhs) 
     
    60165992    public override InstRef* codeCondition(FuncState s) 
    60175993    { 
     5994        //REACHABLE? 
    60185995        throw new MDCompileException(mLocation, "Assignments cannot be used as a condition"); 
    60195996    } 
     
    62876264    } 
    62886265 
    6289     public static Expression parse(ref Token* t
     6266    public static Expression parse(ref Token* t, Expression exp1 = null
    62906267    { 
    62916268        Location location = t.location; 
    62926269 
    6293         Expression exp1; 
    62946270        Expression exp2; 
    62956271 
    6296         exp1 = AndAndExp.parse(t); 
     6272        if(exp1 is null) 
     6273            exp1 = AndAndExp.parse(t); 
    62976274 
    62986275        while(t.type == Token.Type.OrOr) 
     
    63686345    } 
    63696346 
    6370     public static Expression parse(ref Token* t
     6347    public static Expression parse(ref Token* t, Expression exp1 = null
    63716348    { 
    63726349        Location location = t.location; 
    63736350 
    6374         Expression exp1; 
    63756351        Expression exp2; 
    63766352 
    6377         exp1 = OrExp.parse(t); 
     6353        if(exp1 is null) 
     6354            exp1 = OrExp.parse(t); 
    63786355 
    63796356        while(t.type == Token.Type.AndAnd) 
     
    81128089    } 
    81138090 
    8114     public InstRef* codeCondition(FuncState s) 
    8115     { 
    8116         return s.makeJump(mEndLocation.line, Op.Jmp); 
    8117     } 
    8118      
    81198091    public override bool isConstant() 
    81208092    { 
     
    81628134    } 
    81638135 
    8164     public InstRef* codeCondition(FuncState s) 
    8165     { 
    8166         return s.makeJump(mEndLocation.line, Op.Jmp, mValue); 
    8167     } 
    8168      
    81698136    public override bool isConstant() 
    81708137    { 
     
    82488215    } 
    82498216 
    8250     public InstRef* codeCondition(FuncState s) 
    8251     { 
    8252         uint temp = s.pushRegister(); 
    8253         codeGen(s); 
    8254         s.popMoveTo(mEndLocation.line, temp); 
    8255         s.codeR(mEndLocation.line, Op.IsTrue, 0, temp, 0); 
    8256         InstRef* ret = s.makeJump(mEndLocation.line, Op.Je); 
    8257         s.popRegister(temp); 
    8258         return ret; 
    8259     } 
    8260      
    82618217    public override bool isConstant() 
    82628218    { 
     
    82648220    } 
    82658221     
     8222    public override bool isTrue() 
     8223    { 
     8224        return (mValue != 0);    
     8225    } 
     8226 
    82668227    public override bool isChar() 
    82678228    { 
     
    83028263    } 
    83038264 
    8304     public InstRef* codeCondition(FuncState s) 
    8305     { 
    8306         uint temp = s.pushRegister(); 
    8307         codeGen(s); 
    8308         s.popMoveTo(mEndLocation.line, temp); 
    8309         s.codeR(mEndLocation.line, Op.IsTrue, 0, temp, 0); 
    8310         InstRef* ret = s.makeJump(mEndLocation.line, Op.Je); 
    8311         s.popRegister(temp); 
    8312         return ret; 
    8313     } 
    8314      
    83158265    public override bool isConstant() 
    83168266    { 
     
    83658315    } 
    83668316 
    8367     public InstRef* codeCondition(FuncState s) 
    8368     { 
    8369         throw new MDCompileException(mLocation, "Cannot use a float literal as a condition"); 
    8370     } 
    8371      
    83728317    public override bool isConstant() 
    83738318    { 
     
    84178362    } 
    84188363 
    8419     public InstRef* codeCondition(FuncState s) 
    8420     { 
    8421         throw new MDCompileException(mLocation, "Cannot use a string literal as a condition"); 
    8422     } 
    8423      
    84248364    public override bool isConstant() 
    84258365    { 
     
    85688508        s.pushTempReg(reg); 
    85698509    } 
     8510     
     8511    public override InstRef* codeCondition(FuncState s) 
     8512    { 
     8513        uint temp = s.nextRegister(); 
     8514        mExp.codeGen(s); 
     8515        s.popMoveTo(mEndLocation.line, temp); 
     8516        s.codeR(mEndLocation.line, Op.IsTrue, 0, temp, 0); 
     8517        InstRef* ret = s.makeJump(mEndLocation.line, Op.Je); 
     8518        return ret; 
     8519    } 
    85708520} 
    85718521 
     
    85908540        t = t.expect(Token.Type.LBrace); 
    85918541 
    8592         Expression[2][] fields = new Expression[2][2]; 
     8542        Expression[2][] fields = new Expression[2][8]; 
    85938543        uint i = 0; 
    85948544 
     
    86758625        t = t.expect(Token.Type.LBrace); 
    86768626 
    8677         Expression[2][] fields = new Expression[2][2]; 
     8627        Expression[2][] fields = new Expression[2][8]; 
    86788628        uint i = 0; 
    86798629 
     
    88268776    public override void codeGen(FuncState s) 
    88278777    { 
    8828         if(mFields.length > maxFields) 
     8778        if(mFields.length >= maxFields) 
    88298779            throw new MDCompileException(mLocation, "Array constructor has too many fields (more than %s)", maxFields); 
    88308780 
  • trunk/minid/regexplib.d

    r167 r172  
    183183        } 
    184184 
    185         protected MDRegexp newInstance(RegExp rxp) 
    186         { 
    187             MDRegexp n = newInstance(); 
    188             n.constructor(rxp); 
    189             return n; 
    190         } 
    191  
    192185        public int test(MDState s, uint numParams) 
    193186        { 
     
    218211            return 1; 
    219212        } 
    220  
     213         
    221214        public int pre(MDState s, uint numParams) 
    222215        { 
     
    302295            return mRegexp.match(n); 
    303296        } 
    304  
     297         
    305298        char[] pre() 
    306299        { 
  • trunk/minid/stringlib.d

    r140 r172  
    9898    int icompare(MDState s, uint numParams) 
    9999    { 
    100         char[] src1 = s.getContext!(char[]); 
    101         char[] src2 = s.getParam!(char[])(0); 
    102  
    103         s.push(s.safeCode(string.icmp(src1, src2))); 
     100        s.push(string.icmp(s.getContext!(char[]), s.getParam!(char[])(0))); 
    104101        return 1; 
    105102    } 
  • trunk/minid/types.d

    r170 r172  
    530530    { 
    531531        return (mType == Type.Null) || (mType == Type.Bool && mBool == false) || 
    532             (mType == Type.Int && mInt == 0) || (mType == Type.Float && mFloat == 0.0)
     532            (mType == Type.Int && mInt == 0) || (mType == Type.Float && mFloat == 0.0) || (mType == Type.Char && mChar != 0)
    533533    } 
    534534     
     
    986986        if(o1.mType == o2.mType) 
    987987            return o1.opCmp(o2); 
    988         else 
    989             throw new MDException("Attempting to compare unlike objects"); 
    990     } 
    991  
    992     public static int equals(MDObject o1, MDObject o2) 
    993     { 
    994         if(o1.mType == o2.mType) 
    995             return o1.opEquals(o2); 
    996988        else 
    997989            throw new MDException("Attempting to compare unlike objects"); 
  • trunk/test.d

    r168 r172  
    1616        MDFileLoader().addPath(`samples`); 
    1717 
    18         MDGlobalState().importModule("simple"); 
     18        MDGlobalState().importModule("tests.interpreter"); 
    1919    } 
    2020    catch(MDException e) 
  • trunk/tests/dummy.md

    r170 r172  
    11module tests.dummy; 
     2 
     3global XXX = 5; 
     4global YYY = 10;