From f2f31ff386a2823a6b71634ab5d6b414fbd9f9d3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 15 Jun 2015 02:19:02 +0300 Subject: Detect nullpointers also in methods. --- src/analysis/function.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/analysis/function.cpp b/src/analysis/function.cpp index 59406ed..37078c3 100644 --- a/src/analysis/function.cpp +++ b/src/analysis/function.cpp @@ -29,6 +29,8 @@ #include "nodes/list/tree_list.h" +#include "nodes/type/method_type.h" + #include #include "localconsts.h" @@ -44,12 +46,16 @@ void getFunctionArgTypes(FunctionDeclNode *node, if (!node->functionType) return; - // need impliment also for METHOD_TYPE - if (node->functionType->nodeType != FUNCTION_TYPE) + TreeListNode *types = nullptr; + if (node->functionType->nodeType == FUNCTION_TYPE) + types = static_cast(node->functionType)->argTypes; + else if (node->functionType->nodeType == METHOD_TYPE) + types = static_cast(node->functionType)->argTypes; + else return; // walk in TREE_LIST and get value nodes - FOR_TREE_LIST2(list, static_cast(node->functionType)->argTypes) + FOR_TREE_LIST2(list, types) { arr.push_back(static_cast(list->value)); } -- cgit v1.2.3-70-g09d2