/*
 * Copyright 2010 Jon S Akhtar (Sylvanaar)
 *  
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *  
 *   http://www.apache.org/licenses/LICENSE-2.0
 *  
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
package com.sylvanaar.idea.Lua.editor.inspections.metrics;

import com.sylvanaar.idea.Lua.lang.psi.LuaPsiElement;
import com.sylvanaar.idea.Lua.lang.psi.visitor.LuaRecursiveElementVisitor;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaDoStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaFunctionDefinitionStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaStatementElement;
import org.jetbrains.annotations.NotNull;


class StatementCountVisitor extends LuaRecursiveElementVisitor {
  private int statementCount = 0;

  public void visitElement(LuaPsiElement element) {
    int oldCount = 0;
    if (element instanceof LuaFunctionDefinitionStatement) {
      oldCount = statementCount;
    }
    super.visitElement(element);

    if (element instanceof LuaFunctionDefinitionStatement) {
      statementCount = oldCount;
    }
  }

  public void visitStatement(@NotNull LuaStatementElement statement) {
    super.visitStatement(statement);
    if (statement instanceof LuaDoStatement) {
      return;
    }
    statementCount++;
  }


  public int getStatementCount() {
    return statementCount;
  }
}
@@ -685,137 +685,8 @@
 s;%0A%0A
-import com.sylvanaar.idea.Lua.lang.psi.LuaPsiElement;%0Aimport com.sylvanaar.idea.Lua.lang.psi.visitor.LuaRecursiveElementVisitor;%0A
 impo
@@ -800,38 +800,27 @@
 ents.Lua
-FunctionDefinitionStat
+StatementEl
 ement;%0Ai
@@ -861,38 +861,42 @@
 psi.
-statements.LuaStatementElement
+visitor.LuaRecursiveElementVisitor
 ;%0Aim
@@ -1037,16 +1037,18 @@
 t = 0;%0A%0A
+//
   public
@@ -1087,24 +1087,26 @@
  element) %7B%0A
+//
     int oldC
@@ -1115,16 +1115,18 @@
 nt = 0;%0A
+//
     if (
@@ -1174,24 +1174,26 @@
 tatement) %7B%0A
+//
       oldCou
@@ -1213,22 +1213,26 @@
 tCount;%0A
+//
     %7D%0A
+//
     supe
@@ -1256,17 +1256,21 @@
 ement);%0A
-%0A
+//%0A//
     if (
@@ -1318,24 +1318,26 @@
 tatement) %7B%0A
+//
       statem
@@ -1357,22 +1357,26 @@
 dCount;%0A
+//
     %7D%0A
+//
   %7D%0A%0A  p

remove some code that Im not sure why its there. but it appeared to be causing incorrect line counts