Changeset 1226

Show
Ignore:
Timestamp:
07/12/08 19:38:24 (3 months ago)
Author:
asterite
Message:

Added const and invariant decorations to fields, methods, types and local variables.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/descent.core/src/descent/internal/compiler/parser/ASTDmdNode.java

    r1223 r1226  
    12041204    public static void arrayExpressionScanForNestedRef(Scope sc, Expressions a, 
    12051205            SemanticContext context) { 
    1206         if (null == a) { 
     1206        if (null != a) { 
    12071207            for (int i = 0; i < a.size(); i++) { 
    12081208                Expression e = a.get(i); 
     
    13271327            SemanticContext context) { 
    13281328        if (t.ty == Ttuple) { 
    1329             ScopeDsymbol sym = new ArrayScopeSymbol((TypeTuple) t); 
     1329            ScopeDsymbol sym = new ArrayScopeSymbol(sc, (TypeTuple) t); 
    13301330            sym.parent = sc.scopesym; 
    13311331            sc = sc.push(sym); 
     
    13421342    public static Expression semanticLength(Scope sc, TupleDeclaration s, 
    13431343            Expression exp, SemanticContext context) { 
    1344         ScopeDsymbol sym = new ArrayScopeSymbol(s); 
     1344        ScopeDsymbol sym = new ArrayScopeSymbol(sc, s); 
    13451345        sym.parent = sc.scopesym; 
    13461346        sc = sc.push(sym); 
     
    19581958    public static Expression eval_builtin(BUILTIN builtin, 
    19591959            Expressions arguments, SemanticContext context) { 
     1960        if (size(arguments) == 0) { 
     1961            return null; 
     1962        } 
     1963         
    19601964        Expression arg0 = arguments.get(0); 
    19611965        Expression e = null; 
  • trunk/descent.core/src/descent/internal/compiler/parser/ASTNodeEncoder.java

    r1199 r1226  
    1515     
    1616    private Parser parser; 
     17    private final int apiLevel; 
    1718    private Parser initParser(char[] source) { 
    1819        if (parser == null) { 
    19             parser = new Parser(source, 0, source.length, false, false, false, false, Parser.DEFAULT_LEVEL, null, null, false, null); 
     20            parser = new Parser(source, 0, source.length, false, false, false, false, apiLevel, null, null, false, null); 
    2021        } else { 
    2122            parser.reset(source, 0, source.length, false, false, false, false); 
     
    2526    } 
    2627     
    27     public ASTNodeEncoder() { 
    28          
     28    public ASTNodeEncoder(int apiLevel) { 
     29        this.apiLevel = apiLevel;       
    2930    } 
    3031     
  • trunk/descent.core/src/descent/internal/compiler/parser/ArrayScopeSymbol.java

    r1185 r1226  
    2424    public TupleDeclaration td; // for tuples of objects 
    2525    public Scope sc; 
    26  
    27     public ArrayScopeSymbol(Expression e) { 
    28         this(null, e); 
    29     } 
    3026     
    3127    public ArrayScopeSymbol(Scope sc, Expression e) { 
     
    3329        this.exp = e; 
    3430        this.sc = sc; 
    35     } 
    36  
    37     public ArrayScopeSymbol(TupleDeclaration s) { 
    38         this(null, s); 
     31        if (sc == null) { 
     32            System.out.println(123456); 
     33        } 
    3934    } 
    4035     
     
    4439        this.td = s; 
    4540        this.sc = sc; 
    46     } 
    47  
    48     public ArrayScopeSymbol(TypeTuple t) { 
    49         this(null, t); 
     41        if (sc == null) { 
     42            System.out.println(123456); 
     43        } 
    5044    } 
    5145     
     
    204198                } 
    205199                 
    206                 if (context.isD2()) { 
    207                     pvar.semantic(sc, context); 
    208                 } 
    209                  
    210200                // TODO semantic I think this logic is ok 
    211201                // return *pvar; 
    212202                if (pvar instanceof IndexExp) { 
     203                    if (context.isD2()) { 
     204                        ((IndexExp) pvar).lengthVar.semantic(sc, context); 
     205                    } 
    213206                    return ((IndexExp) pvar).lengthVar; 
    214207                } else { 
     208                    if (context.isD2()) { 
     209                        ((SliceExp) pvar).lengthVar.semantic(sc, context); 
     210                    } 
    215211                    return ((SliceExp) pvar).lengthVar; 
    216212                } 
  • trunk/descent.core/src/descent/internal/compiler/parser/CastExp.java

    r1201 r1226  
    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.IASTVisitor; 
    63import static descent.internal.compiler.parser.Constfold.Cast; 
    74import static descent.internal.compiler.parser.TOK.TOKarrayliteral; 
    85import static descent.internal.compiler.parser.TOK.TOKcall; 
     6import static descent.internal.compiler.parser.TOK.TOKconst; 
     7import static descent.internal.compiler.parser.TOK.TOKinvariant; 
    98import static descent.internal.compiler.parser.TOK.TOKnull; 
    109import static descent.internal.compiler.parser.TOK.TOKstring; 
    1110import static descent.internal.compiler.parser.TOK.TOKsymoff; 
    1211import static descent.internal.compiler.parser.TOK.TOKvar; 
    13  
    1412import static descent.internal.compiler.parser.TY.Tarray; 
    1513import static descent.internal.compiler.parser.TY.Tclass; 
     
    1816import static descent.internal.compiler.parser.TY.Tstruct; 
    1917import static descent.internal.compiler.parser.TY.Tvoid; 
     18import melnorme.miscutil.tree.TreeVisitor; 
     19import descent.core.compiler.IProblem; 
     20import descent.internal.compiler.parser.ast.IASTVisitor; 
    2021 
    2122 
     
    184185        { 
    185186            e1 = resolveProperties(sc, e1, context); 
    186             to = to.semantic(loc, sc, context); 
     187             
     188            /* Handle cast(const) and cast(invariant) 
     189             */ 
     190            if (null == to) { 
     191                if (tok == TOKconst) { 
     192                    to = e1.type.constOf(context); 
     193                } else if (tok == TOKinvariant) { 
     194                    to = e1.type.invariantOf(context); 
     195                } else { 
     196                    throw new IllegalStateException("assert(0);"); 
     197                } 
     198            } else { 
     199                to = to.semantic(loc, sc, context); 
     200            } 
    187201 
    188202            e = op_overload(sc, context); 
  • trunk/descent.core/src/descent/internal/compiler/parser/IndexExp.java

    r1201 r1226  
    130130        if (t1.ty == TY.Tsarray || t1.ty == TY.Tarray || t1.ty == TY.Ttuple) { 
    131131            // Create scope for 'length' variable 
    132             sym = new ArrayScopeSymbol(this); 
     132            sym = new ArrayScopeSymbol(sc, this); 
    133133            sym.loc = loc; 
    134134            sym.parent = sc.scopesym; 
  • trunk/descent.core/src/descent/internal/compiler/parser/Lexer.java

    r1194 r1226  
    274274            int apiLevel, char[] filename) { 
    275275        this(source, offset, length, tokenizeComments, tokenizePragmas, 
    276                 tokenizeWhiteSpace, recordLineSeparator, apiLevel, filename, new ASTNodeEncoder()); 
     276                tokenizeWhiteSpace, recordLineSeparator, apiLevel, filename, new ASTNodeEncoder(apiLevel)); 
    277277    } 
    278278 
  • trunk/descent.core/src/descent/internal/compiler/parser/Parser.java

    r1222 r1226  
    203203    public Parser(int apiLevel, char[] source, int offset,  
    204204            int length, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive, char[] filename) { 
    205         this(apiLevel, source, offset, length, taskTags, taskPriorities, isTaskCaseSensitive, filename, new ASTNodeEncoder()); 
     205        this(apiLevel, source, offset, length, taskTags, taskPriorities, isTaskCaseSensitive, filename, new ASTNodeEncoder(apiLevel)); 
    206206    } 
    207207     
    208208    public Parser(int apiLevel, char[] source, int offset,  
    209209            int length, char[][] taskTags, char[][] taskPriorities, boolean recordLineSeparator, boolean isTaskCaseSensitive, char[] filename) { 
    210         this(apiLevel, source, offset, length, taskTags, taskPriorities, recordLineSeparator, isTaskCaseSensitive, filename, new ASTNodeEncoder()); 
     210        this(apiLevel, source, offset, length, taskTags, taskPriorities, recordLineSeparator, isTaskCaseSensitive, filename, new ASTNodeEncoder(apiLevel)); 
    211211    } 
    212212     
     
    236236        this(source, offset, length, tokenizeComments, tokenizePragmas, 
    237237                tokenizeWhiteSpace, recordLineSeparator, apiLevel, 
    238                 taskTags, taskPriorities, isTaskCaseSensitive, filename, new ASTNodeEncoder()); 
     238                taskTags, taskPriorities, isTaskCaseSensitive, filename, new ASTNodeEncoder(apiLevel)); 
    239239    } 
    240240     
     
    28612861            t = parseType(); 
    28622862            check(TOKrparen); 
     2863            if (t == null) { 
     2864                System.out.println(123456); 
     2865            } 
    28632866            t = t.makeInvariant(start, prevToken.ptr + prevToken.sourceLen - start); 
    28642867            break; 
  • trunk/descent.core/src/descent/internal/compiler/parser/SliceExp.java

    r1201 r1226  
    199199 
    200200        if (t.ty == TY.Tsarray || t.ty == TY.Tarray || t.ty == TY.Ttuple) { 
    201             sym = new ArrayScopeSymbol(this); 
     201            sym = new ArrayScopeSymbol(sc, this); 
    202202            sym.loc = loc; 
    203203            sym.parent = sc.scopesym; 
  • trunk/descent.core/src/descent/internal/compiler/parser/Type.java

    r1223 r1226  
    502502    public Type rto; // reference to this type 
    503503    public Type arrayof; // array of this type 
    504     public Object vtinfo; 
    505504     
    506505    /* 
     
    742741            t.cto = null; 
    743742            t.ito = null; 
    744             t.vtinfo = null; 
    745743//          if (ty == Tsarray) { 
    746744//              TypeSArray ta = (TypeSArray) t; 
     
    13201318            if (context.isD2()) { 
    13211319                if (t.isConst()) { 
    1322                     t.vtinfo = new TypeInfoConstDeclaration(t, context); 
     1320                    vtinfo = new TypeInfoConstDeclaration(t, context); 
    13231321                } else if (t.isInvariant()) { 
    1324                     t.vtinfo = new TypeInfoInvariantDeclaration(t, context); 
     1322                    vtinfo = new TypeInfoInvariantDeclaration(t, context); 
    13251323                } else { 
    1326                     t.vtinfo = t.getTypeInfoDeclaration(context); 
     1324                    vtinfo = t.getTypeInfoDeclaration(context); 
    13271325                } 
    13281326            } else { 
  • trunk/descent.core/src/descent/internal/compiler/parser/TypeSArray.java

    r1201 r1226  
    232232            TupleDeclaration td = s.isTupleDeclaration(); 
    233233            if (null != td) { 
    234                 ScopeDsymbol sym = new ArrayScopeSymbol(td); 
     234                ScopeDsymbol sym = new ArrayScopeSymbol(sc, td); 
    235235                sym.parent = sc.scopesym; 
    236236                sc = sc.push(sym); 
  • trunk/descent.core/src/descent/internal/compiler/parser/TypeSlice.java

    r1201 r1226  
    6161                 * It's a slice of a TupleDeclaration 
    6262                 */ 
    63                 ScopeDsymbol sym = new ArrayScopeSymbol(td); 
     63                ScopeDsymbol sym = new ArrayScopeSymbol(sc, td); 
    6464                sym.parent = sc.scopesym; 
    6565                sc = sc.push(sym); 
  • trunk/descent.core/src/descent/internal/core/builder/JavaBuilder.java

    r1141 r1226  
    4747            fullBuild(project, monitor); 
    4848        } else { 
    49             delta.accept(new JavaBuilderVisitor(isShowSemanticErrors())); 
     49            IJavaProject javaProject = JavaCore.create(project); 
     50            delta.accept(new JavaBuilderVisitor(javaProject.getApiLevel(), isShowSemanticErrors())); 
    5051        } 
    5152        return null; 
     
    5556        IJavaProject javaProject = JavaCore.create(project); 
    5657        IResource[] members = project.members(); 
    57         build(javaProject, isShowSemanticErrors(), members, new ASTNodeEncoder(), monitor); 
     58        build(javaProject, isShowSemanticErrors(), members, new ASTNodeEncoder(javaProject.getApiLevel()), monitor); 
    5859    } 
    5960     
     
    7273    private class JavaBuilderVisitor implements IResourceDeltaVisitor { 
    7374         
    74         ASTNodeEncoder encoder = new ASTNodeEncoder()
    75         boolean showSemanticErrors
    76          
    77         public JavaBuilderVisitor(boolean showSemanticErrors) { 
     75        private final boolean showSemanticErrors
     76        private final ASTNodeEncoder encoder
     77         
     78        public JavaBuilderVisitor(int apiLevel, boolean showSemanticErrors) { 
    7879            this.showSemanticErrors = showSemanticErrors; 
     80            this.encoder = new ASTNodeEncoder(apiLevel); 
    7981        } 
    8082 
  • trunk/descent.tests/descent/tests/mangling/SignatureToTemplateParameter_Test.java

    r1194 r1226  
    11package descent.tests.mangling; 
    22 
     3import descent.core.dom.AST; 
    34import descent.internal.compiler.parser.ASTNodeEncoder; 
    45import descent.internal.compiler.parser.IntegerExp; 
     
    1415    public void testTuple() { 
    1516        TemplateTupleParameter param = (TemplateTupleParameter)  
    16             InternalSignature.toTemplateParameter("" + TEMPLATE_TUPLE_PARAMETER, null, new ASTNodeEncoder()); 
     17            InternalSignature.toTemplateParameter("" + TEMPLATE_TUPLE_PARAMETER, null, new ASTNodeEncoder(AST.D1)); 
    1718        assertNull(param.ident); 
    1819    } 
     
    2021    public void testAlias() { 
    2122        TemplateAliasParameter param = (TemplateAliasParameter)  
    22             InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER, null, new ASTNodeEncoder()); 
     23            InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER, null, new ASTNodeEncoder(AST.D1)); 
    2324        assertNull(param.ident); 
    2425        assertNull(param.specAliasT); 
     
    2829    public void testAliasDefaultValue() { 
    2930        TemplateAliasParameter param = (TemplateAliasParameter)  
    30             InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER, "i", new ASTNodeEncoder()); 
     31            InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER, "i", new ASTNodeEncoder(AST.D1)); 
    3132        assertNull(param.ident); 
    3233        assertNull(param.specAliasT); 
     
    3637    public void testAliasSpecificType() { 
    3738        TemplateAliasParameter param = (TemplateAliasParameter)  
    38             InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER + TEMPLATE_ALIAS_PARAMETER2 + i, null, new ASTNodeEncoder()); 
     39            InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER + TEMPLATE_ALIAS_PARAMETER2 + i, null, new ASTNodeEncoder(AST.D1)); 
    3940        assertNull(param.ident); 
    4041        assertSame(Type.tint32, param.specAliasT); 
     
    4445    public void testType() { 
    4546        TemplateTypeParameter param = (TemplateTypeParameter)  
    46             InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER, null, new ASTNodeEncoder()); 
     47            InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER, null, new ASTNodeEncoder(AST.D1)); 
    4748        assertNull(param.ident); 
    4849        assertNull(param.specType); 
     
    5253    public void testTypeSpecificType() { 
    5354        TemplateTypeParameter param = (TemplateTypeParameter)  
    54             InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER + TEMPLATE_TYPE_PARAMETER2 + i, null, new ASTNodeEncoder()); 
     55            InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER + TEMPLATE_TYPE_PARAMETER2 + i, null, new ASTNodeEncoder(AST.D1)); 
    5556        assertNull(param.ident); 
    5657        assertSame(Type.tint32, param.specType); 
     
    6061    public void testTypeDefaultValue() { 
    6162        TemplateTypeParameter param = (TemplateTypeParameter)  
    62             InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER, "i", new ASTNodeEncoder()); 
     63            InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER, "i", new ASTNodeEncoder(AST.D1)); 
    6364        assertNull(param.ident); 
    6465        assertNull(param.specType); 
     
    6869    public void testValue() { 
    6970        TemplateValueParameter param = (TemplateValueParameter)  
    70             InternalSignature.toTemplateParameter("" + TEMPLATE_VALUE_PARAMETER + i, null, new ASTNodeEncoder()); 
     71            InternalSignature.toTemplateParameter("" + TEMPLATE_VALUE_PARAMETER + i, null, new ASTNodeEncoder(AST.D1)); 
    7172        assertNull(param.ident); 
    7273        assertSame(Type.tint32, param.valType); 
     
    7778    public void testValueSpecific() { 
    7879        TemplateValueParameter param = (TemplateValueParameter)  
    79             InternalSignature.toTemplateParameter("" + TEMPLATE_VALUE_PARAMETER + i + TEMPLATE_VALUE_PARAMETER2 + "1" + TEMPLATE_VALUE_PARAMETER + "3", null, new ASTNodeEncoder()); 
     80            InternalSignature.toTemplateParameter("" + TEMPLATE_VALUE_PARAMETER + i + TEMPLATE_VALUE_PARAMETER2 + "1" + TEMPLATE_VALUE_PARAMETER + "3", null, new ASTNodeEncoder(AST.D1)); 
    8081        assertNull(param.ident); 
    8182        assertSame(Type.tint32, param.valType); 
     
    8687    public void testValueDefaultValue() { 
    8788        TemplateValueParameter param = (TemplateValueParameter)  
    88             InternalSignature.toTemplateParameter("" + TEMPLATE_VALUE_PARAMETER + i, "1", new ASTNodeEncoder()); 
     89            InternalSignature.toTemplateParameter("" + TEMPLATE_VALUE_PARAMETER + i, "1", new ASTNodeEncoder(AST.D1)); 
    8990        assertNull(param.ident); 
    9091        assertSame(Type.tint32, param.valType); 
  • trunk/descent.tests/descent/tests/mangling/SignatureToType_Test.java

    r1223 r1226  
    3030     
    3131    public void testPrimitive() { 
    32         Type actual = InternalSignature.toType(i, new ASTNodeEncoder()); 
     32        Type actual = InternalSignature.toType(i, new ASTNodeEncoder(AST.D1)); 
    3333        assertSame(Type.tint32, actual); 
    3434    } 
    3535     
    3636    public void testPointer() { 
    37         TypePointer actual = (TypePointer) InternalSignature.toType(P(i), new ASTNodeEncoder()); 
     37        TypePointer actual = (TypePointer) InternalSignature.toType(P(i), new ASTNodeEncoder(AST.D1)); 
    3838        assertSame(Type.tint32, actual.next); 
    3939    } 
    4040     
    4141    public void testStaticArray() { 
    42         TypeSArray actual = (TypeSArray) InternalSignature.toType(G(i, "3"), new ASTNodeEncoder()); 
     42        TypeSArray actual = (TypeSArray) InternalSignature.toType(G(i, "3"), new ASTNodeEncoder(AST.D1)); 
    4343        assertSame(Type.tint32, actual.next); 
    4444        assertSame(3, ((IntegerExp) actual.dim).value.intValue()); 
     
    4646     
    4747    public void testDynamicArray() { 
    48         TypeDArray actual = (TypeDArray) InternalSignature.toType(A(i), new ASTNodeEncoder()); 
     48        TypeDArray actual = (TypeDArray) InternalSignature.toType(A(i), new ASTNodeEncoder(AST.D1)); 
    4949        assertSame(Type.tint32, actual.next); 
    5050    } 
    5151     
    5252    public void testAssociativeArray() { 
    53         TypeAArray actual = (TypeAArray) InternalSignature.toType(H(i, a), new ASTNodeEncoder()); 
     53        TypeAArray actual = (TypeAArray) InternalSignature.toType(H(i, a), new ASTNodeEncoder(AST.D1)); 
    5454        assertSame(Type.tint32, actual.index); 
    5555        assertSame(Type.tchar, actual.next); 
     
    5757     
    5858    public void testConst() { 
    59         TypeBasic actual = (TypeBasic) InternalSignature.toType(Signature.C_CONST + i, new ASTNodeEncoder()); 
     59        TypeBasic actual = (TypeBasic) InternalSignature.toType(Signature.C_CONST + i, new ASTNodeEncoder(AST.D1)); 
    6060        assertEquals(descent.internal.compiler.parser.TY.Tint32, actual.ty); 
    6161        assertEquals(Type.MODconst, actual.mod); 
     
    6363     
    6464    public void testInvariant() { 
    65         TypeBasic actual = (TypeBasic) InternalSignature.toType(Signature.C_INVARIANT + i, new ASTNodeEncoder()); 
     65        TypeBasic actual = (TypeBasic) InternalSignature.toType(Signature.C_INVARIANT + i, new ASTNodeEncoder(AST.D1)); 
    6666        assertEquals(descent.internal.compiler.parser.TY.Tint32, actual.ty); 
    6767        assertEquals(Type.MODinvariant, actual.mod); 
     
    6969     
    7070    public void testTypeof() { 
    71         TypeTypeof actual = (TypeTypeof) InternalSignature.toType(typeof("3"), new ASTNodeEncoder()); 
     71        TypeTypeof actual = (TypeTypeof) InternalSignature.toType(typeof("3"), new ASTNodeEncoder(AST.D1)); 
    7272        assertSame(3, ((IntegerExp) actual.exp).value.intValue()); 
    7373    } 
    7474     
    7575    public void testSlice() { 
    76         TypeSlice actual = (TypeSlice) InternalSignature.toType(slice(i, "1", "3"), new ASTNodeEncoder()); 
     76        TypeSlice actual = (TypeSlice) InternalSignature.toType(slice(i, "1", "3"), new ASTNodeEncoder(AST.D1)); 
    7777        assertSame(Type.tint32, actual.next); 
    7878        assertSame(1, ((IntegerExp) actual.lwr).value.intValue()); 
     
    8181     
    8282    public void testFunction() { 
    83         TypeFunction actual = (TypeFunction) InternalSignature.toType(F + i + Z + a, new ASTNodeEncoder()); 
     83        TypeFunction actual = (TypeFunction) InternalSignature.toType(F + i + Z + a, new ASTNodeEncoder(AST.D1)); 
    8484        assertEquals(LINK.LINKd, actual.linkage); 
    8585        assertSame(Type.tchar, actual.next); 
     
    9393     
    9494    public void testFunctionManyParameters() { 
    95         TypeFunction actual = (TypeFunction) InternalSignature.toType(F + i + a + Z + v, new ASTNodeEncoder()); 
     95        TypeFunction actual = (TypeFunction) InternalSignature.toType(F + i + a + Z + v, new ASTNodeEncoder(AST.D1)); 
    9696        assertEquals(LINK.LINKd, actual.linkage); 
    9797        assertSame(Type.tvoid, actual.next); 
     
    111111     
    112112    public void testFunctionParameterStorageClass() { 
    113         TypeFunction actual = (TypeFunction) InternalSignature.toType(F + 'J' + i + Z + a, new ASTNodeEncoder()); 
     113        TypeFunction actual = (TypeFunction) InternalSignature.toType(F + 'J' + i + Z + a, new ASTNodeEncoder(AST.D1)); 
    114114        assertEquals(LINK.LINKd, actual.linkage); 
    115115        assertSame(Type.tchar, actual.next); 
     
    123123     
    124124    public void testDelegate() { 
    125         TypeDelegate delegate = (TypeDelegate) InternalSignature.toType(D + F + i + Z + a, new ASTNodeEncoder()); 
     125        TypeDelegate delegate = (TypeDelegate) InternalSignature.toType(D + F + i + Z + a, new ASTNodeEncoder(AST.D1)); 
    126126         
    127127        TypeFunction actual = (TypeFunction) delegate.next; 
     
    137137 
    138138    public void testIdentifier() { 
    139         TypeIdentifier actual = (TypeIdentifier) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo", new ASTNodeEncoder()); 
     139        TypeIdentifier actual = (TypeIdentifier) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo", new ASTNodeEncoder(AST.D1)); 
    140140         
    141141        assertEquals("Foo", new String(actual.ident.ident)); 
     
    144144     
    145145    public void testIdentifier2() { 
    146         TypeIdentifier actual = (TypeIdentifier) InternalSignature.toType(Signature.C_IDENTIFIER + "3Bar4Test3Foo", new ASTNodeEncoder()); 
     146        TypeIdentifier actual = (TypeIdentifier) InternalSignature.toType(Signature.C_IDENTIFIER + "3Bar4Test3Foo", new ASTNodeEncoder(AST.D1)); 
    147147         
    148148        assertEquals("Bar", new String(actual.ident.ident)); 
     
    153153     
    154154    public void testInstance() { 
    155         TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder()); 
     155        TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder(AST.D1)); 
    156156        TemplateInstance templInstance = typeInstance.tempinst; 
    157157         
     
    161161     
    162162    public void testInstanceType() { 
    163         TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_INSTANCE_TYPE_PARAMETER + i + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder()); 
     163        TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_INSTANCE_TYPE_PARAMETER + i + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder(AST.D1)); 
    164164        TemplateInstance templInstance = typeInstance.tempinst; 
    165165         
     
    171171     
    172172    public void testInstanceSymbol() { 
    173         TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_INSTANCE_SYMBOL_PARAMETER + i + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder()); 
     173        TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_INSTANCE_SYMBOL_PARAMETER + i + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder(AST.D1)); 
    174174        TemplateInstance templInstance = typeInstance.tempinst; 
    175175         
     
    181181     
    182182    public void testInstanceValue() { 
    183         TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_INSTANCE_VALUE_PARAMETER + "1" + Signature.C_TEMPLATE_INSTANCE_VALUE_PARAMETER + "3" + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder()); 
     183        TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_INSTANCE_VALUE_PARAMETER + "1" + Signature.C_TEMPLATE_INSTANCE_VALUE_PARAMETER + "3" + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder(AST.D1)); 
    184184        TemplateInstance templInstance = typeInstance.tempinst; 
    185185         
     
    191191     
    192192    public void testQualifiedInstance() { 
    193         TypeIdentifier typeIdent = (TypeIdentifier) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + "3Bar" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder()); 
     193        TypeIdentifier typeIdent = (TypeIdentifier) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + "3Bar" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder(AST.D1)); 
    194194        assertEquals("Foo", new String(typeIdent.ident.ident)); 
    195195         
     
    204204     
    205205    public void testNestedInstance() { 
    206         TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK + Signature.C_IDENTIFIER + "3Bar" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder()); 
     206        TypeInstance typeInstance = (TypeInstance) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK + Signature.C_IDENTIFIER + "3Bar" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder(AST.D1)); 
    207207        TemplateInstance tempInstance = typeInstance.tempinst; 
    208208         
     
    220220     
    221221    public void testNestedQualifiedInstance() { 
    222         TypeIdentifier typeIdent = (TypeIdentifier) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo3Bar" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK + Signature.C_IDENTIFIER + "3One3Two" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder()); 
     222        TypeIdentifier typeIdent = (TypeIdentifier) InternalSignature.toType(Signature.C_IDENTIFIER + "3Foo3Bar" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK + Signature.C_IDENTIFIER + "3One3Two" + Signature.C_TEMPLATE_INSTANCE + Signature.C_TEMPLATE_PARAMETERS_BREAK, new ASTNodeEncoder(AST.D1)); 
    223223        assertEquals("Foo", new String(typeIdent.ident.ident)); 
    224224         
  • trunk/descent.tests/descent/tests/mangling/Signature_Test.java

    r1194 r1226  
    22 
    33import descent.core.Signature; 
     4import descent.core.dom.AST; 
    45import descent.internal.compiler.parser.ASTNodeEncoder; 
    56import descent.internal.compiler.parser.IntegerExp; 
     
    2627     
    2728    public void testStaticArray() { 
    28         assertEquals(new TypeSArray(TypeBasic.tint32, new IntegerExp(3), new ASTNodeEncoder()).getSignature(),  
     29        assertEquals(new TypeSArray(TypeBasic.tint32, new IntegerExp(3), new ASTNodeEncoder(AST.D1)).getSignature(),  
    2930            Signature.createStaticArraySignature(Signature.SIG_INT, "3")); 
    3031    } 
    3132     
    3233    public void testStaticArray2() { 
    33         assertEquals(new TypeSArray(TypeBasic.tint32, new IntegerExp(3), new ASTNodeEncoder()).getSignature(),  
     34        assertEquals(new TypeSArray(TypeBasic.tint32, new IntegerExp(3), new ASTNodeEncoder(AST.D1)).getSignature(),  
    3435            new String(Signature.createStaticArraySignature(Signature.SIG_INT.toCharArray(), "3".toCharArray()))); 
    3536    } 
    3637     
    3738    public void testStaticArray3() { 
    38         assertEquals(new TypeSArray(TypeBasic.tint32, new IntegerExp(123), new ASTNodeEncoder()).getSignature(),  
     39        assertEquals(new TypeSArray(TypeBasic.tint32, new IntegerExp(123), new ASTNodeEncoder(AST.D1)).getSignature(),  
    3940            new String(Signature.createStaticArraySignature(Signature.SIG_INT.toCharArray(), "123".toCharArray()))); 
    4041    } 
     
    6162     
    6263    public void testTypeof() { 
    63         assertEquals(new TypeTypeof(Loc.ZERO, new IntegerExp(3), new ASTNodeEncoder()).getSignature(),  
     64        assertEquals(new TypeTypeof(Loc.ZERO, new IntegerExp(3), new ASTNodeEncoder(AST.D1)).getSignature(),  
    6465            Signature.createTypeofSignature("3")); 
    6566    } 
    6667     
    6768    public void testTypeof2() { 
    68         assertEquals(new TypeTypeof(Loc.ZERO, new IntegerExp(3), new ASTNodeEncoder()).getSignature(),  
     69        assertEquals(new TypeTypeof(Loc.ZERO, new IntegerExp(3), new ASTNodeEncoder(AST.D1)).getSignature(),  
    6970            new String(Signature.createTypeofSignature("3".toCharArray()))); 
    7071    } 
    7172     
    7273    public void testSlice() { 
    73         assertEquals(new TypeSlice(TypeBasic.tint32, new IntegerExp(1), new IntegerExp(23), new ASTNodeEncoder()).getSignature(),  
     74        assertEquals(new TypeSlice(TypeBasic.tint32, new IntegerExp(1), new IntegerExp(23), new ASTNodeEncoder(AST.D1)).getSignature(),  
    7475            Signature.createSliceSignature(Signature.SIG_INT, "1", "23")); 
    7576    } 
    7677     
    7778    public void testSlice2() { 
    78         assertEquals(new TypeSlice(TypeBasic.tint32, new IntegerExp(1), new IntegerExp(23), new ASTNodeEncoder()).getSignature(),  
     79        assertEquals(new TypeSlice(TypeBasic.tint32, new IntegerExp(1), new IntegerExp(23), new ASTNodeEncoder(AST.D1)).getSignature(),  
    7980            new String(Signature.createSliceSignature(Signature.SIG_INT.toCharArray(), "1".toCharArray(), "23".toCharArray()))); 
    8081    } 
  • trunk/descent.tests/descent/tests/mars/Parser_Test.java

    r1141 r1226  
    161161             
    162162        }, result.module, null, new DmdModuleFinder(global), global, new CompilerConfiguration(), 
    163         new ASTNodeEncoder()); 
     163        new ASTNodeEncoder(apiLevel)); 
    164164         
    165165        if (!(result.module.problems != null && result.module.problems.size() > 0)) { 
  • trunk/descent.ui/src/descent/internal/ui/JavaPluginImages.java

    r1092 r1226  
    447447    public static final ImageDescriptor DESC_OVR_FINAL= createUnManagedCached(T_OVR, "final_co.gif");                       //$NON-NLS-1$ 
    448448    public static final ImageDescriptor DESC_OVR_ABSTRACT= createUnManagedCached(T_OVR, "abstract_co.gif");                     //$NON-NLS-1$ 
     449    public static final ImageDescriptor DESC_OVR_CONST= createUnManagedCached(T_OVR, "const_co.gif");                   //$NON-NLS-1$ 
     450    public static final ImageDescriptor DESC_OVR_INVARIANT= createUnManagedCached(T_OVR, "invariant_co.gif");                   //$NON-NLS-1$ 
    449451    public static final ImageDescriptor DESC_OVR_SYNCH= createUnManagedCached(T_OVR, "synch_co.gif");                       //$NON-NLS-1$ 
    450452    public static final ImageDescriptor DESC_OVR_RUN= createUnManagedCached(T_OVR, "run_co.gif");                           //$NON-NLS-1$ 
  • trunk/descent.ui/src/descent/internal/ui/viewsupport/JavaElementImageProvider.java

    r1040 r1226  
    374374                    flags |= JavaElementImageDescriptor.STATIC; 
    375375                 
     376                if (Flags.isInvariant(modifiers)) { 
     377                    flags |= JavaElementImageDescriptor.INVARIANT; 
     378                } else if (Flags.isConst(modifiers)) { 
     379                    flags |= JavaElementImageDescriptor.CONST; 
     380                } 
     381                 
    376382                if (Flags.isDeprecated(modifiers)) 
    377383                    flags |= JavaElementImageDescriptor.DEPRECATED; 
  • trunk/descent.ui/src/descent/ui/JavaElementImageDescriptor.java

    r177 r1226  
    6969     * @since 3.0 
    7070     */ 
    71     public final static int DEPRECATED=     0x400;   
     71    public final static int DEPRECATED=     0x400; 
     72     
     73    /** Flag to render the const adornment. */ 
     74    public final static int CONST=          0x800; 
     75     
     76    /** Flag to render the invariant adornment. */ 
     77    public final static int INVARIANT=          0x1000; 
    7278 
    7379    private ImageDescriptor fBaseImage; 
     
    195201    private void drawTopRight() {        
    196202        int x= getSize().x; 
    197         if ((fFlags & ABSTRACT) != 0) { 
     203        if ((fFlags & ABSTRACT) != 0 && (fFlags & FINAL) == 0) { 
    198204            ImageData data= getImageData(JavaPluginImages.DESC_OVR_ABSTRACT); 
    199205            x-= data.width; 
     
    205211            drawImage(data, x, 0); 
    206212        } 
    207         if ((fFlags & FINAL) != 0) { 
     213        if ((fFlags & FINAL) != 0 && (fFlags & ABSTRACT) == 0) { 
    208214            ImageData data= getImageData(JavaPluginImages.DESC_OVR_FINAL); 
    209215            x-= data.width; 
     
    215221            drawImage(data, x, 0); 
    216222        } 
     223        if ((fFlags & INVARIANT) != 0) { 
     224            ImageData data= getImageData(JavaPluginImages.DESC_OVR_INVARIANT); 
     225            x-= data.width; 
     226            drawImage(data, x, 0); 
     227        } else if ((fFlags & CONST) != 0) { 
     228            ImageData data= getImageData(JavaPluginImages.DESC_OVR_CONST); 
     229            x-= data.width; 
     230            drawImage(data, x, 0); 
     231        }  
    217232    }        
    218233     
  • trunk/descent.ui/src/descent/ui/JavaElementLabels.java

    r1223 r1226  
    760760                    } 
    761761                     
    762                     if (Flags.isInvariant(field.getFlags())) { 
    763                         buf.append("invariant "); 
    764                     } else if (Flags.isConst(field.getFlags())) { 
    765                         buf.append("const "); 
    766                     } 
    767                      
    768762                    getTypeSignatureLabel(new BindingKey(field.getKey()).toSignature(), flags, buf); 
    769763                } else { 
    770764                    if (!annonymous) { 
    771765                        buf.append(DECL_STRING); 
    772                     } 
    773                      
    774                     if (Flags.isInvariant(field.getFlags())) { 
    775                         buf.append("invariant "); 
    776                     } else if (Flags.isConst(field.getFlags())) { 
    777                         buf.append("const "); 
    778766                    } 
    779767                     
  • trunk/descent.ui/src/descent/ui/text/java/CompletionProposalLabelProvider.java

    r1146 r1226  
    821821