Changeset 1223

Show
Ignore:
Timestamp:
07/12/08 14:05:38 (2 months ago)
Author:
asterite
Message:

Updated to DMD 1.033

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/descent.core/src/descent/core/compiler/IProblem.java

    r1222 r1223  
    683683    int WithoutThisCannotBeConstInvariant = 472; 
    684684    int CannotModifySymbol = 473; 
     685    int CannotCallPublicExportFunctionFromInvariant = 474; 
     686    int TemplateMemberFunctionNotAllowedInInterface = 475; 
     687    int ArgumentToTypeofIsNotAnExpression = 476; 
    685688 
    686689} 
  • trunk/descent.core/src/descent/internal/compiler/parser/ASTDmdNode.java

    r1203 r1223  
    815815                    } 
    816816                    if (!gotoL2) { 
    817                         arg = p.defaultArg.copy(); 
     817                        arg = p.defaultArg; 
     818                        arg = arg.copy(); 
    818819                        arguments.add(arg); 
    819820                        nargs++; 
     
    962963                if (tb.ty == Tsarray) { 
    963964                    TypeSArray ts = (TypeSArray) tb; 
    964                     Type ta = tb.next.arrayOf(context); 
     965                    Type ta = ts.next.arrayOf(context); 
    965966                    if (ts.size(arg.loc, context) == 0) { 
    966967                        arg = new NullExp(arg.loc); 
     
    20162017     
    20172018            if (ad != null 
    2018                     && !(t.ty == Tpointer && t.next.ty == Tstruct && ((TypeStruct) t.next).sym == ad) 
     2019                    && !(t.ty == Tpointer && t.nextOf().ty == Tstruct && ((TypeStruct) t.nextOf()).sym == ad) 
    20192020                    && !(t.ty == Tstruct && ((TypeStruct) t).sym == ad)) { 
    20202021                ClassDeclaration cd = ad.isClassDeclaration(); 
     
    20262027     
    20272028                        e1 = new DotVarExp(loc, e1, tcd.vthis); 
    2028                         e1 = e1.semantic(sc, context); 
     2029                        e1.type = tcd.vthis.type; 
     2030//                      e1 = e1.semantic(sc, context); 
    20292031     
    20302032                        // Skip over nested functions, and get the enclosing 
    20312033                        // class type. 
    2032                         Dsymbol s = tcd.toParent(); 
    2033                         while (s != null && s.isFuncDeclaration() != null) { 
     2034                        int n = 0; 
     2035                        Dsymbol s; 
     2036                        for(s = tcd.toParent(); s != null && s.isFuncDeclaration() != null; s = s.toParent()) { 
    20342037                            FuncDeclaration f = s.isFuncDeclaration(); 
    20352038                            if (f.vthis != null) { 
     2039                                n++; 
    20362040                                e1 = new VarExp(loc, f.vthis); 
    20372041                            } 
     
    20402044                        if (s != null && s.isClassDeclaration() != null) { 
    20412045                            e1.type = s.isClassDeclaration().type; 
     2046                            if (n > 1) { 
     2047                                e1 = e1.semantic(sc, context); 
     2048                            } 
     2049                        } else { 
     2050                            e1 = e1.semantic(sc, context); 
    20422051                        } 
    2043                         e1 = e1.semantic(sc, context); 
    20442052                        // goto L1; 
    20452053                        gotoL1 = true; 
  • trunk/descent.core/src/descent/internal/compiler/parser/ArrayLiteralExp.java

    r1201 r1223  
    2222            this.sourceElements = new Expressions(elements); 
    2323        } 
     24    } 
     25     
     26    public ArrayLiteralExp(Loc loc, Expression e) { 
     27        super(loc, TOK.TOKarrayliteral); 
     28        this.elements = new Expressions(); 
     29        this.elements.add(e); 
     30        this.sourceElements = new Expressions(elements); 
    2431    } 
    2532 
  • trunk/descent.core/src/descent/internal/compiler/parser/CallExp.java

    r1222 r1223  
    11package descent.internal.compiler.parser; 
    22 
    3 import melnorme.miscutil.tree.TreeVisitor; 
    4  
    5 import org.eclipse.core.runtime.Assert; 
    6  
    7 import descent.core.compiler.IProblem; 
    8 import descent.internal.compiler.parser.ast.IASTVisitor; 
    93import static descent.internal.compiler.parser.LINK.LINKd; 
    10  
    114import static descent.internal.compiler.parser.STC.STClazy; 
    12  
    135import static descent.internal.compiler.parser.Scope.CSXany_ctor; 
    146import static descent.internal.compiler.parser.Scope.CSXlabel; 
     
    2517import static descent.internal.compiler.parser.TOK.TOKtemplate; 
    2618import static descent.internal.compiler.parser.TOK.TOKthis; 
    27 import static descent.internal.compiler.parser.TOK.*
    28  
     19import static descent.internal.compiler.parser.TOK.TOKtype
     20import static descent.internal.compiler.parser.TOK.TOKvar; 
    2921import static descent.internal.compiler.parser.TY.Taarray; 
    3022import static descent.internal.compiler.parser.TY.Tarray; 
     
    3628import static descent.internal.compiler.parser.TY.Tstruct; 
    3729import static descent.internal.compiler.parser.TY.Tvoid; 
     30import melnorme.miscutil.tree.TreeVisitor; 
     31 
     32import org.eclipse.core.runtime.Assert; 
     33 
     34import descent.core.compiler.IProblem; 
     35import descent.internal.compiler.parser.ast.IASTVisitor; 
    3836 
    3937 
     
    414412                    ue.e1 = getRightThis(loc, sc, ad, ue.e1, f, context); 
    415413                } 
     414                 
     415                /* Cannot call public functions from inside invariant 
     416                 * (because then the invariant would have infinite recursion) 
     417                 */ 
     418                if (sc.func != null && sc.func.isInvariantDeclaration() != null && 
     419                    ue.e1.op == TOKthis && 
     420                    f.addPostInvariant(context) 
     421                   ) { 
     422                    if (context.acceptsErrors()) { 
     423                        context.acceptProblem(Problem.newSemanticTypeError(IProblem.CannotCallPublicExportFunctionFromInvariant, this, f.toChars(context))); 
     424                    } 
     425                } 
    416426 
    417427                checkDeprecated(sc, f, context); 
     
    463473                        return this; 
    464474                    } else { 
    465                         if (sc.noctor != 0 || (sc.callSuper & CSXlabel) != 0) { 
    466                             if (context.acceptsErrors()) { 
    467                                 context.acceptProblem(Problem.newSemanticTypeErrorLoc(IProblem.ConstructorCallsNotAllowedInLoopsOrAfterLabels, this)); 
     475                        if (0 == sc.intypeof) { 
     476                            if (sc.noctor != 0 || (sc.callSuper & CSXlabel) != 0) { 
     477                                if (context.acceptsErrors()) { 
     478                                    context.acceptProblem(Problem.newSemanticTypeErrorLoc(IProblem.ConstructorCallsNotAllowedInLoopsOrAfterLabels, this)); 
     479                                } 
    468480                            } 
    469                         } 
    470                         if ((sc.callSuper & (CSXsuper_ctor | CSXthis_ctor)) != 0) { 
    471                             if (context.acceptsErrors()) { 
    472                                 context.acceptProblem(Problem.newSemanticTypeError(IProblem.MultipleConstructorCalls, this)); 
     481                           if ((sc.callSuper & (CSXsuper_ctor | CSXthis_ctor)) != 0) { 
     482                               if (context.acceptsErrors()) { 
     483                                   context.acceptProblem(Problem.newSemanticTypeError(IProblem.MultipleConstructorCalls, this)); 
     484                                } 
    473485                            } 
    474                         } 
    475                         sc.callSuper |= CSXany_ctor | CSXsuper_ctor; 
     486                           sc.callSuper |= CSXany_ctor | CSXsuper_ctor; 
     487                        } 
    476488 
    477489                        f = f.overloadResolve(loc, null, arguments, context, this); 
     
    496508                    return this; 
    497509                } else { 
    498                     if (sc.noctor != 0 || (sc.callSuper & CSXlabel) != 0) { 
    499                         if (context.acceptsErrors()) { 
    500                             context.acceptProblem(Problem.newSemanticTypeError(IProblem.ConstructorCallsNotAllowedInLoopsOrAfterLabels, getLineNumber(), getErrorStart(), getErrorLength())); 
    501                         } 
    502                     } 
    503                     if ((sc.callSuper & (CSXsuper_ctor | CSXthis_ctor)) != 0) { 
    504                         if (context.acceptsErrors()) { 
    505                             context.acceptProblem(Problem.newSemanticTypeError(IProblem.MultipleConstructorCalls, this)); 
    506                         } 
    507                     } 
    508                     sc.callSuper |= CSXany_ctor | CSXthis_ctor; 
     510                    if (0 == sc.intypeof) 
     511                    { 
     512                        if (sc.noctor != 0 || (sc.callSuper & CSXlabel) != 0) { 
     513                            if (context.acceptsErrors()) { 
     514                                context.acceptProblem(Problem.newSemanticTypeError(IProblem.ConstructorCallsNotAllowedInLoopsOrAfterLabels, getLineNumber(), getErrorStart(), getErrorLength())); 
     515                            } 
     516                        } 
     517                        if ((sc.callSuper & (CSXsuper_ctor | CSXthis_ctor)) != 0) { 
     518                            if (context.acceptsErrors()) { 
     519                                context.acceptProblem(Problem.newSemanticTypeError(IProblem.MultipleConstructorCalls, this)); 
     520                            } 
     521                        } 
     522                        sc.callSuper |= CSXany_ctor | CSXthis_ctor; 
     523                    } 
    509524 
    510525                    f = cd.ctor; 
  • trunk/descent.core/src/descent/internal/compiler/parser/CompileDeclaration.java

    r1201 r1223  
    1616    public Expression exp, sourceExp; 
    1717    public ScopeDsymbol sd; 
     18    public boolean compiled; 
    1819     
    1920    protected IInitializer javaElement; 
     
    4041            SemanticContext context) { 
    4142        this.sd = sd; 
     43        if (memnum == 0) { 
     44            /* 
     45             * No members yet, so parse the mixin now 
     46             */ 
     47            compileIt(sc, context); 
     48            memnum |= super.addMember(sc, sd, memnum, context); 
     49            compiled = true; 
     50        } 
    4251        return memnum; 
     52    } 
     53     
     54    public void compileIt(Scope sc, SemanticContext context) { 
     55        exp = exp.semantic(sc, context); 
     56        exp = resolveProperties(sc, exp, context); 
     57        exp = exp.optimize(WANTvalue | WANTinterpret, context); 
     58        if (exp.op != TOKstring) { 
     59            if (context.acceptsErrors()) { 
     60                context.acceptProblem(Problem.newSemanticTypeError(IProblem.ArgumentToMixinMustBeString, this, exp.toChars(context))); 
     61            } 
     62        } 
     63        else 
     64        { 
     65            StringExp se = (StringExp) exp; 
     66            se = se.toUTF8(sc, context); 
     67            Parser p = new Parser(context.Module_rootModule.apiLevel, se.string); 
     68            // p.nextToken(); 
     69            p.loc = loc; 
     70            decl = p.parseModule(); 
     71            for(Dsymbol s : decl) { 
     72                s.accept(new AstVisitorAdapter() { 
     73                    @Override 
     74                    public void preVisit(ASTNode node) { 
     75                        if (node instanceof ASTDmdNode) { 
     76                            ASTDmdNode s = (ASTDmdNode) node; 
     77                            s.synthetic = true; 
     78                            s.setStart(getStart() + 1); 
     79                            s.setLength(getLength()); 
     80                            s.setLineNumber(getLineNumber());                    
     81                            s.creator = CompileDeclaration.this; 
     82                        } 
     83                    } 
     84                }); 
     85            } 
     86 
     87            // TODO semantic do this better 
     88            if (p.problems != null) { 
     89                for (int i = 0; i < p.problems.size(); i++) { 
     90                    Problem problem = (Problem) p.problems.get(i); 
     91                    problem.setSourceStart(start); 
     92                    problem.setSourceEnd(start + length - 1); 
     93                    context.acceptProblem(problem); 
     94                } 
     95            } 
     96 
     97            if (p.token.value != TOKeof) { 
     98                if (context.acceptsErrors()) { 
     99                    context.acceptProblem(Problem.newSemanticTypeError( 
     100                            IProblem.IncompleteMixinDeclaration, this, 
     101                            new String[] { se.toChars(context) })); 
     102                } 
     103            } 
     104        } 
    43105    } 
    44106 
     
    50112    @Override 
    51113    public void semantic(Scope sc, SemanticContext context) { 
    52         exp = exp.semantic(sc, context); 
    53         exp = resolveProperties(sc, exp, context); 
    54         exp = exp.optimize(WANTvalue | WANTinterpret, context); 
    55         if (exp.op != TOKstring) { 
    56             if (context.acceptsErrors()) { 
    57                 context.acceptProblem(Problem.newSemanticTypeError(IProblem.ArgumentToMixinMustBeString, this, exp.toChars(context))); 
    58             } 
    59             return; 
     114        if (!compiled) { 
     115            compileIt(sc, context); 
     116            super.addMember(sc, sd, 0, context); 
     117            compiled = true; 
    60118        } 
    61         StringExp se = (StringExp) exp; 
    62         se = se.toUTF8(sc, context); 
    63         Parser p = new Parser(context.Module_rootModule.apiLevel, se.string); 
    64         // p.nextToken(); 
    65         p.loc = loc; 
    66         decl = p.parseModule(); 
    67         for(Dsymbol s : decl) { 
    68             s.accept(new AstVisitorAdapter() { 
    69                 @Override 
    70                 public void preVisit(ASTNode node) { 
    71                     if (node instanceof ASTDmdNode) { 
    72                         ASTDmdNode s = (ASTDmdNode) node; 
    73                         s.synthetic = true; 
    74                         s.setStart(getStart() + 1); 
    75                         s.setLength(getLength()); 
    76                         s.setLineNumber(getLineNumber());                    
    77                         s.creator = CompileDeclaration.this; 
    78                     } 
    79                 } 
    80             }); 
    81         } 
    82  
    83         // TODO semantic do this better 
    84         if (p.problems != null) { 
    85             for (int i = 0; i < p.problems.size(); i++) { 
    86                 Problem problem = (Problem) p.problems.get(i); 
    87                 problem.setSourceStart(start); 
    88                 problem.setSourceEnd(start + length - 1); 
    89                 context.acceptProblem(problem); 
    90             } 
    91         } 
    92  
    93         if (p.token.value != TOKeof) { 
    94             if (context.acceptsErrors()) { 
    95                 context.acceptProblem(Problem.newSemanticTypeError( 
    96                         IProblem.IncompleteMixinDeclaration, this, 
    97                         new String[] { se.toChars(context) })); 
    98             } 
    99         } 
    100  
    101         super.addMember(sc, sd, 0, context); 
    102119        super.semantic(sc, context); 
    103120    } 
  • trunk/descent.core/src/descent/internal/compiler/parser/CompileStatement.java

    r1201 r1223  
    11package descent.internal.compiler.parser; 
    22 
    3 import melnorme.miscutil.tree.TreeVisitor; 
    4 import descent.core.compiler.IProblem; 
    5 import descent.internal.compiler.parser.ast.ASTNode; 
    6 import descent.internal.compiler.parser.ast.AstVisitorAdapter; 
    7 import descent.internal.compiler.parser.ast.IASTVisitor; 
    83import static descent.internal.compiler.parser.Parser.PScurlyscope; 
    94import static descent.internal.compiler.parser.Parser.PSsemi; 
    105import static descent.internal.compiler.parser.TOK.TOKeof; 
     6import melnorme.miscutil.tree.TreeVisitor; 
     7import descent.core.compiler.IProblem; 
     8import descent.internal.compiler.parser.ast.IASTVisitor; 
    119 
    1210 
     
    3533 
    3634    @Override 
    37     public Statement semantic(Scope sc, SemanticContext context) { 
     35    public Statements flatten(Scope sc, SemanticContext context) { 
    3836        exp = exp.semantic(sc, context); 
    3937        exp = ASTDmdNode.resolveProperties(sc, exp, context); 
     
    4442                context.acceptProblem(Problem.newSemanticTypeError(IProblem.ArgumentToMixinMustBeString, this, exp.toChars(context))); 
    4543            } 
    46             return this
     44            return null
    4745        } 
    4846        StringExp se = (StringExp) exp; 
     
    5149        p.loc = loc; 
    5250 
    53         Statements statements = new Statements(); 
     51        Statements a = new Statements(); 
    5452        while (p.token.value != TOKeof) { 
    5553            Statement s = p.parseStatement(PSsemi | PScurlyscope); 
     
    7068//          }); 
    7169             
    72             statements.add(s); 
     70            a.add(s); 
    7371        } 
    7472         
     
    8381        } 
    8482 
    85         Statement s = new CompoundStatement(loc, statements); 
    86         return s.semantic(sc, context); 
     83        return a; 
     84    } 
     85     
     86    @Override 
     87    public Statement semantic(Scope sc, SemanticContext context) { 
     88        Statements a = flatten(sc, context); 
     89        if (null == a) { 
     90            return null; 
     91        } 
     92        Statement s = new CompoundStatement(loc, a); 
     93        return s.semantic(sc, context); 
    8794    } 
    8895 
  • trunk/descent.core/src/descent/internal/compiler/parser/CompoundStatement.java

    r1201 r1223  
    248248        } 
    249249        if (statements != null && statements.size() == 1) { 
    250             return s
     250            return statements.get(0)
    251251        } 
    252252        return this; 
  • trunk/descent.core/src/descent/internal/compiler/parser/ConditionalStatement.java

    r1201 r1223  
    8181        condition.toCBuffer(buf, hgs, context); 
    8282        buf.writenl(); 
     83        buf.writeByte('{'); 
     84        buf.writenl(); 
    8385        if (ifbody != null) { 
    8486            ifbody.toCBuffer(buf, hgs, context); 
    8587        } 
     88        buf.writeByte('}'); 
     89        buf.writenl(); 
    8690        if (elsebody != null) { 
    8791            buf.writestring("else"); 
    8892            buf.writenl(); 
     93            buf.writeByte('{'); 
     94            buf.writenl(); 
    8995            elsebody.toCBuffer(buf, hgs, context); 
     96            buf.writeByte('}'); 
     97            buf.writenl(); 
    9098        } 
    9199        buf.writenl(); 
  • trunk/descent.core/src/descent/internal/compiler/parser/Constfold.java

    r1201 r1223  
    875875            } 
    876876 
    877             else if (e1.op == TOKarrayliteral 
     877            else if ((e1.op == TOKarrayliteral || e1.op == TOKnull) 
    878878                    && e1.type.toBasetype(context).nextOf().equals(e2.type)) { 
    879                 ArrayLiteralExp es1 = (ArrayLiteralExp) e1; 
    880  
    881                 ArrayLiteralExp ale = new ArrayLiteralExp(es1.loc, 
    882                         new Expressions(es1.elements.size() + 1)); 
    883                 ale.elements.addAll(es1.elements); 
    884                 ale.elements.add(e2); 
    885                 e = ale; 
     879                ArrayLiteralExp es1; 
     880                if (e1.op == TOKarrayliteral) { 
     881                    es1 = (ArrayLiteralExp) e1; 
     882                    es1 = new ArrayLiteralExp(es1.loc, es1.elements.copy()); 
     883                    es1.elements.add(e2); 
     884                } else { 
     885                     es1 = new ArrayLiteralExp(e1.loc, e2); 
     886                } 
     887                e = es1; 
    886888 
    887889                if (type.toBasetype(context).ty == Tsarray) { 
  • trunk/descent.core/src/descent/internal/compiler/parser/CtorDeclaration.java

    r1201 r1223  
    8989        } 
    9090        type = new TypeFunction(arguments, tret, varargs, LINK.LINKd); 
     91         
     92        if (null == originalType) { 
     93            originalType = type; 
     94        } 
    9195 
    9296        sc.flags |= Scope.SCOPEctor; 
  • trunk/descent.core/src/descent/internal/compiler/parser/DotVarExp.java

    r1203 r1223  
    127127                        .isAggregateDeclaration(); 
    128128                e1 = getRightThis(loc, sc, ad, e1, var, context); 
    129                 accessCheck(sc, e1, var, context, ident); 
     129                if (0 == sc.noaccesscheck) { 
     130                    accessCheck(sc, e1, var, context, ident); 
     131                } 
     132                 
     133                VarDeclaration v = var.isVarDeclaration(); 
     134                if (v != null && v.isConst()) { 
     135                    ExpInitializer ei = v.getExpInitializer(context); 
     136                    if (ei != null) { 
     137                        Expression e = ei.exp.copy(); 
     138                        e = e.semantic(sc, context); 
     139                        return e; 
     140                    } 
     141                } 
    130142            } 
    131143        } 
  • trunk/descent.core/src/descent/internal/compiler/parser/Dsymbol.java

    r1203 r1223  
    11package descent.internal.compiler.parser; 
     2 
     3import static descent.internal.compiler.parser.STC.STCdeprecated; 
    24 
    35import org.eclipse.core.runtime.Assert; 
     
    79import descent.core.compiler.IProblem; 
    810import descent.internal.compiler.parser.ast.IASTVisitor; 
    9  
    1011 
    1112public class Dsymbol extends ASTDmdNode { 
     
    138139                    return; 
    139140                } 
     141                 
     142                // If inside a StorageClassDeclaration that is deprecated 
     143                if ((sc.stc & STCdeprecated) != 0) { 
     144                    return; 
     145                } 
    140146            } 
    141147 
     
    476482    } 
    477483 
     484    /** 
     485     * Search for ident as member of s. 
     486     * Input: 
     487     *  flags:  1   don't find private members 
     488     *      2   don't give error messages 
     489     *      4   return NULL if ambiguous 
     490     * Returns: 
     491     *  NULL if not found 
     492     */ 
    478493    public final Dsymbol search(Loc loc, IdentifierExp ident, int flags, 
    479494            SemanticContext context) { 
     
    481496    } 
    482497 
     498    /** 
     499     * Search for ident as member of s. 
     500     * Input: 
     501     *  flags:  1   don't find private members 
     502     *      2   don't give error messages 
     503     *      4   return NULL if ambiguous 
     504     * Returns: 
     505     *  NULL if not found 
     506     */ 
    483507    public Dsymbol searchX(Loc loc, Scope sc, IdentifierExp id, 
    484508            SemanticContext context) { 
     
    565589    public String toChars(SemanticContext context) { 
    566590        return (this.ident != null && this.ident.ident != null) ? this.ident.toChars() : "__anonymous"; 
     591    } 
     592     
     593    public TemplateInstance inTemplateInstance() { 
     594        for (Dsymbol parent = this.parent; parent != null; parent = parent.parent) { 
     595            TemplateInstance ti = parent.isTemplateInstance(); 
     596            if (ti != null) 
     597                return ti; 
     598        } 
     599        return null; 
    567600    } 
    568601 
  • trunk/descent.core/src/descent/internal/compiler/parser/EnumDeclaration.java

    r1203 r1223  
    11package descent.internal.compiler.parser; 
     2 
     3import static descent.internal.compiler.parser.STC.STCdeprecated; 
    24 
    35import java.math.BigInteger; 
     
    911import descent.core.compiler.IProblem; 
    1012import descent.internal.compiler.parser.ast.IASTVisitor; 
    11  
    1213 
    1314public class EnumDeclaration extends ScopeDsymbol { 
     
    2728    public integer_t minval; 
    2829    public integer_t defaultval; // default initializer 
     30    public boolean isdeprecated; 
    2931     
    3032    private IType javaElement; 
     
    6365        return type; 
    6466    } 
     67     
     68    @Override 
     69    public boolean isDeprecated() { 
     70        return isdeprecated; 
     71    } 
    6572 
    6673    @Override 
     
    99106        if (memtype == null) { 
    100107            memtype = Type.tint32; 
     108        } 
     109         
     110        if ((sc.stc & STCdeprecated) != 0) { 
     111            isdeprecated = true; 
    101112        } 
    102113 
  • trunk/descent.core/src/descent/internal/compiler/parser/Expression.java

    r1201 r1223  
    127127     
    128128    public boolean canThrow() { 
    129         return false; 
     129        return true; 
    130130    } 
    131131 
     
    253253                e = new AddrExp(loc, this); 
    254254            } 
    255             e.type = tb.next.pointerTo(context); 
     255            e.type = ts.next.pointerTo(context); 
    256256        } 
    257257        return e; 
     
    460460                        new String[] { toChars(context) })); 
    461461            } 
     462            type = Type.tint32; 
    462463        } 
    463464    } 
  • trunk/descent.core/src/descent/internal/compiler/parser/FuncDeclaration.java

    r1222 r1223  
    5757import descent.core.compiler.CharOperation; 
    5858import descent.core.compiler.IProblem; 
    59 import descent.internal.compiler.lookup.LazyClassDeclaration; 
    60 import descent.internal.compiler.lookup.LazyInterfaceDeclaration; 
    6159import descent.internal.compiler.parser.ast.IASTVisitor; 
    6260import descent.internal.core.util.Util; 
     
    10021000        ClassDeclaration cd = null; 
    10031001        InterfaceDeclaration id = null; 
     1002        Dsymbol pd; 
    10041003        int nparams = 0; 
    10051004 
     
    11671166                } 
    11681167            } 
     1168        } 
     1169         
     1170        /* Template member functions aren't virtual: 
     1171         *   interface TestInterface { void tpl(T)(); } 
     1172         * and so won't work in interfaces 
     1173         */ 
     1174        if ((pd = toParent()) != null && pd.isTemplateInstance() != null 
     1175                && (pd = toParent2()) != null 
     1176                && (id = pd.isInterfaceDeclaration()) != null) { 
     1177            if (context.acceptsErrors()) { 
     1178                context.acceptProblem(Problem.newSemanticTypeError(IProblem.TemplateMemberFunctionNotAllowedInInterface, this, id.toString())); 
     1179            } 
    11691180        } 
    11701181 
     
    20722083            } 
    20732084 
    2074             boolean offend = fbody != null ? fbody.fallOffEnd(context) : true; 
     2085            boolean offend = fbody != null ? (fbody.blockExit(context) & BEfallthru) != 0: true; 
    20752086 
    20762087            if (isStaticCtorDeclaration() != null) { 
  • trunk/descent.core/src/descent/internal/compiler/parser/FuncLiteralDeclaration.java