in src/tslint/incorrectStateAccessRule.ts [45:69]
function analyzeMethodBody(node: ts.Node): void {
if (isCallExpression(node)) {
const expr = node.getText();
if (expr.indexOf('this.') === 0) {
const index = expr.indexOf('(');
if (index) {
const name = expr.substring(5, index);
method.calling.push(name);
if (DEBUG) {
console.log('Method call', method.name + ' -> ' + name);
}
}
}
analyzeNodeChildren(node, 'CallExpression');
} else if (isPropertyAccessExpression(node)) {
if (node.getText().lastIndexOf('this.state.') !== -1) {
method.stateNodes.push(node);
analyzeNodeChildren(node, 'ErrorProperyExpression', true);
} else {
analyzeNodeChildren(node, 'PropertyExpression', true);
}
} else {
analyzeNodeChildren(node, 'Node');
}
}