Changeset 1223
- Timestamp:
- 07/12/08 14:05:38 (2 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/ArrayLiteralExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/CallExp.java (modified) (6 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/CompileDeclaration.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/CompileStatement.java (modified) (6 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/CompoundStatement.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/ConditionalStatement.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Constfold.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/CtorDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/DotVarExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Dsymbol.java (modified) (6 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/EnumDeclaration.java (modified) (5 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/Expression.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/FuncDeclaration.java (modified) (4 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/FuncLiteralDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Id.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/IntegerExp.java (modified) (5 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/STC.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/ScopeDsymbol.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/StaticCtorDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/StaticDtorDeclaration.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/StructDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/SuperExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/TemplateDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/TemplateInstance.java (modified) (4 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TemplateMixin.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/ThisExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Type.java (modified) (5 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TypeClass.java (modified) (5 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TypeQualified.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/TypeStruct.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TypeTypeof.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TypedefDeclaration.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TypeidExp.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/VarDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/object1.d (deleted)
- trunk/descent.core/src/descent/internal/compiler/parser/object2.d (deleted)
- trunk/descent.core/src/descent/internal/compiler/parser/port.txt (modified) (1 diff)
- trunk/descent.core/template/problem/problems.txt (modified) (2 diffs)
- trunk/descent.debug.core/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/descent.debug.core/plugin.xml (modified) (1 diff)
- trunk/descent.debug.core/src/descent/internal/debug/core/model/gdb/GdbDebugger.java (modified) (3 diffs)
- trunk/descent.debug.ui/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/descent.launching/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/descent.tests/descent/tests/mangling/SignatureParameterCount_Test.java (modified) (1 diff)
- trunk/descent.tests/descent/tests/mangling/SignatureParameterTypes_Test.java (modified) (1 diff)
- trunk/descent.tests/descent/tests/mangling/SignatureReturnType_Test.java (modified) (1 diff)
- trunk/descent.tests/descent/tests/mangling/SignatureToCharArray_Test.java (modified) (1 diff)
- trunk/descent.tests/descent/tests/mangling/SignatureToType_Test.java (modified) (2 diffs)
- trunk/descent.ui-feature/feature.xml (modified) (1 diff)
- trunk/descent.ui.astviewer/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/descent.ui.metrics/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/descent.ui/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/descent.ui/src/descent/ui/JavaElementLabels.java (modified) (2 diffs)
- trunk/descent.unittest/src/descent/internal/unittest/ui/OpenModuleAction.java (modified) (1 diff)
- trunk/descent.unittest/src/descent/internal/unittest/ui/TraceUtil.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/descent.core/src/descent/core/compiler/IProblem.java
r1222 r1223 683 683 int WithoutThisCannotBeConstInvariant = 472; 684 684 int CannotModifySymbol = 473; 685 int CannotCallPublicExportFunctionFromInvariant = 474; 686 int TemplateMemberFunctionNotAllowedInInterface = 475; 687 int ArgumentToTypeofIsNotAnExpression = 476; 685 688 686 689 } trunk/descent.core/src/descent/internal/compiler/parser/ASTDmdNode.java
r1203 r1223 815 815 } 816 816 if (!gotoL2) { 817 arg = p.defaultArg.copy(); 817 arg = p.defaultArg; 818 arg = arg.copy(); 818 819 arguments.add(arg); 819 820 nargs++; … … 962 963 if (tb.ty == Tsarray) { 963 964 TypeSArray ts = (TypeSArray) tb; 964 Type ta = t b.next.arrayOf(context);965 Type ta = ts.next.arrayOf(context); 965 966 if (ts.size(arg.loc, context) == 0) { 966 967 arg = new NullExp(arg.loc); … … 2016 2017 2017 2018 if (ad != null 2018 && !(t.ty == Tpointer && t.next .ty == Tstruct && ((TypeStruct) t.next).sym == ad)2019 && !(t.ty == Tpointer && t.nextOf().ty == Tstruct && ((TypeStruct) t.nextOf()).sym == ad) 2019 2020 && !(t.ty == Tstruct && ((TypeStruct) t).sym == ad)) { 2020 2021 ClassDeclaration cd = ad.isClassDeclaration(); … … 2026 2027 2027 2028 e1 = new DotVarExp(loc, e1, tcd.vthis); 2028 e1 = e1.semantic(sc, context); 2029 e1.type = tcd.vthis.type; 2030 // e1 = e1.semantic(sc, context); 2029 2031 2030 2032 // Skip over nested functions, and get the enclosing 2031 2033 // class type. 2032 Dsymbol s = tcd.toParent(); 2033 while (s != null && s.isFuncDeclaration() != null) { 2034 int n = 0; 2035 Dsymbol s; 2036 for(s = tcd.toParent(); s != null && s.isFuncDeclaration() != null; s = s.toParent()) { 2034 2037 FuncDeclaration f = s.isFuncDeclaration(); 2035 2038 if (f.vthis != null) { 2039 n++; 2036 2040 e1 = new VarExp(loc, f.vthis); 2037 2041 } … … 2040 2044 if (s != null && s.isClassDeclaration() != null) { 2041 2045 e1.type = s.isClassDeclaration().type; 2046 if (n > 1) { 2047 e1 = e1.semantic(sc, context); 2048 } 2049 } else { 2050 e1 = e1.semantic(sc, context); 2042 2051 } 2043 e1 = e1.semantic(sc, context);2044 2052 // goto L1; 2045 2053 gotoL1 = true; trunk/descent.core/src/descent/internal/compiler/parser/ArrayLiteralExp.java
r1201 r1223 22 22 this.sourceElements = new Expressions(elements); 23 23 } 24 } 25 26 public ArrayLiteralExp(Loc loc, Expression e) { 27 super(loc, TOK.TOKarrayliteral); 28 this.elements = new Expressions(); 29 this.elements.add(e); 30 this.sourceElements = new Expressions(elements); 24 31 } 25 32 trunk/descent.core/src/descent/internal/compiler/parser/CallExp.java
r1222 r1223 1 1 package descent.internal.compiler.parser; 2 2 3 import melnorme.miscutil.tree.TreeVisitor;4 5 import org.eclipse.core.runtime.Assert;6 7 import descent.core.compiler.IProblem;8 import descent.internal.compiler.parser.ast.IASTVisitor;9 3 import static descent.internal.compiler.parser.LINK.LINKd; 10 11 4 import static descent.internal.compiler.parser.STC.STClazy; 12 13 5 import static descent.internal.compiler.parser.Scope.CSXany_ctor; 14 6 import static descent.internal.compiler.parser.Scope.CSXlabel; … … 25 17 import static descent.internal.compiler.parser.TOK.TOKtemplate; 26 18 import static descent.internal.compiler.parser.TOK.TOKthis; 27 import static descent.internal.compiler.parser.TOK. *;28 19 import static descent.internal.compiler.parser.TOK.TOKtype; 20 import static descent.internal.compiler.parser.TOK.TOKvar; 29 21 import static descent.internal.compiler.parser.TY.Taarray; 30 22 import static descent.internal.compiler.parser.TY.Tarray; … … 36 28 import static descent.internal.compiler.parser.TY.Tstruct; 37 29 import static descent.internal.compiler.parser.TY.Tvoid; 30 import melnorme.miscutil.tree.TreeVisitor; 31 32 import org.eclipse.core.runtime.Assert; 33 34 import descent.core.compiler.IProblem; 35 import descent.internal.compiler.parser.ast.IASTVisitor; 38 36 39 37 … … 414 412 ue.e1 = getRightThis(loc, sc, ad, ue.e1, f, context); 415 413 } 414 415 /* Cannot call public functions from inside invariant 416 * (because then the invariant would have infinite recursion) 417 */ 418 if (sc.func != null && sc.func.isInvariantDeclaration() != null && 419 ue.e1.op == TOKthis && 420 f.addPostInvariant(context) 421 ) { 422 if (context.acceptsErrors()) { 423 context.acceptProblem(Problem.newSemanticTypeError(IProblem.CannotCallPublicExportFunctionFromInvariant, this, f.toChars(context))); 424 } 425 } 416 426 417 427 checkDeprecated(sc, f, context); … … 463 473 return this; 464 474 } else { 465 if (sc.noctor != 0 || (sc.callSuper & CSXlabel) != 0) { 466 if (context.acceptsErrors()) { 467 context.acceptProblem(Problem.newSemanticTypeErrorLoc(IProblem.ConstructorCallsNotAllowedInLoopsOrAfterLabels, this)); 475 if (0 == sc.intypeof) { 476 if (sc.noctor != 0 || (sc.callSuper & CSXlabel) != 0) { 477 if (context.acceptsErrors()) { 478 context.acceptProblem(Problem.newSemanticTypeErrorLoc(IProblem.ConstructorCallsNotAllowedInLoopsOrAfterLabels, this)); 479 } 468 480 } 469 }470 if ((sc.callSuper & (CSXsuper_ctor | CSXthis_ctor)) != 0) {471 if (context.acceptsErrors()) {472 context.acceptProblem(Problem.newSemanticTypeError(IProblem.MultipleConstructorCalls, this));481 if ((sc.callSuper & (CSXsuper_ctor | CSXthis_ctor)) != 0) { 482 if (context.acceptsErrors()) { 483 context.acceptProblem(Problem.newSemanticTypeError(IProblem.MultipleConstructorCalls, this)); 484 } 473 485 } 474 }475 sc.callSuper |= CSXany_ctor | CSXsuper_ctor;486 sc.callSuper |= CSXany_ctor | CSXsuper_ctor; 487 } 476 488 477 489 f = f.overloadResolve(loc, null, arguments, context, this); … … 496 508 return this; 497 509 } else { 498 if (sc.noctor != 0 || (sc.callSuper & CSXlabel) != 0) { 499 if (context.acceptsErrors()) { 500 context.acceptProblem(Problem.newSemanticTypeError(IProblem.ConstructorCallsNotAllowedInLoopsOrAfterLabels, getLineNumber(), getErrorStart(), getErrorLength())); 501 } 502 } 503 if ((sc.callSuper & (CSXsuper_ctor | CSXthis_ctor)) != 0) { 504 if (context.acceptsErrors()) { 505 context.acceptProblem(Problem.newSemanticTypeError(IProblem.MultipleConstructorCalls, this)); 506 } 507 } 508 sc.callSuper |= CSXany_ctor | CSXthis_ctor; 510 if (0 == sc.intypeof) 511 { 512 if (sc.noctor != 0 || (sc.callSuper & CSXlabel) != 0) { 513 if (context.acceptsErrors()) { 514 context.acceptProblem(Problem.newSemanticTypeError(IProblem.ConstructorCallsNotAllowedInLoopsOrAfterLabels, getLineNumber(), getErrorStart(), getErrorLength())); 515 } 516 } 517 if ((sc.callSuper & (CSXsuper_ctor | CSXthis_ctor)) != 0) { 518 if (context.acceptsErrors()) { 519 context.acceptProblem(Problem.newSemanticTypeError(IProblem.MultipleConstructorCalls, this)); 520 } 521 } 522 sc.callSuper |= CSXany_ctor | CSXthis_ctor; 523 } 509 524 510 525 f = cd.ctor; trunk/descent.core/src/descent/internal/compiler/parser/CompileDeclaration.java
r1201 r1223 16 16 public Expression exp, sourceExp; 17 17 public ScopeDsymbol sd; 18 public boolean compiled; 18 19 19 20 protected IInitializer javaElement; … … 40 41 SemanticContext context) { 41 42 this.sd = sd; 43 if (memnum == 0) { 44 /* 45 * No members yet, so parse the mixin now 46 */ 47 compileIt(sc, context); 48 memnum |= super.addMember(sc, sd, memnum, context); 49 compiled = true; 50 } 42 51 return memnum; 52 } 53 54 public void compileIt(Scope sc, SemanticContext context) { 55 exp = exp.semantic(sc, context); 56 exp = resolveProperties(sc, exp, context); 57 exp = exp.optimize(WANTvalue | WANTinterpret, context); 58 if (exp.op != TOKstring) { 59 if (context.acceptsErrors()) { 60 context.acceptProblem(Problem.newSemanticTypeError(IProblem.ArgumentToMixinMustBeString, this, exp.toChars(context))); 61 } 62 } 63 else 64 { 65 StringExp se = (StringExp) exp; 66 se = se.toUTF8(sc, context); 67 Parser p = new Parser(context.Module_rootModule.apiLevel, se.string); 68 // p.nextToken(); 69 p.loc = loc; 70 decl = p.parseModule(); 71 for(Dsymbol s : decl) { 72 s.accept(new AstVisitorAdapter() { 73 @Override 74 public void preVisit(ASTNode node) { 75 if (node instanceof ASTDmdNode) { 76 ASTDmdNode s = (ASTDmdNode) node; 77 s.synthetic = true; 78 s.setStart(getStart() + 1); 79 s.setLength(getLength()); 80 s.setLineNumber(getLineNumber()); 81 s.creator = CompileDeclaration.this; 82 } 83 } 84 }); 85 } 86 87 // TODO semantic do this better 88 if (p.problems != null) { 89 for (int i = 0; i < p.problems.size(); i++) { 90 Problem problem = (Problem) p.problems.get(i); 91 problem.setSourceStart(start); 92 problem.setSourceEnd(start + length - 1); 93 context.acceptProblem(problem); 94 } 95 } 96 97 if (p.token.value != TOKeof) { 98 if (context.acceptsErrors()) { 99 context.acceptProblem(Problem.newSemanticTypeError( 100 IProblem.IncompleteMixinDeclaration, this, 101 new String[] { se.toChars(context) })); 102 } 103 } 104 } 43 105 } 44 106 … … 50 112 @Override 51 113 public void semantic(Scope sc, SemanticContext context) { 52 exp = exp.semantic(sc, context); 53 exp = resolveProperties(sc, exp, context); 54 exp = exp.optimize(WANTvalue | WANTinterpret, context); 55 if (exp.op != TOKstring) { 56 if (context.acceptsErrors()) { 57 context.acceptProblem(Problem.newSemanticTypeError(IProblem.ArgumentToMixinMustBeString, this, exp.toChars(context))); 58 } 59 return; 114 if (!compiled) { 115 compileIt(sc, context); 116 super.addMember(sc, sd, 0, context); 117 compiled = true; 60 118 } 61 StringExp se = (StringExp) exp;62 se = se.toUTF8(sc, context);63 Parser p = new Parser(context.Module_rootModule.apiLevel, se.string);64 // p.nextToken();65 p.loc = loc;66 decl = p.parseModule();67 for(Dsymbol s : decl) {68 s.accept(new AstVisitorAdapter() {69 @Override70 public void preVisit(ASTNode node) {71 if (node instanceof ASTDmdNode) {72 ASTDmdNode s = (ASTDmdNode) node;73 s.synthetic = true;74 s.setStart(getStart() + 1);75 s.setLength(getLength());76 s.setLineNumber(getLineNumber());77 s.creator = CompileDeclaration.this;78 }79 }80 });81 }82 83 // TODO semantic do this better84 if (p.problems != null) {85 for (int i = 0; i < p.problems.size(); i++) {86 Problem problem = (Problem) p.problems.get(i);87 problem.setSourceStart(start);88 problem.setSourceEnd(start + length - 1);89 context.acceptProblem(problem);90 }91 }92 93 if (p.token.value != TOKeof) {94 if (context.acceptsErrors()) {95 context.acceptProblem(Problem.newSemanticTypeError(96 IProblem.IncompleteMixinDeclaration, this,97 new String[] { se.toChars(context) }));98 }99 }100 101 super.addMember(sc, sd, 0, context);102 119 super.semantic(sc, context); 103 120 } trunk/descent.core/src/descent/internal/compiler/parser/CompileStatement.java
r1201 r1223 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.ASTNode;6 import descent.internal.compiler.parser.ast.AstVisitorAdapter;7 import descent.internal.compiler.parser.ast.IASTVisitor;8 3 import static descent.internal.compiler.parser.Parser.PScurlyscope; 9 4 import static descent.internal.compiler.parser.Parser.PSsemi; 10 5 import static descent.internal.compiler.parser.TOK.TOKeof; 6 import melnorme.miscutil.tree.TreeVisitor; 7 import descent.core.compiler.IProblem; 8 import descent.internal.compiler.parser.ast.IASTVisitor; 11 9 12 10 … … 35 33 36 34 @Override 37 public Statement semantic(Scope sc, SemanticContext context) {35 public Statements flatten(Scope sc, SemanticContext context) { 38 36 exp = exp.semantic(sc, context); 39 37 exp = ASTDmdNode.resolveProperties(sc, exp, context); … … 44 42 context.acceptProblem(Problem.newSemanticTypeError(IProblem.ArgumentToMixinMustBeString, this, exp.toChars(context))); 45 43 } 46 return this;44 return null; 47 45 } 48 46 StringExp se = (StringExp) exp; … … 51 49 p.loc = loc; 52 50 53 Statements statements= new Statements();51 Statements a = new Statements(); 54 52 while (p.token.value != TOKeof) { 55 53 Statement s = p.parseStatement(PSsemi | PScurlyscope); … … 70 68 // }); 71 69 72 statements.add(s);70 a.add(s); 73 71 } 74 72 … … 83 81 } 84 82 85 Statement s = new CompoundStatement(loc, statements); 86 return s.semantic(sc, context); 83 return a; 84 } 85 86 @Override 87 public Statement semantic(Scope sc, SemanticContext context) { 88 Statements a = flatten(sc, context); 89 if (null == a) { 90 return null; 91 } 92 Statement s = new CompoundStatement(loc, a); 93 return s.semantic(sc, context); 87 94 } 88 95 trunk/descent.core/src/descent/internal/compiler/parser/CompoundStatement.java
r1201 r1223 248 248 } 249 249 if (statements != null && statements.size() == 1) { 250 return s ;250 return statements.get(0); 251 251 } 252 252 return this; trunk/descent.core/src/descent/internal/compiler/parser/ConditionalStatement.java
r1201 r1223 81 81 condition.toCBuffer(buf, hgs, context); 82 82 buf.writenl(); 83 buf.writeByte('{'); 84 buf.writenl(); 83 85 if (ifbody != null) { 84 86 ifbody.toCBuffer(buf, hgs, context); 85 87 } 88 buf.writeByte('}'); 89 buf.writenl(); 86 90 if (elsebody != null) { 87 91 buf.writestring("else"); 88 92 buf.writenl(); 93 buf.writeByte('{'); 94 buf.writenl(); 89 95 elsebody.toCBuffer(buf, hgs, context); 96 buf.writeByte('}'); 97 buf.writenl(); 90 98 } 91 99 buf.writenl(); trunk/descent.core/src/descent/internal/compiler/parser/Constfold.java
r1201 r1223 875 875 } 876 876 877 else if ( e1.op == TOKarrayliteral877 else if ((e1.op == TOKarrayliteral || e1.op == TOKnull) 878 878 && e1.type.toBasetype(context).nextOf().equals(e2.type)) { 879 ArrayLiteralExp es1 = (ArrayLiteralExp) e1; 880 881 ArrayLiteralExp ale = new ArrayLiteralExp(es1.loc, 882 new Expressions(es1.elements.size() + 1)); 883 ale.elements.addAll(es1.elements); 884 ale.elements.add(e2); 885 e = ale; 879 ArrayLiteralExp es1; 880 if (e1.op == TOKarrayliteral) { 881 es1 = (ArrayLiteralExp) e1; 882 es1 = new ArrayLiteralExp(es1.loc, es1.elements.copy()); 883 es1.elements.add(e2); 884 } else { 885 es1 = new ArrayLiteralExp(e1.loc, e2); 886 } 887 e = es1; 886 888 887 889 if (type.toBasetype(context).ty == Tsarray) { trunk/descent.core/src/descent/internal/compiler/parser/CtorDeclaration.java
r1201 r1223 89 89 } 90 90 type = new TypeFunction(arguments, tret, varargs, LINK.LINKd); 91 92 if (null == originalType) { 93 originalType = type; 94 } 91 95 92 96 sc.flags |= Scope.SCOPEctor; trunk/descent.core/src/descent/internal/compiler/parser/DotVarExp.java
r1203 r1223 127 127 .isAggregateDeclaration(); 128 128 e1 = getRightThis(loc, sc, ad, e1, var, context); 129 accessCheck(sc, e1, var, context, ident); 129 if (0 == sc.noaccesscheck) { 130 accessCheck(sc, e1, var, context, ident); 131 } 132 133 VarDeclaration v = var.isVarDeclaration(); 134 if (v != null && v.isConst()) { 135 ExpInitializer ei = v.getExpInitializer(context); 136 if (ei != null) { 137 Expression e = ei.exp.copy(); 138 e = e.semantic(sc, context); 139 return e; 140 } 141 } 130 142 } 131 143 } trunk/descent.core/src/descent/internal/compiler/parser/Dsymbol.java
r1203 r1223 1 1 package descent.internal.compiler.parser; 2 3 import static descent.internal.compiler.parser.STC.STCdeprecated; 2 4 3 5 import org.eclipse.core.runtime.Assert; … … 7 9 import descent.core.compiler.IProblem; 8 10 import descent.internal.compiler.parser.ast.IASTVisitor; 9 10 11 11 12 public class Dsymbol extends ASTDmdNode { … … 138 139 return; 139 140 } 141 142 // If inside a StorageClassDeclaration that is deprecated 143 if ((sc.stc & STCdeprecated) != 0) { 144 return; 145 } 140 146 } 141 147 … … 476 482 } 477 483 484 /** 485 * Search for ident as member of s. 486 * Input: 487 * flags: 1 don't find private members 488 * 2 don't give error messages 489 * 4 return NULL if ambiguous 490 * Returns: 491 * NULL if not found 492 */ 478 493 public final Dsymbol search(Loc loc, IdentifierExp ident, int flags, 479 494 SemanticContext context) { … … 481 496 } 482 497 498 /** 499 * Search for ident as member of s. 500 * Input: 501 * flags: 1 don't find private members 502 * 2 don't give error messages 503 * 4 return NULL if ambiguous 504 * Returns: 505 * NULL if not found 506 */ 483 507 public Dsymbol searchX(Loc loc, Scope sc, IdentifierExp id, 484 508 SemanticContext context) { … … 565 589 public String toChars(SemanticContext context) { 566 590 return (this.ident != null && this.ident.ident != null) ? this.ident.toChars() : "__anonymous"; 591 } 592 593 public TemplateInstance inTemplateInstance() { 594 for (Dsymbol parent = this.parent; parent != null; parent = parent.parent) { 595 TemplateInstance ti = parent.isTemplateInstance(); 596 if (ti != null) 597 return ti; 598 } 599 return null; 567 600 } 568 601 trunk/descent.core/src/descent/internal/compiler/parser/EnumDeclaration.java
r1203 r1223 1 1 package descent.internal.compiler.parser; 2 3 import static descent.internal.compiler.parser.STC.STCdeprecated; 2 4 3 5 import java.math.BigInteger; … … 9 11 import descent.core.compiler.IProblem; 10 12 import descent.internal.compiler.parser.ast.IASTVisitor; 11 12 13 13 14 public class EnumDeclaration extends ScopeDsymbol { … … 27 28 public integer_t minval; 28 29 public integer_t defaultval; // default initializer 30 public boolean isdeprecated; 29 31 30 32 private IType javaElement; … … 63 65 return type; 64 66 } 67 68 @Override 69 public boolean isDeprecated() { 70 return isdeprecated; 71 } 65 72 66 73 @Override … … 99 106 if (memtype == null) { 100 107 memtype = Type.tint32; 108 } 109 110 if ((sc.stc & STCdeprecated) != 0) { 111 isdeprecated = true; 101 112 } 102 113 trunk/descent.core/src/descent/internal/compiler/parser/Expression.java
r1201 r1223 127 127 128 128 public boolean canThrow() { 129 return false;129 return true; 130 130 } 131 131 … … 253 253 e = new AddrExp(loc, this); 254 254 } 255 e.type = t b.next.pointerTo(context);255 e.type = ts.next.pointerTo(context); 256 256 } 257 257 return e; … … 460 460 new String[] { toChars(context) })); 461 461 } 462 type = Type.tint32; 462 463 } 463 464 } trunk/descent.core/src/descent/internal/compiler/parser/FuncDeclaration.java
r1222 r1223 57 57 import descent.core.compiler.CharOperation; 58 58 import descent.core.compiler.IProblem; 59 import descent.internal.compiler.lookup.LazyClassDeclaration;60 import descent.internal.compiler.lookup.LazyInterfaceDeclaration;61 59 import descent.internal.compiler.parser.ast.IASTVisitor; 62 60 import descent.internal.core.util.Util; … … 1002 1000 ClassDeclaration cd = null; 1003 1001 InterfaceDeclaration id = null; 1002 Dsymbol pd; 1004 1003 int nparams = 0; 1005 1004 … … 1167 1166 } 1168 1167 } 1168 } 1169 1170 /* Template member functions aren't virtual: 1171 * interface TestInterface { void tpl(T)(); } 1172 * and so won't work in interfaces 1173 */ 1174 if ((pd = toParent()) != null && pd.isTemplateInstance() != null 1175 && (pd = toParent2()) != null 1176 && (id = pd.isInterfaceDeclaration()) != null) { 1177 if (context.acceptsErrors()) { 1178 context.acceptProblem(Problem.newSemanticTypeError(IProblem.TemplateMemberFunctionNotAllowedInInterface, this, id.toString())); 1179 } 1169 1180 } 1170 1181 … … 2072 2083 } 2073 2084 2074 boolean offend = fbody != null ? fbody.fallOffEnd(context): true;2085 boolean offend = fbody != null ? (fbody.blockExit(context) & BEfallthru) != 0: true; 2075 2086 2076 2087 if (isStaticCtorDeclaration() != null) { trunk/descent.core/src/descent/internal/compiler/parser/FuncLiteralDeclaration.java
