- Timestamp:
- 09/24/10 12:14:04 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/t3e-tools/t3q/src/org/etsi/t3q/visitor/QualityChecker.java
r16 r28 2185 2185 } 2186 2186 2187 // ------------------------------------------------------------------------------------------- 2188 2187 //TODO: extract, duplicate of nested alt statements 2188 public void checkNoNestedModes(LocationAST node) { 2189 2190 LinkedList<LocationAST> nestedNodes = ASTUtil.findTypeNodes(node 2191 // .getFirstChild() 2192 , TTCN3ParserTokenTypes.ModeSpecification); 2193 if (nestedNodes != null && nestedNodes.size() > 0) { 2194 LocationAST nestedNode; 2195 2196 int[] nodeTypes = new int[] {TTCN3ParserTokenTypes.ModeSpecification}; 2197 for (int n = 0; n < nestedNodes.size(); n++) { 2198 nestedNode = nestedNodes.get(n); 2199 int nestingDepth = getConstructNesting(nestedNode, nodeTypes); 2200 if (nestingDepth > T3Q.activeProfile.getEmbeddedExtensionConfig().getAllowedModeNestingDepth()) { 2201 this.getLoggingInterface().logWarning(nestedNode.getLine(), nestedNode.getEndLine(), MessageClass.STYLE, "Mode nesting depth ("+nestingDepth+") exceeds maximum allowed nesting depth ("+T3Q.activeProfile.getEmbeddedExtensionConfig().getAllowedModeNestingDepth()+")!", "EC.XX, "+MiscTools.getMethodName()); 2202 } 2203 } 2204 } 2205 2206 } 2207 2208 // ------------------------------------------------------------------------------------------- 2209 2210 //TODO: further potential for reuse? 2189 2211 public void checkNoNestedAltStatements(LocationAST node) { 2190 2212 … … 2193 2215 // .getFirstChild() 2194 2216 , TTCN3ParserTokenTypes.AltConstruct); 2195 2196 2217 if (nestedAltConstructNodes != null && nestedAltConstructNodes.size() > 0) { 2197 2218 LocationAST nestedAltConstructNode; 2198 2219 2220 int[] nodeTypes = new int[] {TTCN3ParserTokenTypes.AltConstruct, TTCN3ParserTokenTypes.AltstepDef}; 2199 2221 for (int n = 0; n < nestedAltConstructNodes.size(); n++) { 2200 2222 nestedAltConstructNode = nestedAltConstructNodes.get(n); 2201 int nestingDepth = get AltConstructNesting(nestedAltConstructNode);2223 int nestingDepth = getConstructNesting(nestedAltConstructNode, nodeTypes); 2202 2224 if (nestingDepth > T3Q.activeProfile.getMaximumAllowedNestingDepth()) { 2203 2225 this.getLoggingInterface().logWarning(nestedAltConstructNode.getLine(), nestedAltConstructNode.getEndLine(), MessageClass.STYLE, "Alt statement nesting depth ("+nestingDepth+") exceeds maximum allowed nesting depth ("+T3Q.activeProfile.getMaximumAllowedNestingDepth()+")!", "6.3, "+MiscTools.getMethodName()); … … 2210 2232 // ------------------------------------------------------------------------------------------- 2211 2233 2212 private int get AltConstructNesting(LocationAST node){2234 private int getConstructNesting(LocationAST node, int[] nodeTypes){ 2213 2235 int nestingDepth = 1; 2214 LocationAST containing AltConstructNode = LocationAST.resolveParentsUntilType(node.getParent(), new int[] {TTCN3ParserTokenTypes.AltConstruct, TTCN3ParserTokenTypes.AltstepDef});2236 LocationAST containingConstructNode = LocationAST.resolveParentsUntilType(node.getParent(), nodeTypes); 2215 2237 2216 if (containing AltConstructNode != null){2217 nestingDepth += get AltConstructNesting(containingAltConstructNode);2238 if (containingConstructNode != null){ 2239 nestingDepth += getConstructNesting(containingConstructNode, nodeTypes); 2218 2240 } else { 2219 2241 nestingDepth = 0;
Note: See TracChangeset
for help on using the changeset viewer.