Lines Matching refs:stmt
28 #include "stmt.h"
95 void Evaluator::EvalAssign(const AssignStmt* stmt) {
96 loc_ = stmt->loc();
98 Symbol lhs = stmt->GetLhsSymbol(this);
101 Var* rhs = EvalRHS(lhs, stmt->rhs, stmt->orig_rhs, stmt->op,
102 stmt->directive == AssignDirective::OVERRIDE);
107 void Evaluator::EvalRule(const RuleStmt* stmt) {
108 loc_ = stmt->loc();
111 const string&& expr = stmt->expr->Eval(this);
114 if (stmt->term == ';')
121 ParseRule(loc_, expr, stmt->term, &rule, &rule_var);
124 if (stmt->term == ';') {
125 rule->cmds.push_back(stmt->after_term);
141 Value* rhs = stmt->after_term;
147 if (stmt->term == ';') {
165 void Evaluator::EvalCommand(const CommandStmt* stmt) {
166 loc_ = stmt->loc();
169 vector<Stmt*> stmts;
170 ParseNotAfterRule(stmt->orig, stmt->loc(), &stmts);
171 for (Stmt* a : stmts)
176 last_rule_->cmds.push_back(stmt->expr);
178 last_rule_->cmd_lineno = stmt->loc().lineno;
179 LOG("Command: %s", stmt->expr->DebugString().c_str());
182 void Evaluator::EvalIf(const IfStmt* stmt) {
183 loc_ = stmt->loc();
186 switch (stmt->op) {
190 stmt->lhs->Eval(this, &var_name);
196 is_true = (s.empty() == (stmt->op == CondOp::IFNDEF));
201 const string&& lhs = stmt->lhs->Eval(this);
202 const string&& rhs = stmt->rhs->Eval(this);
203 is_true = ((lhs == rhs) == (stmt->op == CondOp::IFEQ));
211 const vector<Stmt*>* stmts;
213 stmts = &stmt->true_stmts;
215 stmts = &stmt->false_stmts;
217 for (Stmt* a : *stmts) {
229 for (Stmt* stmt : mk->stmts()) {
230 LOG("%s", stmt->DebugString().c_str());
231 stmt->Eval(this);
235 void Evaluator::EvalInclude(const IncludeStmt* stmt) {
236 loc_ = stmt->loc();
239 const string&& pats = stmt->expr->Eval(this);
245 if (stmt->should_exist) {
253 if (!stmt->should_exist && g_flags.ignore_optional_include_pattern &&
262 void Evaluator::EvalExport(const ExportStmt* stmt) {
263 loc_ = stmt->loc();
266 const string&& exports = stmt->expr->Eval(this);
270 exports_[Intern(tok)] = stmt->is_export;
280 exports_[Intern(lhs)] = stmt->is_export;