Changeset 1231
- Timestamp:
- 07/18/08 22:27:10 (2 months ago)
- Files:
-
- trunk/descent.core/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/descent.core/src/descent/internal/codeassist/CompletionEngine.java (modified) (9 diffs)
- trunk/descent.core/src/descent/internal/codeassist/impl/AssistOptions.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/lookup/ILazyAggregate.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/lookup/LazyAggregateDeclaration.java (modified) (4 diffs)
- trunk/descent.core/src/descent/internal/compiler/lookup/LazyClassDeclaration.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/lookup/LazyInterfaceDeclaration.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/lookup/LazyModule.java (modified) (5 diffs)
- trunk/descent.core/src/descent/internal/compiler/lookup/LazyStructDeclaration.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/lookup/ModuleBuilder.java (modified) (5 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/AggregateDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/ClassDeclaration.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/InterfaceDeclaration.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Module.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/Pvirtuals.java (modified) (1 diff)
- trunk/descent.core/src/descent/internal/compiler/parser/ScopeDsymbol.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/StructInitializer.java (modified) (2 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/TraitsExp.java (modified) (3 diffs)
- trunk/descent.core/src/descent/internal/compiler/parser/port.txt (modified) (1 diff)
- 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/debug/core/AbstractDescentLaunchConfigurationDelegate.java (modified) (1 diff)
- trunk/descent.debug.ui/META-INF/MANIFEST.MF (modified) (1 diff)
- trunk/descent.launching/META-INF/MANIFEST.MF (modified) (1 diff)
- 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)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/descent.core/META-INF/MANIFEST.MF
r1228 r1231 3 3 Bundle-Name: %pluginName 4 4 Bundle-SymbolicName: descent.core;singleton:=true 5 Bundle-Version: 0.5.3.2008071 35 Bundle-Version: 0.5.3.20080718 6 6 Bundle-Activator: descent.core.JavaCore 7 7 Bundle-Vendor: %providerName trunk/descent.core/src/descent/internal/codeassist/CompletionEngine.java
r1228 r1231 722 722 723 723 if (node.mod != null) { 724 node.mod = node.mod.unlazy(semanticContext);725 724 if (node.selectiveName == null) { 726 725 this.startPosition = actualCompletionPosition; … … 730 729 this.currentName = computePrefixAndSourceRange(node.selectiveName); 731 730 } 731 732 node.mod = node.mod.unlazy(this.currentName, semanticContext); 733 732 734 this.wantArguments = false; 733 735 suggestMembers(node.mod.members, false, new HashtableOfCharArrayAndObject(), INCLUDE_TYPES | INCLUDE_VARIABLES | INCLUDE_FUNCTIONS); … … 1096 1098 1097 1099 if (sym instanceof ClassDeclaration) { 1098 ClassDeclaration cd = ((ClassDeclaration) sym).unlazy( semanticContext);1100 ClassDeclaration cd = ((ClassDeclaration) sym).unlazy(this.currentName, semanticContext); 1099 1101 1100 1102 Declaration func = cd.ctor; … … 1128 1130 } 1129 1131 } else if (sym instanceof StructDeclaration) { 1130 StructDeclaration struct = ((StructDeclaration) sym).unlazy( semanticContext);1132 StructDeclaration struct = ((StructDeclaration) sym).unlazy(CharOperation.NO_CHAR, semanticContext); 1131 1133 suggestMembers(struct.members, onlyStatics, 0, new HashtableOfCharArrayAndObject(), INCLUDE_OPCALL); 1132 1134 } … … 1886 1888 1887 1889 private void completeTypeClassRecursively(TypeClass type, boolean onlyStatics, HashtableOfCharArrayAndObject funcSignatures) { 1888 ClassDeclaration decl = type.sym == null ? null : type.sym.unlazy( semanticContext);1890 ClassDeclaration decl = type.sym == null ? null : type.sym.unlazy(this.currentName, semanticContext); 1889 1891 if (decl == null) { 1890 1892 return; … … 1910 1912 1911 1913 private void completeTypeStruct(TypeStruct type, boolean onlyStatics) { 1912 StructDeclaration decl = type.sym == null ? null : type.sym.unlazy( semanticContext);1914 StructDeclaration decl = type.sym == null ? null : type.sym.unlazy(this.currentName, semanticContext); 1913 1915 if (decl == null) { 1914 1916 return; … … 2049 2051 if (!suggestedModules.containsKey(fqn)) { 2050 2052 suggestedModules.put(fqn, this); 2051 2052 mod = mod.unlazy(semanticContext); 2053 2053 mod = mod.unlazy(this.currentName, semanticContext); 2054 2054 suggestMembers(mod.members, false, funcSignatures, includes & (~INCLUDE_IMPORTS)); 2055 2055 } … … 2241 2241 if (parser.inNewExp) { 2242 2242 if (type instanceof TypeClass) { 2243 ClassDeclaration cd = ((TypeClass) type).sym.unlazy( semanticContext);2243 ClassDeclaration cd = ((TypeClass) type).sym.unlazy(this.currentName, semanticContext); 2244 2244 if (cd.isClassDeclaration() != null && cd.isInterfaceDeclaration() == null) { 2245 2245 // If it's abstract, skip … … 2548 2548 // opCall 2549 2549 case ASTDmdNode.TYPE_STRUCT: { 2550 StructDeclaration sym = (((TypeStruct) type).sym).unlazy(semanticContext);2551 2550 currentName = ident; 2551 StructDeclaration sym = (((TypeStruct) type).sym).unlazy(this.currentName, semanticContext); 2552 2552 suggestMembers(sym.members, onlyStatics, new HashtableOfCharArrayAndObject(), INCLUDE_OPCALL); 2553 2553 break; 2554 2554 } 2555 case ASTDmdNode.TYPE_CLASS: { 2556 ClassDeclaration sym = (((TypeClass) type).sym).unlazy(semanticContext); 2555 case ASTDmdNode.TYPE_CLASS: { 2557 2556 currentName = ident; 2557 ClassDeclaration sym = (((TypeClass) type).sym).unlazy(this.currentName, semanticContext); 2558 2558 suggestMembers(sym.members, onlyStatics, new HashtableOfCharArrayAndObject(), INCLUDE_OPCALL); 2559 2559 trunk/descent.core/src/descent/internal/codeassist/impl/AssistOptions.java
r1224 r1231 247 247 String[] strings = moduleNames.split(","); 248 248 for(String string : strings) { 249 ignoredNonImportedModules.put(string.trim().toCharArray(), this); 249 string = string.trim(); 250 if (string.length() > 0) { 251 ignoredNonImportedModules.put(string.toCharArray(), this); 252 } 250 253 } 251 254 } trunk/descent.core/src/descent/internal/compiler/lookup/ILazyAggregate.java
r1208 r1231 31 31 void symtab(DsymbolTable table); 32 32 33 boolean isUnlazy(); 34 33 35 } trunk/descent.core/src/descent/internal/compiler/lookup/LazyAggregateDeclaration.java
r1222 r1231 20 20 public class LazyAggregateDeclaration { 21 21 22 privateHashtableOfCharArrayAndObject javaElementMembersCache;23 privateList<Dsymbol> pendingPublicImports;24 privateList<Dsymbol> pendingPrivateImports;25 privateboolean cancelLazyness;26 privateILazyAggregate lazy;22 HashtableOfCharArrayAndObject javaElementMembersCache; 23 List<Dsymbol> pendingPublicImports; 24 List<Dsymbol> pendingPrivateImports; 25 boolean cancelLazyness; 26 ILazyAggregate lazy; 27 27 28 28 public LazyAggregateDeclaration(ILazyAggregate lazy) { … … 39 39 if (s == null) { 40 40 if (javaElementMembersCache == null) { 41 javaElementMembersCache = new HashtableOfCharArrayAndObject(); 42 List<Dsymbol> privateImports = new ArrayList<Dsymbol>(); 43 List<Dsymbol> publicImports = new ArrayList<Dsymbol>(); 44 FillResult result = null ; 45 try { 46 result = lazy.builder().fillJavaElementMembersCache(lazy, lazy.getJavaElement().getChildren(), javaElementMembersCache, lazy.members(), privateImports, publicImports, context); 47 } catch (JavaModelException e) { 48 Util.log(e); 49 } 41 FillResult result = fillJavaElementMemebrsCache(context); 50 42 51 43 if (result.hasMixinDeclaration || result.hasStaticIf || result.hasAnon) { 52 cancelLazyness = true;53 lazy.members(new Dsymbols());54 try {55 lazy.builder().fill(lazy.getModule(), lazy.members(), lazy.getJavaElement().getChildren(), null);56 } catch (JavaModelException e) {57 Util.log(e);58 }59 60 int size = lazy.members().size();61 62 for (int i = 0; i < size; i++) {63 Dsymbol sym = lazy.members().get(i);64 sym.addMember(lazy.semanticScope(), lazy.asScopeDsymbol(), 0, context);65 lazy.runMissingSemantic(sym, context);66 }67 68 44 return search(loc, ident, flags, context); 69 }70 71 if (!privateImports.isEmpty()) {72 pendingPrivateImports = privateImports;73 }74 if (!publicImports.isEmpty()) {75 pendingPublicImports = publicImports;76 45 } 77 46 … … 159 128 return s; 160 129 } 130 131 FillResult fillJavaElementMemebrsCache(SemanticContext context) { 132 javaElementMembersCache = new HashtableOfCharArrayAndObject(); 133 List<Dsymbol> privateImports = new ArrayList<Dsymbol>(); 134 List<Dsymbol> publicImports = new ArrayList<Dsymbol>(); 135 FillResult result = null ; 136 try { 137 result = lazy.builder().fillJavaElementMembersCache(lazy, lazy.getJavaElement().getChildren(), javaElementMembersCache, lazy.members(), privateImports, publicImports, context); 138 } catch (JavaModelException e) { 139 Util.log(e); 140 } 141 142 if (!privateImports.isEmpty()) { 143 pendingPrivateImports = privateImports; 144 } 145 if (!publicImports.isEmpty()) { 146 pendingPublicImports = publicImports; 147 } 148 149 if (result.hasMixinDeclaration || result.hasStaticIf || result.hasAnon) { 150 cancelLazyness = true; 151 lazy.members(new Dsymbols()); 152 try { 153 lazy.builder().fill(lazy.getModule(), lazy.members(), lazy.getJavaElement().getChildren(), null); 154 } catch (JavaModelException e) { 155 Util.log(e); 156 } 157 158 int size = lazy.members().size(); 159 160 for (int i = 0; i < size; i++) { 161 Dsymbol sym = lazy.members().get(i); 162 sym.addMember(lazy.semanticScope(), lazy.asScopeDsymbol(), 0, context); 163 lazy.runMissingSemantic(sym, context); 164 } 165 } 166 167 return result; 168 } 161 169 162 170 public void runMissingSemantic(Dsymbol sym, SemanticContext context) { … … 165 173 sym.semantic(Scope.copy(lazy.semanticScope()), context); 166 174 } 167 if (lazy.semantic2Scope() != null) { 168 sym.semantic2(Scope.copy(lazy.semantic2Scope()), context); 169 } 170 if (lazy.semantic3Scope() != null) { 171 sym.semantic3(Scope.copy(lazy.semantic3Scope()), context); 175 if (!lazy.isUnlazy()) { 176 if (lazy.semantic2Scope() != null) { 177 sym.semantic2(Scope.copy(lazy.semantic2Scope()), context); 178 } 179 if (lazy.semantic3Scope() != null) { 180 sym.semantic3(Scope.copy(lazy.semantic3Scope()), context); 181 } 172 182 } 173 183 context.muteProblems--; trunk/descent.core/src/descent/internal/compiler/lookup/LazyClassDeclaration.java
r1207 r1231 1 1 package descent.internal.compiler.lookup; 2 2 3 import descent.core. JavaModelException;3 import descent.core.compiler.CharOperation; 4 4 import descent.internal.compiler.parser.BaseClasses; 5 5 import descent.internal.compiler.parser.ClassDeclaration; … … 12 12 import descent.internal.compiler.parser.ScopeDsymbol; 13 13 import descent.internal.compiler.parser.SemanticContext; 14 import descent.internal.core.util.Util;15 14 16 15 public class LazyClassDeclaration extends ClassDeclaration implements ILazyAggregate { … … 30 29 } 31 30 32 private ClassDeclaration unlazyOne; 33 public ClassDeclaration unlazy(SemanticContext context) { 34 if (unlazyOne == null) { 31 private boolean isUnlazy; 32 33 public boolean isUnlazy() { 34 return isUnlazy; 35 } 36 37 public ClassDeclaration unlazy(char[] prefix, SemanticContext context) { 38 if (!isUnlazy) { 39 isUnlazy = true; 40 35 41 if (baseClass != null) { 36 baseClass = baseClass.unlazy( context);42 baseClass = baseClass.unlazy(prefix, context); 37 43 } 38 44 39 45 for (int i = 0; i < size(baseclasses); i++) { 40 unlazy(baseclasses.get(i), context);46 unlazy(baseclasses.get(i), prefix, context); 41 47 } 42 48 43 unlazyOne = new ClassDeclaration(loc, ident, baseclasses); 44 unlazyOne.parent = this.parent; 45 unlazyOne.members = new Dsymbols(); 46 try { 47 builder.fill(getModule(), unlazyOne.members, javaElement.getChildren(), null); 48 } catch (JavaModelException e) { 49 Util.log(e); 49 if (lazy.javaElementMembersCache == null) { 50 lazy.fillJavaElementMemebrsCache(context); 50 51 } 51 unlazyOne.setJavaElement(this.javaElement); 52 runMissingSemantic(unlazyOne, context); 52 53 if (!lazy.cancelLazyness) { 54 55 for(char[] key : lazy.javaElementMembersCache.keys()) { 56 if (key != null && CharOperation.prefixEquals(prefix, key, false)) { 57 search(Loc.ZERO, key, 0, context); 58 } 59 } 60 } 53 61 } 54 return unlazyOne;62 return this; 55 63 } 56 64 trunk/descent.core/src/descent/internal/compiler/lookup/LazyInterfaceDeclaration.java
r1207 r1231 1 1 package descent.internal.compiler.lookup; 2 2 3 import descent.core. JavaModelException;3 import descent.core.compiler.CharOperation; 4 4 import descent.internal.compiler.parser.BaseClasses; 5 5 import descent.internal.compiler.parser.Dsymbol; … … 12 12 import descent.internal.compiler.parser.ScopeDsymbol; 13 13 import descent.internal.compiler.parser.SemanticContext; 14 import descent.internal.core.util.Util;15 14 16 15 public class LazyInterfaceDeclaration extends InterfaceDeclaration implements ILazyAggregate { … … 30 29 } 31 30 32 private InterfaceDeclaration unlazyOne; 33 public InterfaceDeclaration unlazy(SemanticContext context) { 34 if (unlazyOne == null) { 31 private boolean isUnlazy; 32 33 public boolean isUnlazy() { 34 return isUnlazy; 35 } 36 37 public InterfaceDeclaration unlazy(char[] prefix, SemanticContext context) { 38 if (!isUnlazy) { 39 isUnlazy = true; 40 35 41 if (baseClass != null) { 36 baseClass = baseClass.unlazy( context);42 baseClass = baseClass.unlazy(prefix, context); 37 43 } 38 44 39 45 for (int i = 0; i < size(baseclasses); i++) { 40 unlazy(baseclasses.get(i), context);46 unlazy(baseclasses.get(i), prefix, context); 41 47 } 42 48 43 unlazyOne = new InterfaceDeclaration(loc, ident, baseclasses); 44 unlazyOne.parent = this.parent; 45 unlazyOne.members = new Dsymbols(); 46 try { 47 builder.fill(getModule(), unlazyOne.members, javaElement.getChildren(), null); 48 } catch (JavaModelException e) { 49 Util.log(e); 49 if (lazy.javaElementMembersCache == null) { 50 lazy.fillJavaElementMemebrsCache(context); 50 51 } 51 unlazyOne.setJavaElement(this.javaElement); 52 runMissingSemantic(unlazyOne, context); 52 53 if (!lazy.cancelLazyness) { 54 for(char[] key : lazy.javaElementMembersCache.keys()) { 55 if (key != null && CharOperation.prefixEquals(prefix, key, false)) { 56 search(Loc.ZERO, key, 0, context); 57 } 58 } 59 } 53 60 } 54 return unlazyOne;61 return this; 55 62 } 56 63 trunk/descent.core/src/descent/internal/compiler/lookup/LazyModule.java
r1222 r1231 4 4 import java.util.List; 5 5 6 import descent.core.IConditional; 7 import descent.core.IInitializer; 6 8 import descent.core.IJavaElement; 7 9 import descent.core.IType; … … 84 86 } 85 87 86 private Module unlazyOne; 87 public Module unlazy(SemanticContext context) { 88 if (unlazyOne == null) { 89 unlazyOne = builder.buildNonLazyModule(javaElement); 90 unlazyOne.semantic(context); 91 } 92 return unlazyOne; 88 private boolean isUnlazy; 89 public Module unlazy(char[] prefix, SemanticContext context) { 90 if (!isUnlazy) { 91 isUnlazy = true; 92 for(char[] key : topLevelIdentifiers.keys()) { 93 if (key != null && CharOperation.prefixEquals(prefix, key, false)) { 94 search(Loc.ZERO, key, 0, context); 95 } 96 } 97 } 98 return this; 93 99 } 94 100 … … 140 146 if (javaElementMembersCache == null) { 141 147 Object target = topLevelIdentifiers.get(ident); 148 149 target = filter(target); 142 150 143 151 if (target != null) { … … 212 220 } 213 221 222 // Remove element that are under false conditionals 223 private Object filter(Object target) { 224 if (target == null) { 225 return null; 226 } 227 228 if (target instanceof IJavaElement) { 229 IJavaElement element = (IJavaElement) target; 230 return isActive(element) ? element : null; 231 } else if (target instanceof List) { 232 List<IJavaElement> elements = (List<IJavaElement>) target; 233 List<IJavaElement> filteredElements = new ArrayList<IJavaElement>(elements.size()); 234 for(IJavaElement element : elements) { 235 if (isActive(element)) { 236 filteredElements.add(element); 237 } 238 } 239 if (filteredElements.isEmpty()) { 240 return null; 241 } else if (filteredElements.size() == 1) { 242 return filteredElements.get(0); 243 } else { 244 return filteredElements; 245 } 246 } 247 248 return target; 249 } 250 251 private boolean isActive(IJavaElement element) { 252 switch(element.getParent().getElementType()) { 253 case IJavaElement.COMPILATION_UNIT: 254 return true; 255 case IJavaElement.INITIALIZER: 256 IInitializer init = (IInitializer) element.getParent(); 257 try { 258 if (init.isThen()) { 259 return builder.isThenActive((IConditional) init.getParent(), this); 260 } else if (init.isElse()) { 261 return !builder.isThenActive((IConditional) init.getParent(), this); 262 } else { 263 return true; 264 } 265 } catch (JavaModelException e) { 266 Util.log(e); 267 return true; 268 } 269 case IJavaElement.CONDITIONAL: 270 IConditional cond = (IConditional) element.getParent(); 271 try { 272 return builder.isThenActive(cond, this); 273 } catch (JavaModelException e) { 274 Util.log(e); 275 return true; 276 } 277 } 278 return false; 279 } 280 214 281 private boolean isEasy(IJavaElement element) { 215 return element.getParent().getElementType() == IJavaElement.COMPILATION_UNIT; 282 switch(element.getParent().getElementType()) { 283 case IJavaElement.COMPILATION_UNIT: 284 return true; 285 case IJavaElement.CONDITIONAL: 286 return isEasy(element.getParent()); 287 default: 288 return false; 289 } 216 290 } 217 291 … … 310 384 sym.semantic(Scope.copy(semanticScope), context); 311 385 } 312 if (semantic2Scope != null) { 313 sym.semantic2(Scope.copy(semantic2Scope), context); 314 } 315 if (semantic3Scope != null) { 316 sym.semantic3(Scope.copy(semantic3Scope), context); 386 if (!isUnlazy) { 387 if (semantic2Scope != null) { 388 sym.semantic2(Scope.copy(semantic2Scope), context); 389 } 390 if (semantic3Scope != null) { 391 sym.semantic3(Scope.copy(semantic3Scope), context); 392 } 317 393 } 318 394 context.muteProblems--; trunk/descent.core/src/descent/internal/compiler/lookup/LazyStructDeclaration.java
r1207 r1231 1 1 package descent.internal.compiler.lookup; 2 2 3 import descent.core. JavaModelException;3 import descent.core.compiler.CharOperation; 4 4 import descent.internal.compiler.parser.Dsymbol; 5 5 import descent.internal.compiler.parser.DsymbolTable; … … 11 11 import descent.internal.compiler.parser.SemanticContext; 12 12 import descent.internal.compiler.parser.StructDeclaration; 13 import descent.internal.core.util.Util;14 13 15 14 public class LazyStructDeclaration extends StructDeclaration implements ILazyAggregate { … … 29 28 } 30 29 31 private StructDeclaration unlazyOne; 32 public StructDeclaration unlazy(SemanticContext context) { 33 if (unlazyOne == null) { 34 unlazyOne = new StructDeclaration(loc, ident); 35 unlazyOne.parent = this.parent; 36 unlazyOne.members = new Dsymbols(); 37 try { 38 builder.fill(getModule(), unlazyOne.members, javaElement.getChildren(), null); 39 } catch (JavaModelException e) { 40 Util.log(e); 30 private boolean isUnlazy; 31 32 public boolean isUnlazy() { 33 return isUnlazy; 34 } 35 36 public StructDeclaration unlazy(char[] prefix, SemanticContext context) { 37 if (!isUnlazy) { 38 isUnlazy = true; 39 40 if (lazy.javaElementMembersCache == null) { 41 lazy.fillJavaElementMemebrsCache(context); 41 42 } 42 unlazyOne.setJavaElement(this.javaElement); 43 runMissingSemantic(unlazyOne, context); 43 44 if (!lazy.cancelLazyness) { 45 46 for(char[] key : lazy.javaElementMembersCache.keys()) { 47 if (key != null && CharOperation.prefixEquals(prefix, key, false)) { 48 search(Loc.ZERO, key, 0, context); 49 } 50 } 51 } 44 52 } 45 return unlazyOne;53 return this; 46 54 } 47 55 trunk/descent.core/src/descent/internal/compiler/lookup/ModuleBuilder.java
r1222 r1231 263 263 buildConditional(module, members, cond, state, nameC, value, false /* not debug */); 264 264 } else { 265 if (config.isVersionEnabled(value) || value >= module.versionlevel) {265 if (config.isVersionEnabled(value) || module.versionlevel >= value) { 266 266 fill(module, members, cond.getThenChildren(), state); 267 267 } else { … … 288 288 buildConditional(module, members, cond, state, nameC, value, true /* debug */); 289 289 } else { 290 if (config.isDebugEnabled(value) || value >= module.debuglevel) {290 if (config.isDebugEnabled(value) || module.debuglevel >= value) { 291 291 fill(module, members, cond.getThenChildren(), state); 292 292 } else { … … 839 839 if (cond.isStaticIfDeclaration()) { 840 840 result.hasStaticIf = true; 841 } else if (cond.isVersionDeclaration()) { 842 String name = cond.getElementName(); 843 char[] nameC = name.toCharArray(); 844 try { 845 long value = Long.parseLong(name); 846 if (config.isVersionEnabled(value) || value >= lazy.getModule().versionlevel) { 847 internalFillJavaElementMembersCache(lazy, cond.getThenChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 848 } else { 849 internalFillJavaElementMembersCache(lazy, cond.getElseChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 850 } 851 } catch(NumberFormatException e) { 852 if (config.isVersionEnabled(nameC) || (lazy.getModule().versionids != null && lazy.getModule().versionids.containsKey(nameC))) { 853 internalFillJavaElementMembersCache(lazy, cond.getThenChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 854 } else { 855 internalFillJavaElementMembersCache(lazy, cond.getElseChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 856 } 857 } 858 } else if (cond.isDebugDeclaration()) { 859 String name = cond.getElementName(); 860 char[] nameC = name.toCharArray(); 861 try { 862 long value = Long.parseLong(name); 863 if (config.isDebugEnabled(value) || value >= lazy.getModule().debuglevel) { 864 internalFillJavaElementMembersCache(lazy, cond.getThenChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 865 } else { 866 internalFillJavaElementMembersCache(lazy, cond.getElseChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 867 } 868 } catch(NumberFormatException e) { 869 if (config.isDebugEnabled(nameC) || (lazy.getModule().debugids != null && lazy.getModule().debugids.containsKey(nameC))) { 870 internalFillJavaElementMembersCache(lazy, cond.getThenChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 871 } else { 872 internalFillJavaElementMembersCache(lazy, cond.getElseChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 873 } 841 } else if (cond.isVersionDeclaration() || cond.isDebugDeclaration()) { 842 if (isThenActive(cond, lazy)) { 843 internalFillJavaElementMembersCache(lazy, cond.getThenChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 844 } else { 845 internalFillJavaElementMembersCache(lazy, cond.getElseChildren(), javaElementMembersCache, symbols, privateImports, publicImports, context, result); 874 846 } 875 847 } … … 948 920 } 949 921 922 public boolean isThenActive(IConditional cond, ILazy lazy) throws JavaModelException { 923 if (cond.isVersionDeclaration()) { 924 String name = cond.getElementName(); 925 char[] nameC = name.toCharArray(); 926 try { 927 long value = Long.parseLong(name); 928 return config.isVersionEnabled(value) || lazy.getModule().versionlevel >= value; 929 } catch(NumberFormatException e) { 930 return config.isVersionEnabled(nameC) || (lazy.getModule().versionids != null && lazy.getModule().versionids.containsKey(nameC)); 931 } 932 } else if (cond.isDebugDeclaration()) { 933 String name = cond.getElementName(); 934 char[] nameC = name.toCharArray(); 935 try { 936 long value = Long.parseLong(name); 937 return config.isDebugEnabled(value) || lazy.getModule().debuglevel >= value; 938 } catch(NumberFormatException e) { 939 return config.isDebugEnabled(nameC) || (lazy.getModule().debugids != null && lazy.getModule().debugids.containsKey(nameC)); 940 } 941 } else { 942 throw new IllegalStateException("Can't happen"); 943 } 944 } 945 950 946 public void fillImports(ILazy lazy, IJavaElement[] elements, List<Dsymbol> privateImports, List<Dsymbol> publicImports, SemanticContext context, int lastImportLocation) { 951 947 try { … … 977 973 if (cond.isStaticIfDeclaration()) { 978 974 979 } else if (cond.isVersionDeclaration()) { 980 String name = cond.getElementName(); 981 char[] nameC = name.toCharArray(); 982 try { 983 long value = Long.parseLong(name); 984 if (config.isVersionEnabled(value) || value >= lazy.getModule().versionlevel) { 985 fillImports(lazy, cond.getThenChildren(), privateImports, publicImports, context, lastImportLocation); 986 } else { 987 fillImports(lazy, cond.getElseChildren(), privateImports, publicImports, context, lastImportLocation); 988 } 989 } catch(NumberFormatException e) { 990 if (config.isVersionEnabled(nameC) || (lazy.getModule().versionids != null && lazy.getModule().versionids.containsKey(nameC))) { 991 fillImports(lazy, cond.getThenChildren(), privateImports, publicImports, context, lastImportLocation); 992 } else { 993 fillImports(lazy, cond.getElseChildren(), privateImports, publicImports, context, lastImportLocation); 994 } 995 } 996 } else if (cond.isDebugDeclaration()) { 997 String name = cond.getElementName(); 998 char[] nameC = name.toCharArray(); 999 try { 1000 long value = Long.parseLong(name); 1001 if (config.isDebugEnabled(value) || value >= lazy.getModule().debuglevel) { 1002 fillImports(lazy, cond.getThenChildren(), privateImports, publicImports, context, lastImportLocation); 1003 } else { 1004 fillImports(lazy, cond.getElseChildren(), privateImports, publicImports, context, lastImportLocation); 1005 } 1006 } catch(NumberFormatException e) { 1007 if (config.isDebugEnabled(nameC) || (lazy.getModule().debugids != null && lazy.getModule().debugids.containsKey(nameC))) { 1008 fillImports(lazy, cond.getThenChildren(), privateImports, publicImports, context, lastImportLocation); 1009 } else { 1010 fillImports(lazy, cond.getElseChildren(), privateImports, publicImports, context, lastImportLocation); 1011 } 975 } else if (cond.isVersionDeclaration() || cond.isDebugDeclaration()) { 976 if (isThenActive(cond, lazy)) { 977 fillImports(lazy, cond.getThenChildren(), privateImports, publicImports, context, lastImportLocation); 978 } else { 979 fillImports(lazy, cond.getElseChildren(), privateImports, publicImports, context, lastImportLocation); 1012 980 } 1013 981 } trunk/descent.core/src/descent/internal/compiler/parser/AggregateDeclaration.java
r1203 r1231 457 457 } 458 458 459 public AggregateDeclaration unlazy(SemanticContext context) { 459 @Override 460 public AggregateDeclaration unlazy(char[] prefix, SemanticContext context) { 460 461 return this; 461 462 } trunk/descent.core/src/descent/internal/compiler/parser/ClassDeclaration.java
r1203 r1231 21 21 22 22 import descent.core.Signature; 23 import descent.core.compiler.CharOperation; 23 24 import descent.core.compiler.IProblem; 24 25 import descent.internal.compiler.lookup.ModuleBuilder; … … 845 846 846 847 protected void unlazy(BaseClass bc, SemanticContext context) { 848 unlazy(bc, CharOperation.NO_CHAR, context); 849 } 850 851 protected void unlazy(BaseClass bc, char[] prefix, SemanticContext context) { 847 852 if (bc.type instanceof TypeClass) { 848 unlazy((TypeClass) bc.type, context);849 } 850 bc.base = bc.base == null ? null : bc.base.unlazy( context);851 } 852 853 unlazy((TypeClass) bc.type, prefix, context); 854 } 855 bc.base = bc.base == null ? null : bc.base.unlazy(prefix, context); 856 } 857 853 858 protected void unlazy(TypeClass type, SemanticContext context) { 854 type.sym = type.sym.unlazy(
