1 /*
2  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  *  Copyright (C) 2015 - Scilab Enterprises - Calixte DENIZET
4  *
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  *
7  * This file is hereby licensed under the terms of the GNU GPL v2.0,
8  * pursuant to article 5.3.4 of the CeCILL v.2.1.
9  * This file was originally licensed under the terms of the CeCILL v2.1,
10  * and continues to be available under such terms.
11  * For more information, see the COPYING file which you should have received
12  * along with this program.
13  *
14  */
15 
16 #ifndef __SLINT_EQEQ_CHECKER_HXX__
17 #define __SLINT_EQEQ_CHECKER_HXX__
18 
19 #include "SLintChecker.hxx"
20 
21 namespace slint
22 {
23 
24 /**
25  * Check for bad misuse of == operator:
26  * - x == 1 instead of x = 1
27  */
28 class EqEqChecker : public SLintChecker
29 {
30 
31 public:
32 
EqEqChecker(const std::wstring & checkerId)33     EqEqChecker(const std::wstring & checkerId) : SLintChecker(checkerId) { }
~EqEqChecker()34     ~EqEqChecker() { }
35 
36     void preCheckNode(const ast::Exp & e, SLintContext & context, SLintResult & result);
37     void postCheckNode(const ast::Exp & e, SLintContext & context, SLintResult & result);
38     const std::string getName() const;
39 
getAstNodes() const40     virtual const std::vector<ast::Exp::ExpType> getAstNodes() const
41     {
42         return { ast::Exp::OPEXP };
43     }
44 };
45 
46 } // namespace slint
47 
48 #endif // __SLINT_EQEQ_CHECKER_HXX__
49