Changeset 1226
- Timestamp:
- 07/12/08 19:38:24 (3 months ago)
- Files:
-
- trunk/descent.core/src/descent/internal/compiler/parser/ASTDmdNode.java (modified) (4 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/ASTNodeEncoder.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/ArrayScopeSymbol.java (modified) (4 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/CastExp.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/IndexExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Lexer.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Parser.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/SliceExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Type.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TypeSArray.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/TypeSlice.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/core/builder/JavaBuilder.java (modified) (3 diffs)
- trunk/descent.tests/descent/tests/mangling/SignatureToTemplateParameter_Test.java (modified) (11 diffs)
- trunk/descent.tests/descent/tests/mangling/SignatureToType_Test.java (modified) (18 diffs)
- trunk/descent.tests/descent/tests/mangling/Signature_Test.java (modified) (3 diffs)
- trunk/descent.tests/descent/tests/mars/Parser_Test.java (modified) (1 diff)
- trunk/descent.ui/icons/full/ovr16/const_co.gif (added)
- trunk/descent.ui/icons/full/ovr16/invariant_co.gif (added)
- trunk/descent.ui/src/descent/internal/ui/JavaPluginImages.java (modified) (1 diff)
- trunk/descent.ui/src/descent/internal/ui/viewsupport/JavaElementImageProvider.java (modified) (1 diff)
- trunk/descent.ui/src/descent/ui/JavaElementImageDescriptor.java (modified) (4 diffs)
- trunk/descent.ui/src/descent/ui/JavaElementLabels.java (modified) (1 diff)
- trunk/descent.ui/src/descent/ui/text/java/CompletionProposalLabelProvider.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/descent.core/src/descent/internal/compiler/parser/ASTDmdNode.java
r1223 r1226 1204 1204 public static void arrayExpressionScanForNestedRef(Scope sc, Expressions a, 1205 1205 SemanticContext context) { 1206 if (null == a) {1206 if (null != a) { 1207 1207 for (int i = 0; i < a.size(); i++) { 1208 1208 Expression e = a.get(i); … … 1327 1327 SemanticContext context) { 1328 1328 if (t.ty == Ttuple) { 1329 ScopeDsymbol sym = new ArrayScopeSymbol( (TypeTuple) t);1329 ScopeDsymbol sym = new ArrayScopeSymbol(sc, (TypeTuple) t); 1330 1330 sym.parent = sc.scopesym; 1331 1331 sc = sc.push(sym); … … 1342 1342 public static Expression semanticLength(Scope sc, TupleDeclaration s, 1343 1343 Expression exp, SemanticContext context) { 1344 ScopeDsymbol sym = new ArrayScopeSymbol(s );1344 ScopeDsymbol sym = new ArrayScopeSymbol(sc, s); 1345 1345 sym.parent = sc.scopesym; 1346 1346 sc = sc.push(sym); … … 1958 1958 public static Expression eval_builtin(BUILTIN builtin, 1959 1959 Expressions arguments, SemanticContext context) { 1960 if (size(arguments) == 0) { 1961 return null; 1962 } 1963 1960 1964 Expression arg0 = arguments.get(0); 1961 1965 Expression e = null; trunk/descent.core/src/descent/internal/compiler/parser/ASTNodeEncoder.java
r1199 r1226 15 15 16 16 private Parser parser; 17 private final int apiLevel; 17 18 private Parser initParser(char[] source) { 18 19 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); 20 21 } else { 21 22 parser.reset(source, 0, source.length, false, false, false, false); … … 25 26 } 26 27 27 public ASTNodeEncoder( ) {28 28 public ASTNodeEncoder(int apiLevel) { 29 this.apiLevel = apiLevel; 29 30 } 30 31 trunk/descent.core/src/descent/internal/compiler/parser/ArrayScopeSymbol.java
r1185 r1226 24 24 public TupleDeclaration td; // for tuples of objects 25 25 public Scope sc; 26 27 public ArrayScopeSymbol(Expression e) {28 this(null, e);29 }30 26 31 27 public ArrayScopeSymbol(Scope sc, Expression e) { … … 33 29 this.exp = e; 34 30 this.sc = sc; 35 } 36 37 public ArrayScopeSymbol(TupleDeclaration s) { 38 this(null, s); 31 if (sc == null) { 32 System.out.println(123456); 33 } 39 34 } 40 35 … … 44 39 this.td = s; 45 40 this.sc = sc; 46 } 47 48 public ArrayScopeSymbol(TypeTuple t) { 49 this(null, t); 41 if (sc == null) { 42 System.out.println(123456); 43 } 50 44 } 51 45 … … 204 198 } 205 199 206 if (context.isD2()) {207 pvar.semantic(sc, context);208 }209 210 200 // TODO semantic I think this logic is ok 211 201 // return *pvar; 212 202 if (pvar instanceof IndexExp) { 203 if (context.isD2()) { 204 ((IndexExp) pvar).lengthVar.semantic(sc, context); 205 } 213 206 return ((IndexExp) pvar).lengthVar; 214 207 } else { 208 if (context.isD2()) { 209 ((SliceExp) pvar).lengthVar.semantic(sc, context); 210 } 215 211 return ((SliceExp) pvar).lengthVar; 216 212 } trunk/descent.core/src/descent/internal/compiler/parser/CastExp.java
r1201 r1226 1 1 package descent.internal.compiler.parser; 2 2 3 import melnorme.miscutil.tree.TreeVisitor;4 import descent.core.compiler.IProblem;5 import descent.internal.compiler.parser.ast.IASTVisitor;6 3 import static descent.internal.compiler.parser.Constfold.Cast; 7 4 import static descent.internal.compiler.parser.TOK.TOKarrayliteral; 8 5 import static descent.internal.compiler.parser.TOK.TOKcall; 6 import static descent.internal.compiler.parser.TOK.TOKconst; 7 import static descent.internal.compiler.parser.TOK.TOKinvariant; 9 8 import static descent.internal.compiler.parser.TOK.TOKnull; 10 9 import static descent.internal.compiler.parser.TOK.TOKstring; 11 10 import static descent.internal.compiler.parser.TOK.TOKsymoff; 12 11 import static descent.internal.compiler.parser.TOK.TOKvar; 13 14 12 import static descent.internal.compiler.parser.TY.Tarray; 15 13 import static descent.internal.compiler.parser.TY.Tclass; … … 18 16 import static descent.internal.compiler.parser.TY.Tstruct; 19 17 import static descent.internal.compiler.parser.TY.Tvoid; 18 import melnorme.miscutil.tree.TreeVisitor; 19 import descent.core.compiler.IProblem; 20 import descent.internal.compiler.parser.ast.IASTVisitor; 20 21 21 22 … … 184 185 { 185 186 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 } 187 201 188 202 e = op_overload(sc, context); trunk/descent.core/src/descent/internal/compiler/parser/IndexExp.java
r1201 r1226 130 130 if (t1.ty == TY.Tsarray || t1.ty == TY.Tarray || t1.ty == TY.Ttuple) { 131 131 // Create scope for 'length' variable 132 sym = new ArrayScopeSymbol( this);132 sym = new ArrayScopeSymbol(sc, this); 133 133 sym.loc = loc; 134 134 sym.parent = sc.scopesym; trunk/descent.core/src/descent/internal/compiler/parser/Lexer.java
r1194 r1226 274 274 int apiLevel, char[] filename) { 275 275 this(source, offset, length, tokenizeComments, tokenizePragmas, 276 tokenizeWhiteSpace, recordLineSeparator, apiLevel, filename, new ASTNodeEncoder( ));276 tokenizeWhiteSpace, recordLineSeparator, apiLevel, filename, new ASTNodeEncoder(apiLevel)); 277 277 } 278 278 trunk/descent.core/src/descent/internal/compiler/parser/Parser.java
r1222 r1226 203 203 public Parser(int apiLevel, char[] source, int offset, 204 204 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)); 206 206 } 207 207 208 208 public Parser(int apiLevel, char[] source, int offset, 209 209 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)); 211 211 } 212 212 … … 236 236 this(source, offset, length, tokenizeComments, tokenizePragmas, 237 237 tokenizeWhiteSpace, recordLineSeparator, apiLevel, 238 taskTags, taskPriorities, isTaskCaseSensitive, filename, new ASTNodeEncoder( ));238 taskTags, taskPriorities, isTaskCaseSensitive, filename, new ASTNodeEncoder(apiLevel)); 239 239 } 240 240 … … 2861 2861 t = parseType(); 2862 2862 check(TOKrparen); 2863 if (t == null) { 2864 System.out.println(123456); 2865 } 2863 2866 t = t.makeInvariant(start, prevToken.ptr + prevToken.sourceLen - start); 2864 2867 break; trunk/descent.core/src/descent/internal/compiler/parser/SliceExp.java
r1201 r1226 199 199 200 200 if (t.ty == TY.Tsarray || t.ty == TY.Tarray || t.ty == TY.Ttuple) { 201 sym = new ArrayScopeSymbol( this);201 sym = new ArrayScopeSymbol(sc, this); 202 202 sym.loc = loc; 203 203 sym.parent = sc.scopesym; trunk/descent.core/src/descent/internal/compiler/parser/Type.java
r1223 r1226 502 502 public Type rto; // reference to this type 503 503 public Type arrayof; // array of this type 504 public Object vtinfo;505 504 506 505 /* … … 742 741 t.cto = null; 743 742 t.ito = null; 744 t.vtinfo = null;745 743 // if (ty == Tsarray) { 746 744 // TypeSArray ta = (TypeSArray) t; … … 1320 1318 if (context.isD2()) { 1321 1319 if (t.isConst()) { 1322 t.vtinfo = new TypeInfoConstDeclaration(t, context);1320 vtinfo = new TypeInfoConstDeclaration(t, context); 1323 1321 } else if (t.isInvariant()) { 1324 t.vtinfo = new TypeInfoInvariantDeclaration(t, context);1322 vtinfo = new TypeInfoInvariantDeclaration(t, context); 1325 1323 } else { 1326 t.vtinfo = t.getTypeInfoDeclaration(context);1324 vtinfo = t.getTypeInfoDeclaration(context); 1327 1325 } 1328 1326 } else { trunk/descent.core/src/descent/internal/compiler/parser/TypeSArray.java
r1201 r1226 232 232 TupleDeclaration td = s.isTupleDeclaration(); 233 233 if (null != td) { 234 ScopeDsymbol sym = new ArrayScopeSymbol( td);234 ScopeDsymbol sym = new ArrayScopeSymbol(sc, td); 235 235 sym.parent = sc.scopesym; 236 236 sc = sc.push(sym); trunk/descent.core/src/descent/internal/compiler/parser/TypeSlice.java
r1201 r1226 61 61 * It's a slice of a TupleDeclaration 62 62 */ 63 ScopeDsymbol sym = new ArrayScopeSymbol( td);63 ScopeDsymbol sym = new ArrayScopeSymbol(sc, td); 64 64 sym.parent = sc.scopesym; 65 65 sc = sc.push(sym); trunk/descent.core/src/descent/internal/core/builder/JavaBuilder.java
r1141 r1226 47 47 fullBuild(project, monitor); 48 48 } else { 49 delta.accept(new JavaBuilderVisitor(isShowSemanticErrors())); 49 IJavaProject javaProject = JavaCore.create(project); 50 delta.accept(new JavaBuilderVisitor(javaProject.getApiLevel(), isShowSemanticErrors())); 50 51 } 51 52 return null; … … 55 56 IJavaProject javaProject = JavaCore.create(project); 56 57 IResource[] members = project.members(); 57 build(javaProject, isShowSemanticErrors(), members, new ASTNodeEncoder( ), monitor);58 build(javaProject, isShowSemanticErrors(), members, new ASTNodeEncoder(javaProject.getApiLevel()), monitor); 58 59 } 59 60 … … 72 73 private class JavaBuilderVisitor implements IResourceDeltaVisitor { 73 74 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) { 78 79 this.showSemanticErrors = showSemanticErrors; 80 this.encoder = new ASTNodeEncoder(apiLevel); 79 81 } 80 82 trunk/descent.tests/descent/tests/mangling/SignatureToTemplateParameter_Test.java
r1194 r1226 1 1 package descent.tests.mangling; 2 2 3 import descent.core.dom.AST; 3 4 import descent.internal.compiler.parser.ASTNodeEncoder; 4 5 import descent.internal.compiler.parser.IntegerExp; … … 14 15 public void testTuple() { 15 16 TemplateTupleParameter param = (TemplateTupleParameter) 16 InternalSignature.toTemplateParameter("" + TEMPLATE_TUPLE_PARAMETER, null, new ASTNodeEncoder( ));17 InternalSignature.toTemplateParameter("" + TEMPLATE_TUPLE_PARAMETER, null, new ASTNodeEncoder(AST.D1)); 17 18 assertNull(param.ident); 18 19 } … … 20 21 public void testAlias() { 21 22 TemplateAliasParameter param = (TemplateAliasParameter) 22 InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER, null, new ASTNodeEncoder( ));23 InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER, null, new ASTNodeEncoder(AST.D1)); 23 24 assertNull(param.ident); 24 25 assertNull(param.specAliasT); … … 28 29 public void testAliasDefaultValue() { 29 30 TemplateAliasParameter param = (TemplateAliasParameter) 30 InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER, "i", new ASTNodeEncoder( ));31 InternalSignature.toTemplateParameter("" + TEMPLATE_ALIAS_PARAMETER, "i", new ASTNodeEncoder(AST.D1)); 31 32 assertNull(param.ident); 32 33 assertNull(param.specAliasT); … … 36 37 public void testAliasSpecificType() { 37 38 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)); 39 40 assertNull(param.ident); 40 41 assertSame(Type.tint32, param.specAliasT); … … 44 45 public void testType() { 45 46 TemplateTypeParameter param = (TemplateTypeParameter) 46 InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER, null, new ASTNodeEncoder( ));47 InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER, null, new ASTNodeEncoder(AST.D1)); 47 48 assertNull(param.ident); 48 49 assertNull(param.specType); … … 52 53 public void testTypeSpecificType() { 53 54 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)); 55 56 assertNull(param.ident); 56 57 assertSame(Type.tint32, param.specType); … … 60 61 public void testTypeDefaultValue() { 61 62 TemplateTypeParameter param = (TemplateTypeParameter) 62 InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER, "i", new ASTNodeEncoder( ));63 InternalSignature.toTemplateParameter("" + TEMPLATE_TYPE_PARAMETER, "i", new ASTNodeEncoder(AST.D1)); 63 64 assertNull(param.ident); 64 65 assertNull(param.specType); … … 68 69 public void testValue() { 69 70 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)); 71 72 assertNull(param.ident); 72 73 assertSame(Type.tint32, param.valType); … … 77 78 public void testValueSpecific() { 78 79 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)); 80 81 assertNull(param.ident); 81 82 assertSame(Type.tint32, param.valType); … … 86 87 public void testValueDefaultValue() { 87 88 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)); 89 90 assertNull(param.ident); 90 91 assertSame(Type.tint32, param.valType); trunk/descent.tests/descent/tests/mangling/SignatureToType_Test.java
r1223 r1226 30 30 31 31 public void testPrimitive() { 32 Type actual = InternalSignature.toType(i, new ASTNodeEncoder( ));32 Type actual = InternalSignature.toType(i, new ASTNodeEncoder(AST.D1)); 33 33 assertSame(Type.tint32, actual); 34 34 } 35 35 36 36 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)); 38 38 assertSame(Type.tint32, actual.next); 39 39 } 40 40 41 41 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)); 43 43 assertSame(Type.tint32, actual.next); 44 44 assertSame(3, ((IntegerExp) actual.dim).value.intValue()); … … 46 46 47 47 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)); 49 49 assertSame(Type.tint32, actual.next); 50 50 } 51 51 52 52 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)); 54 54 assertSame(Type.tint32, actual.index); 55 55 assertSame(Type.tchar, actual.next); … … 57 57 58 58 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)); 60 60 assertEquals(descent.internal.compiler.parser.TY.Tint32, actual.ty); 61 61 assertEquals(Type.MODconst, actual.mod); … … 63 63 64 64 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)); 66 66 assertEquals(descent.internal.compiler.parser.TY.Tint32, actual.ty); 67 67 assertEquals(Type.MODinvariant, actual.mod); … … 69 69 70 70 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)); 72 72 assertSame(3, ((IntegerExp) actual.exp).value.intValue()); 73 73 } 74 74 75 75 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)); 77 77 assertSame(Type.tint32, actual.next); 78 78 assertSame(1, ((IntegerExp) actual.lwr).value.intValue()); … … 81 81 82 82 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)); 84 84 assertEquals(LINK.LINKd, actual.linkage); 85 85 assertSame(Type.tchar, actual.next); … … 93 93 94 94 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)); 96 96 assertEquals(LINK.LINKd, actual.linkage); 97 97 assertSame(Type.tvoid, actual.next); … … 111 111 112 112 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)); 114 114 assertEquals(LINK.LINKd, actual.linkage); 115 115 assertSame(Type.tchar, actual.next); … … 123 123 124 124 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)); 126 126 127 127 TypeFunction actual = (TypeFunction) delegate.next; … … 137 137 138 138 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)); 140 140 141 141 assertEquals("Foo", new String(actual.ident.ident)); … … 144 144 145 145 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)); 147 147 148 148 assertEquals("Bar", new String(actual.ident.ident)); … … 153 153 154 154 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)); 156 156 TemplateInstance templInstance = typeInstance.tempinst; 157 157 … … 161 161 162 162 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)); 164 164 TemplateInstance templInstance = typeInstance.tempinst; 165 165 … … 171 171 172 172 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)); 174 174 TemplateInstance templInstance = typeInstance.tempinst; 175 175 … … 181 181 182 182 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)); 184 184 TemplateInstance templInstance = typeInstance.tempinst; 185 185 … … 191 191 192 192 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)); 194 194 assertEquals("Foo", new String(typeIdent.ident.ident)); 195 195 … … 204 204 205 205 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)); 207 207 TemplateInstance tempInstance = typeInstance.tempinst; 208 208 … … 220 220 221 221 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)); 223 223 assertEquals("Foo", new String(typeIdent.ident.ident)); 224 224 trunk/descent.tests/descent/tests/mangling/Signature_Test.java
r1194 r1226 2 2 3 3 import descent.core.Signature; 4 import descent.core.dom.AST; 4 5 import descent.internal.compiler.parser.ASTNodeEncoder; 5 6 import descent.internal.compiler.parser.IntegerExp; … … 26 27 27 28 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(), 29 30 Signature.createStaticArraySignature(Signature.SIG_INT, "3")); 30 31 } 31 32 32 33 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(), 34 35 new String(Signature.createStaticArraySignature(Signature.SIG_INT.toCharArray(), "3".toCharArray()))); 35 36 } 36 37 37 38 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(), 39 40 new String(Signature.createStaticArraySignature(Signature.SIG_INT.toCharArray(), "123".toCharArray()))); 40 41 } … … 61 62 62 63 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(), 64 65 Signature.createTypeofSignature("3")); 65 66 } 66 67 67 68 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(), 69 70 new String(Signature.createTypeofSignature("3".toCharArray()))); 70 71 } 71 72 72 73 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(), 74 75 Signature.createSliceSignature(Signature.SIG_INT, "1", "23")); 75 76 } 76 77 77 78 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(), 79 80 new String(Signature.createSliceSignature(Signature.SIG_INT.toCharArray(), "1".toCharArray(), "23".toCharArray()))); 80 81 } trunk/descent.tests/descent/tests/mars/Parser_Test.java
r1141 r1226 161 161 162 162 }, result.module, null, new DmdModuleFinder(global), global, new CompilerConfiguration(), 163 new ASTNodeEncoder( ));163 new ASTNodeEncoder(apiLevel)); 164 164 165 165 if (!(result.module.problems != null && result.module.problems.size() > 0)) { trunk/descent.ui/src/descent/internal/ui/JavaPluginImages.java
r1092 r1226 447 447 public static final ImageDescriptor DESC_OVR_FINAL= createUnManagedCached(T_OVR, "final_co.gif"); //$NON-NLS-1$ 448 448 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$ 449 451 public static final ImageDescriptor DESC_OVR_SYNCH= createUnManagedCached(T_OVR, "synch_co.gif"); //$NON-NLS-1$ 450 452 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 374 374 flags |= JavaElementImageDescriptor.STATIC; 375 375 376 if (Flags.isInvariant(modifiers)) { 377 flags |= JavaElementImageDescriptor.INVARIANT; 378 } else if (Flags.isConst(modifiers)) { 379 flags |= JavaElementImageDescriptor.CONST; 380 } 381 376 382 if (Flags.isDeprecated(modifiers)) 377 383 flags |= JavaElementImageDescriptor.DEPRECATED; trunk/descent.ui/src/descent/ui/JavaElementImageDescriptor.java
r177 r1226 69 69 * @since 3.0 70 70 */ 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; 72 78 73 79 private ImageDescriptor fBaseImage; … … 195 201 private void drawTopRight() { 196 202 int x= getSize().x; 197 if ((fFlags & ABSTRACT) != 0 ) {203 if ((fFlags & ABSTRACT) != 0 && (fFlags & FINAL) == 0) { 198 204 ImageData data= getImageData(JavaPluginImages.DESC_OVR_ABSTRACT); 199 205 x-= data.width; … … 205 211 drawImage(data, x, 0); 206 212 } 207 if ((fFlags & FINAL) != 0 ) {213 if ((fFlags & FINAL) != 0 && (fFlags & ABSTRACT) == 0) { 208 214 ImageData data= getImageData(JavaPluginImages.DESC_OVR_FINAL); 209 215 x-= data.width; … … 215 221 drawImage(data, x, 0); 216 222 } 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 } 217 232 } 218 233 trunk/descent.ui/src/descent/ui/JavaElementLabels.java
r1223 r1226 760 760 } 761 761 762 if (Flags.isInvariant(field.getFlags())) {763 buf.append("invariant ");764 } else if (Flags.isConst(field.getFlags())) {765 buf.append("const ");766 }767 768 762 getTypeSignatureLabel(new BindingKey(field.getKey()).toSignature(), flags, buf); 769 763 } else { 770 764 if (!annonymous) { 771 765 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 ");778 766 } 779 767 trunk/descent.ui/src/descent/ui/text/java/CompletionProposalLabelProvider.java
r1146 r1226 821 821
