function getControllerDefinition()

in rules/utils/utils.js [567:587]


function getControllerDefinition(context, node) {
    var controllerArg = node.arguments[1];

    // Three ways of creating a controller function: function expression,
    // variable name that references a function, and an array with a function
    // as the last item
    if (isFunctionType(controllerArg)) {
        return controllerArg;
    }
    if (isArrayType(controllerArg)) {
        controllerArg = controllerArg.elements[controllerArg.elements.length - 1];

        if (isIdentifierType(controllerArg)) {
            return findIdentiferInScope(context, controllerArg);
        }
        return controllerArg;
    }
    if (isIdentifierType(controllerArg)) {
        return findIdentiferInScope(context, controllerArg);
    }
}