         conditionalNestFactor: NEST_FACTOR
         loopNestFactor: NEST_FACTOR
       )
+      halstead: countHalstead m.body
   metrics.methodCount = metrics.methods.length
   metrics.propertyCount = (m for m in cls.body when m.member is 'property').length
   metrics.innerClassCount = (m for m in cls.body when m.member is 'inner_class').length

    else 0
  return cc

calculateBlockComplexity = (block, options) ->
 cc = 0
 for statement in block
   cc += calculateStatementComplexity statement, options
 cc

calculateComplexity = (methodBody, options) ->
  options ?= {}

               calculateExpressionComplexity expression.falseValue
  0

countExpressionHalstead = (expression) ->
  if expression?.negative?
    hal = countExpressionHalstead expression.negative
    hal.operators.push '-'
    return hal
  if expression?.inverse?
    hal = countExpressionHalstead expression.inverse
    hal.operators.push '!'
    return hal
  if expression?.parenthesized?
    hal = countExpressionHalstead expression.parenthesized
    hal.operators.push '()'
    return hal
  if expression?.receiver?
    hals = countExpressionHalstead expression.receiver
    hals.push countExpressionHalstead expression.index if expression.index?
    hal = combineHalsteads hals
    hal.operators.push '[]'
    return hal
  if expression?.argv?
    hal = combineHalsteads (countExpressionHalstead arg for arg in expression.argv)
    hal.operands.push expression.callee
    hal.operators.push 'new' if expression.newAllocation?
    return hal
  if expression?.callee? and expression?.initializer?
    hal = countExpressionHalstead expression.initializer
    hal.operators.push 'new'
    hal.operators.push '{}'
    return hal
  if comparators.test expression?.operator
    hal = combineHalsteads [
      countExpressionHalstead expression.left
      countExpressionHalstead expression.right
    ]
    hal.operators.push expression.operator
    return hal
  if assigners.test expression?.operator
    hal = countExpressionHalstead expression.value
    hal.operators.push expression.operator
    hal.operands.push expression.name
    return hal
  if operators.test expression?.operator
    hal = combineHalsteads [
      countExpressionHalstead expression.left
      countExpressionHalstead expression.right
    ]
    hal.operators.push expression.operator
    return hal
  if expression?.condition?
    hal = combineHalsteads [
      countExpressionHalstead expression.condition
      countExpressionHalstead expression.trueValue
      countExpressionHalstead expression.falseValue
    ]
    hal.operators.push '?:'
    return hal
  return {
    operators: []
    operands: []
  }

calculateStatementComplexity = (statement, options) ->
  cnf = options.conditionalNestFactor
  lnf = options.loopNestFactor
