-
Notifications
You must be signed in to change notification settings - Fork 0
/
ASTFunctionCallNode.h
54 lines (44 loc) · 1.44 KB
/
ASTFunctionCallNode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* File: ASTFunctionCallNode.h
* Author: claire
*
* Created on October 6, 2013, 2:40 PM
*/
#ifndef ASTFUNCTIONCALLNODE_H
#define ASTFUNCTIONCALLNODE_H
#include <string>
#include "ASTNode.h"
#include "ASTExpressionNode.h"
#include "ASTStatementNode.h"
#include "ASTFunctionNode.h"
using namespace std;
/*ASTFunctionCallNode represents a function call in the code. It is a subclass
* of both ASTExpressionNode and ASTStatementNode. This is because setting a
* variable to the returning value from a function call (e.g. x=foo()) is
* considered an expression, where as a function call on its own (e.g. foo()) is
* a statement. It overrides the print function
* The ASTFunctionCallNode keeps track of:
* -the id of the function (the function's name)
* - the arguments as a list
*/
class ASTFunctionCallNode : public ASTStatementNode, ASTExpressionNode {
public:
ASTFunctionCallNode();
ASTFunctionCallNode(const ASTFunctionCallNode& orig);
ASTFunctionCallNode& operator= (const ASTFunctionCallNode &rhs);
virtual ~ASTFunctionCallNode();
void semAnalyze();
void semAnalyze(bool restrictIdents);
void scopeAnalyze();
void typeAnalyze();
void printNode(int indent, ostream * output);
string genQuadruples();
string genRegularCall();
int id;
ASTFunctionNode * funcDec;
ASTExpressionNode * argument;
bool isStatement;
private:
int getArgCount();
};
#endif /* ASTFUNCTIONCALLNODE_H */