Changeset 1176
- Timestamp:
- 05/25/08 12:09:14 (3 months ago)
- Files:
-
- trunk/descent.core/src/descent/core/compiler/IProblem.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/ASTDmdNode.java (modified) (5 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/AnonDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/CallExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/ClassDeclaration.java (modified) (15 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/DeclarationExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Dsymbol.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Expression.java (modified) (5 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/IntegerExp.java (modified) (5 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/InterfaceDeclaration.java (modified) (7 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/IsExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Lexer.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/MATCH.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/NullExp.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/OverloadSet.java (added)
- trunk/descent.core/src/descent/internal/compiler/parser/PragmaDeclaration.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/Problem.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/ProblemMessages.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/ProblemMessages.properties (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/SemanticContext.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/StorageClassDeclaration.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/StringExp.java (modified) (12 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/StructLiteralExp.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TemplateDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/TemplateInstance.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/TemplateValueParameter.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Type.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/port.txt (modified) (3 diffs)
- trunk/descent.core/template/problem/problems.txt (modified) (2 diffs)
- trunk/descent.ui/plugin.xml (modified) (6 diffs)
- trunk/descent.ui/src/descent/internal/ui/text/correction/CUCorrectionProposal.java (added)
- trunk/descent.ui/src/descent/internal/ui/text/correction/QuickFixProcessor.java (added)
- trunk/descent.ui/src/descent/internal/ui/text/correction/ReplaceCorrectionProposal.java (added)
- trunk/descent.ui/src/descent/internal/ui/text/java/OverrideCompletionProposal.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/descent.core/src/descent/core/compiler/IProblem.java
r1167 r1176 672 672 int PostBlitsAreOnlyForStructUnionDefinitions = 461; 673 673 int CannotHaveEDotTuple = 462; 674 int CannotCreateCppClasses = 463; 674 675 675 676 } trunk/descent.core/src/descent/internal/compiler/parser/ASTDmdNode.java
r1171 r1176 1346 1346 */ 1347 1347 1348 public static intoverloadApply(FuncDeclaration fstart,1348 public static boolean overloadApply(FuncDeclaration fstart, 1349 1349 OverloadApply_fp fp, Object param, SemanticContext context) { 1350 1350 FuncDeclaration f; … … 1356 1356 1357 1357 if (fa != null) { 1358 if (overloadApply(fa.funcalias, fp, param, context) != 0) {1359 return 1;1358 if (overloadApply(fa.funcalias, fp, param, context)) { 1359 return false; 1360 1360 } 1361 1361 next = fa.overnext; … … 1382 1382 } 1383 1383 if (fp.call(param, f, context) != 0) { 1384 return 1;1384 return true; 1385 1385 } 1386 1386 … … 1389 1389 } 1390 1390 } 1391 return 0;1391 return false; 1392 1392 } 1393 1393 … … 1504 1504 { 1505 1505 boolean condition; 1506 if (context. apiLevel == Lexer.D2) {1506 if (context.isD2()) { 1507 1507 condition = (v.isConst() || v.isInvariant()) && v.init != null && null == v.value; 1508 1508 } else { trunk/descent.core/src/descent/internal/compiler/parser/AnonDeclaration.java
r1163 r1176 89 89 sc = sc.push(); 90 90 91 if (context. apiLevel == Parser.D2) {91 if (context.isD2()) { 92 92 sc.stc &= ~(STCauto | STCscope | STCstatic | STCtls); 93 93 } else { trunk/descent.core/src/descent/internal/compiler/parser/CallExp.java
r1167 r1176 101 101 if (fd != null) { 102 102 boolean doInlineDup = true; 103 if (context. apiLevel == Parser.D2) {103 if (context.isD2()) { 104 104 doInlineDup = false; 105 105 trunk/descent.core/src/descent/internal/compiler/parser/ClassDeclaration.java
r1173 r1176 14 14 import static descent.internal.compiler.parser.STC.STCabstract; 15 15 import static descent.internal.compiler.parser.STC.STCauto; 16 import static descent.internal.compiler.parser.STC.STCconst; 16 17 import static descent.internal.compiler.parser.STC.STCdeprecated; 17 18 import static descent.internal.compiler.parser.STC.STCfinal; 19 import static descent.internal.compiler.parser.STC.STCinvariant; 18 20 import static descent.internal.compiler.parser.STC.STCscope; 19 21 import static descent.internal.compiler.parser.STC.STCstatic; 22 import static descent.internal.compiler.parser.STC.STCtls; 20 23 21 24 import static descent.internal.compiler.parser.TY.Tclass; … … 49 52 public List vtbl; // Array of FuncDeclaration's making up the vtbl[] 50 53 public List vtblFinal; // More FuncDeclaration's that aren't in vtbl[] 54 public boolean cpp; // !=0 if this is a C++ interface 51 55 52 56 public ClassDeclaration(Loc loc, char[] id) { … … 180 184 181 185 public void interfaceSemantic(Scope sc, SemanticContext context) { 182 int i;183 186 InterfaceDeclaration id = isInterfaceDeclaration(); 187 184 188 vtblInterfaces = new BaseClasses(interfaces.size()); 185 189 186 for (i = 0; i < interfaces.size(); i++) {190 for (int i = 0; i < interfaces.size(); i++) { 187 191 BaseClass b = interfaces.get(i); 188 192 … … 191 195 if (b.base.isCOMinterface()) { 192 196 com = true; 197 } 198 199 if (context.isD2()) { 200 if (b.base.isCPPinterface() && id != null) { 201 id.cpp = true; 202 } 193 203 } 194 204 … … 265 275 266 276 public boolean isCOMinterface() { 277 return false; 278 } 279 280 public boolean isCPPinterface() { 267 281 return false; 268 282 } … … 381 395 isdeprecated = true; 382 396 } 383 397 398 if (sc.linkage == LINK.LINKcpp) { 399 if (context.acceptsProblems()) { 400 context.acceptProblem(Problem.newSemanticTypeErrorLoc(IProblem.CannotCreateCppClasses, this)); 401 } 402 } 384 403 385 404 // Expand any tuples in baseclasses[] … … 403 422 } 404 423 } 424 425 if (context.isD2()) { 426 if (0 == size(baseclasses) && sc.linkage == LINK.LINKcpp) { 427 cpp = true; 428 } 429 } 430 405 431 406 432 // See if there's a base class as first in baseclasses[] … … 575 601 if (baseClass.isInterfaceDeclaration() != null) { 576 602 throw new IllegalStateException( 577 "assert(!baseClass ->isInterfaceDeclaration());");603 "assert(!baseClass.isInterfaceDeclaration());"); 578 604 } 579 605 b.base = baseClass; … … 604 630 isauto = baseClass.isauto; 605 631 vthis = baseClass.vthis; 632 633 if (context.isD2()) { 634 storage_class |= baseClass.storage_class & (STCconst | STCinvariant); 635 } 606 636 } else { 607 637 // No base class, so this is the root of the class hierarchy … … 677 707 isabstract = true; 678 708 } 709 710 if (context.isD2()) { 711 if ((storage_class & STCinvariant) != 0) { 712 type = type.invariantOf(context); 713 } else if ((storage_class & STCconst) != 0) { 714 type = type.constOf(context); 715 } 716 } 679 717 680 718 sc = sc.push(this); 681 sc.stc &= ~(STCfinal | STCauto | STCscope | STCstatic | STCabstract | STCdeprecated); 719 720 if (context.isD2()) { 721 sc.stc &= ~(STCfinal | STCauto | STCscope | STCstatic | 722 STCabstract | STCdeprecated | STCconst | STCinvariant | STCtls); 723 sc.stc |= storage_class & (STCconst | STCinvariant); 724 } else { 725 sc.stc &= ~(STCfinal | STCauto | STCscope | STCstatic | STCabstract | STCdeprecated); 726 } 682 727 683 728 sc.parent = this; … … 768 813 members.add(ctor); 769 814 ctor.addMember(sc, this, 1, context); 770 sc = scsave; // why? What about sc ->nofree?815 sc = scsave; // why? What about sc.nofree? 771 816 sc.offset = structsize; 772 817 ctor.semantic(sc, context); … … 777 822 for (i = 0; i < vtblInterfaces.size(); i++) 778 823 { 779 BaseClass b = (BaseClass)vtblInterfaces.get(i);824 BaseClass b = vtblInterfaces.get(i); 780 825 int thissize = Type.PTRSIZE; 781 826 … … 797 842 798 843 sc.offset += thissize; 799 if (alignsize < thissize) 800 alignsize = thissize; 844 if (alignsize < thissize) { 845 alignsize = thissize; 846 } 801 847 } 802 848 … … 836 882 return false; 837 883 } 838 FuncDeclaration fdstart = s.toAlias(context).isFuncDeclaration(); 839 return !(overloadApply(fdstart, isf, fd, context) == 1 ? true : false); 884 885 if (context.isD2()) { 886 s = s.toAlias(context); 887 OverloadSet os = s.isOverloadSet(); 888 if (os != null) { 889 for (int i = 0; i < size(os.a); i++) { 890 Dsymbol s2 = (Dsymbol) os.a.get(i); 891 FuncDeclaration f2 = s2.isFuncDeclaration(); 892 if (f2 != null && overloadApply(f2, isf, fd, context)) 893 return false; 894 } 895 return true; 896 } else { 897 FuncDeclaration fdstart = s.isFuncDeclaration(); 898 return !overloadApply(fdstart, isf, fd, context); 899 } 900 } else { 901 FuncDeclaration fdstart = s.toAlias(context).isFuncDeclaration(); 902 return !overloadApply(fdstart, isf, fd, context); 903 } 840 904 } 841 905 … … 942 1006 } 943 1007 1008 @Override 944 1009 public char getSignaturePrefix() { 945 1010 if (templated) { trunk/descent.core/src/descent/internal/compiler/parser/DeclarationExp.java
r1160 r1176 46 46 } else { 47 47 boolean condition; 48 if (context. apiLevel == Parser.D2) {48 if (context.isD2()) { 49 49 condition = s == v && (v.isConst() || v.isInvariant()) && v.init != null; 50 50 } else { trunk/descent.core/src/descent/internal/compiler/parser/Dsymbol.java
r1160 r1176 318 318 319 319 public NewDeclaration isNewDeclaration() { 320 return null; 321 } 322 323 public OverloadSet isOverloadSet() { 320 324 return null; 321 325 } trunk/descent.core/src/descent/internal/compiler/parser/Expression.java
r1160 r1176 8 8 import static descent.internal.compiler.parser.LINK.LINKd; 9 9 10 import static descent.internal.compiler.parser.MATCH.MATCHconst; 10 11 import static descent.internal.compiler.parser.MATCH.MATCHconvert; 12 import static descent.internal.compiler.parser.MATCH.MATCHexact; 11 13 import static descent.internal.compiler.parser.MATCH.MATCHnomatch; 12 14 … … 259 261 public Expression copy() { 260 262 try { 261 return (Expression) clone(); 263 Expression exp = (Expression) clone(); 264 exp.copySourceRange(this); 265 return exp; 262 266 } catch (CloneNotSupportedException e) { 263 267 throw new RuntimeException(e); … … 282 286 283 287 public Expression implicitCastTo(Scope sc, Type t, SemanticContext context) { 284 if (implicitConvTo(t, context) != MATCHnomatch) { 288 MATCH match = implicitConvTo(t, context); 289 if (match != MATCHnomatch) { 285 290 if (context.global.params.warnings 286 291 && Type.impcnvWarn[type.toBasetype(context).ty.ordinal()][t … … 300 305 } 301 306 } 307 if (context.isD2()) { 308 if (match == MATCHconst && t == type.constOf(context)) { 309 Expression e = copy(); 310 e.type = t; 311 return e; 312 } 313 } 302 314 return castTo(sc, t, context); 303 315 } … … 347 359 } 348 360 349 if (t.ty == Tbit && isBit()) { 350 return MATCHconvert; 361 if (!context.isD2()) { 362 if (t.ty == Tbit && isBit()) { 363 return MATCHconvert; 364 } 351 365 } 352 366 Expression e = optimize(WANTvalue | WANTflags, context); 367 if (context.isD2()) { 368 if (e.type == t) { 369 return MATCHexact; 370 } 371 } 372 353 373 if (e != this) { 354 374 return e.implicitConvTo(t, context); trunk/descent.core/src/descent/internal/compiler/parser/IntegerExp.java
r1160 r1176 7 7 import descent.internal.compiler.parser.ast.IASTVisitor; 8 8 9 import static descent.internal.compiler.parser.MATCH.MATCHconst; 9 10 import static descent.internal.compiler.parser.MATCH.MATCHconvert; 10 11 import static descent.internal.compiler.parser.MATCH.MATCHexact; … … 13 14 import static descent.internal.compiler.parser.TY.Tenum; 14 15 import static descent.internal.compiler.parser.TY.Tint32; 16 import static descent.internal.compiler.parser.TY.Tpointer; 15 17 import static descent.internal.compiler.parser.TY.Tuns32; 16 18 import static descent.internal.compiler.parser.TY.Tuns64; … … 101 103 @Override 102 104 public MATCH implicitConvTo(Type t, SemanticContext context) { 103 if (type.equals(t)) { 104 return MATCHexact; 105 } 106 107 TY ty = type.toBasetype(context).ty; 108 TY toty = t.toBasetype(context).ty; 109 110 if (type.implicitConvTo(t, context) == MATCHnomatch && t.ty == Tenum) { 111 return MATCHnomatch; 105 TY ty; 106 TY toty; 107 108 if (context.isD2()) { 109 MATCH m = type.implicitConvTo(t, context); 110 if (m.ordinal() >= MATCHconst.ordinal()) { 111 return m; 112 } 113 114 ty = type.toBasetype(context).ty; 115 toty = t.toBasetype(context).ty; 116 117 if (m == MATCHnomatch && t.ty == Tenum) { 118 // goto Lno; 119 return MATCHnomatch; 120 } 121 } else { 122 if (type.equals(t)) { 123 return MATCHexact; 124 } 125 126 ty = type.toBasetype(context).ty; 127 toty = t.toBasetype(context).ty; 128 129 if (type.implicitConvTo(t, context) == MATCHnomatch 130 && t.ty == Tenum) { 131 return MATCHnomatch; 132 } 112 133 } 113 134 … … 215 236 return MATCHconvert; 216 237 217 218 238 case Tfloat32: 219 239 float f; … … 222 242 return MATCHnomatch; 223 243 return MATCHconvert; 224 225 case Tfloat64: 226 double d; 227 d = value.floatValue(); 228 if (!value.isExactly(d)) 229 return MATCHnomatch; 230 return MATCHconvert; 231 232 // TODO this isn't right, make sure th integer can fit in 80 bits. 233 // in practice, since there' no cent types yet, any 64-bit integer 234 // will fit in an 80-bit real 235 case Tfloat80: 236 return MATCHconvert; 237 244 245 case Tfloat64: 246 double d; 247 d = value.floatValue(); 248 if (!value.isExactly(d)) 249 return MATCHnomatch; 250 return MATCHconvert; 251 252 // TODO this isn't right, make sure th integer can fit in 80 bits. 253 // in practice, since there' no cent types yet, any 64-bit integer 254 // will fit in an 80-bit real 255 case Tfloat80: 256 return MATCHconvert; 257 258 case Tpointer: 259 if (context.isD2()) { 260 if (ty == Tpointer 261 && type.toBasetype(context).nextOf().ty == t 262 .toBasetype(context).nextOf().ty) { 263 /* Allow things like: 264 * const char* P = cast(char *)3; 265 * char* q = P; 266 */ 267 // goto Lyes; 268 return MATCHconvert; 269 } 270 } 271 break; 272 238 273 } 239 274 return super.implicitConvTo(t, context); trunk/descent.core/src/descent/internal/compiler/parser/InterfaceDeclaration.java
r1173 r1176 10 10 import static descent.internal.compiler.parser.LINK.LINKwindows; 11 11 12 import static descent.internal.compiler.parser.STC.STCabstract; 13 import static descent.internal.compiler.parser.STC.STCauto; 14 import static descent.internal.compiler.parser.STC.STCconst; 15 import static descent.internal.compiler.parser.STC.STCdeprecated; 16 import static descent.internal.compiler.parser.STC.STCfinal; 17 import static descent.internal.compiler.parser.STC.STCinvariant; 18 import static descent.internal.compiler.parser.STC.STCscope; 19 import static descent.internal.compiler.parser.STC.STCstatic; 20 import static descent.internal.compiler.parser.STC.STCtls; 21 12 22 import static descent.internal.compiler.parser.TY.Tclass; 13 23 import static descent.internal.compiler.parser.TY.Ttuple; … … 16 26 public class InterfaceDeclaration extends ClassDeclaration { 17 27 18 int cpp; // !=0 if this is a C++ interface19 20 28 public InterfaceDeclaration(Loc loc, IdentifierExp id, 21 29 BaseClasses baseclasses) { … … 26 34 // objects 27 35 com = true; 36 cpp = true; 28 37 } 29 38 } … … 268 277 // Lcontinue: ; 269 278 } 279 280 if (context.isD2()) { 281 protection = sc.protection; 282 storage_class |= sc.stc & (STCconst | STCinvariant); 283 } 270 284 271 285 for (Dsymbol s : members) { … … 274 288 275 289 sc = sc.push(this); 290 291 if (context.isD2()) { 292 sc.stc &= ~(STCfinal | STCauto | STCscope | STCstatic | 293 STCabstract | STCdeprecated | STCconst | STCinvariant | STCtls); 294 sc.stc |= storage_class & (STCconst | STCinvariant); 295 } 296 276 297 sc.parent = this; 277 298 if (isCOMinterface()) { 278 299 sc.linkage = LINKwindows; 300 } else if (context.isD2() && isCPPinterface()) { 301 sc.linkage = LINK.LINKcpp; 279 302 } 280 303 sc.structalign = 8; … … 315 338 @Override 316 339 public int vtblOffset() { 317 if (isCOMinterface() ) {340 if (isCOMinterface() || isCPPinterface()) { 318 341 return 0; 319 342 } … … 324 347 public boolean isCOMinterface() { 325 348 return com; 349 } 350 351 @Override 352 public boolean isCPPinterface() { 353 return cpp; 326 354 } 327 355 trunk/descent.core/src/descent/internal/compiler/parser/IsExp.java
r1173 r1176 267 267 } 268 268 269 if (context. apiLevel == Parser.D2) {269 if (context.isD2()) { 270 270 if (parameters != null) { 271 271 // First parameter is already output, so start with second trunk/descent.core/src/descent/internal/compiler/parser/Lexer.java
r1165 r1176 4656 4656 int c; 4657 4657 //Loc start = loc; 4658 4659 int firstLineBreak = -1; 4658 4660 4659 4661 p++; … … 4679 4681 case '\n': 4680 4682 newline(NOT_IN_COMMENT); 4681 break; 4683 4684 // Changed from DMD to allow better error reporting 4685 error(IProblem.UnterminatedStringConstant, token.lineNumber, 4686 token.ptr, p - token.ptr); 4687 t.ustring = CharOperation.NO_CHAR; 4688 t.len = 0; 4689 t.postfix = 0; 4690 4691 t.sourceLen = 0; 4692 return TOKstring; 4682 4693 4683 4694 case '\r': … … 4687 4698 c = '\n'; // treat EndOfLine as \n character 4688 4699 newline(NOT_IN_COMMENT); 4689 break; 4700 4701 // Changed from DMD to allow better error reporting 4702 error(IProblem.UnterminatedStringConstant, token.lineNumber, 4703 token.ptr, p - token.ptr); 4704 t.ustring = CharOperation.NO_CHAR; 4705 t.len = 0; 4706 t.postfix = 0; 4707 4708 t.sourceLen = 0; 4709 return TOKstring; 4690 4710 4691 4711 case '"': trunk/descent.core/src/descent/internal/compiler/parser/MATCH.java
r1160 r1176 6 6 MATCHnomatch, // no match 7 7 MATCHconvert, // match with conversions 8 MATCHconst, // match with conversions to const 8 9 MATCHexact // exact match 9 10 trunk/descent.core/src/descent/internal/compiler/parser/NullExp.java
r1160 r1176 1 1 package descent.internal.compiler.parser; 2 2 3 import descent.internal.compiler.parser.ast.IASTVisitor; 4 5 import static descent.internal.compiler.parser.MATCH.MATCHconst; 3 6 import static descent.internal.compiler.parser.MATCH.MATCHconvert; 4 7 import static descent.internal.compiler.parser.MATCH.MATCHexact; 8 5 9 import static descent.internal.compiler.parser.TY.Taarray; 6 10 import static descent.internal.compiler.parser.TY.Tarray; … … 10 14 import static descent.internal.compiler.parser.TY.Ttypedef; 11 15 import static descent.internal.compiler.parser.TY.Tvoid; 12 import descent.internal.compiler.parser.ast.IASTVisitor;13 16 14 17 … … 70 73 return MATCHexact; 71 74 } 75 76 if (context.isD2()) { 77 /* Allow implicit conversions from invariant to mutable|const, 78 * and mutable to invariant. It works because, after all, a null 79 * doesn't actually point to anything. 80 */ 81 if (t.invariantOf(context).equals(type.invariantOf(context))) { 82 return MATCHconst; 83 } 84 } 85 72 86 // NULL implicitly converts to any pointer type or dynamic array 73 87 if (type.ty == Tpointer && type.next.ty == Tvoid) { trunk/descent.core/src/descent/internal/compiler/parser/PragmaDeclaration.java
r1163 r1176 96 96 semantic_Lnodecl(context); 97 97 return; 98 } else if (context. apiLevel == Parser.D2&& equals(ident, Id.startaddress)) {98 } else if (context.isD2() && equals(ident, Id.startaddress)) { 99 99 if (args == null || args.size() != 1) { 100 100 if (context.acceptsProblems()) { … … 159 159 buf.writestring(ident.toChars()); 160 160 if (args != null && args.size() != 0) { 161 if (context. apiLevel == Parser.D2) {161 if (context.isD2()) { 162 162 buf.writestring(", "); 163 163 argsToCBuffer(buf, args, hgs, context); trunk/descent.core/src/descent/internal/compiler/parser/Problem.java
r1167 r1176 1052 1052 case CannotHaveEDotTuple: 1053 1053 return String.format(ProblemMessages.CannotHaveEDotTuple); 1054 case CannotCreateCppClasses: 1055 return String.format(ProblemMessages.CannotCreateCppClasses); 1054 1056 default: 1055 1057 return ""; trunk/descent.core/src/descent/internal/compiler/parser/ProblemMessages.java
r1167 r1176 473 473 public static String PostBlitsAreOnlyForStructUnionDefinitions; 474 474 public static String CannotHaveEDotTuple; 475 public static String CannotCreateCppClasses; 475 476 476 477 static { trunk/descent.core/src/descent/internal/compiler/parser/ProblemMessages.properties
r1167 r1176 461 461 PostBlitsAreOnlyForStructUnionDefinitions=Post blits are only for struct/union definitions 462 462 CannotHaveEDotTuple=Cannot have e.tuple 463 CannotCreateCppClasses=Cannot create C++ classes trunk/descent.core/src/descent/internal/compiler/parser/SemanticContext.java
r1173 r1176 324 324 } 325 325 326 if ( apiLevel == Lexer.D2) {326 if (isD2()) { 327 327 if (ASTDmdNode.equals(s.ident, Id.TypeInfo_Const)) { 328 328 Type_typeinfoconst = (ClassDeclaration) s; … … 341 341 typeInfoDeclarations.put(t, vtinfo); 342 342 } 343 344 public boolean isD2() { 345 return apiLevel == Parser.D2; 346 } 343 347 344 348 } trunk/descent.core/src/descent/internal/compiler/parser/StorageClassDeclaration.java
r1163 r1176 112 112 int stc_save = sc.stc; 113 113 114 if (context. apiLevel == Parser.D2) {114 if (context.isD2()) { 115 115 /* These sets of storage classes are mutually exclusive, 116 116 * so choose the innermost or most recent one. … … 170 170 boolean written = false; 171 171 172 SCstring[] theTable = context. apiLevel == Parser.D2? table2 : table1;172 SCstring[] theTable = context.isD2() ? table2 : table1; 173 173 174 174 for (SCstring sc : theTable) { trunk/descent.core/src/descent/internal/compiler/parser/StringExp.java
r1160 r1176 179 179 public MATCH implicitConvTo(Type t, SemanticContext context) { 180 180 if (!committed) { 181 if (!committed && t.ty == Tpointer && t.next.ty == Tvoid) { 181 boolean comparison = context.isD2() ? t.nextOf().ty == Tvoid : t.next.ty == Tvoid; 182 if (!committed && t.ty == Tpointer && comparison) { 182 183 return MATCHnomatch; 183 184 } … … 241 242 if (!committed) { 242 243 se = (StringExp) copy(); 243 244 // Descent245 se.copySourceRange(this);246 247 244 se.committed = true; 248 249 245 copied = 1; // this is the only instance 250 246 } … … 262 258 if (0 == copied) { 263 259 se = (StringExp) copy(); 264 // Descent265 se.copySourceRange(this);266 267 260 copied = 1; 268 261 } … … 274 267 if (0 == copied) { 275 268 se = (StringExp) copy(); 276 // Descent277 se.copySourceRange(this);278 269 copied = 1; 279 270 } … … 284 275 if (0 == copied) { 285 276 se = (StringExp) copy(); 286 // Descent287 se.copySourceRange(this);288 289 277 copied = 1; 290 278 } … … 298 286 if (0 == copied) { 299 287 se = (StringExp) copy(); 300 // Descent301 se.copySourceRange(this);302 303 288 copied = 1; 304 289 } … … 352 337 if (0 == copied) { 353 338 se = (StringExp) copy(); 354 // Descent355 se.copySourceRange(this);356 339 } 357 340 buffer.data.getChars(0, buffer.offset(), … … 375 358 if (0 == copied) { 376 359 se = (StringExp) copy(); 377 // Descent378 se.copySourceRange(this);379 360 &nb
