Lines Matching refs:stmt
28 #include "stmt.h"
101 void Evaluator::EvalAssign(const AssignStmt* stmt) {
102 loc_ = stmt->loc();
104 Symbol lhs = stmt->GetLhsSymbol(this);
110 stmt->rhs->Eval(this, &rhs);
121 Var* rhs = EvalRHS(lhs, stmt->rhs, stmt->orig_rhs, stmt->op,
122 stmt->directive == AssignDirective::OVERRIDE);
126 stmt->directive == AssignDirective::OVERRIDE,
134 void Evaluator::EvalRule(const RuleStmt* stmt) {
135 loc_ = stmt->loc();
138 const string&& expr = stmt->expr->Eval(this);
141 if (stmt->term == ';')
148 function<string()> after_term_fn = [this, stmt](){
149 return stmt->after_term ? stmt->after_term->Eval(this) : "";
151 ParseRule(loc_, expr, stmt->term, after_term_fn, &rule, &rule_var);
154 if (stmt->term == ';') {
155 rule->cmds.push_back(stmt->after_term);
176 Value* rhs = stmt->after_term;
182 if (stmt->term == ';') {
220 void Evaluator::EvalCommand(const CommandStmt* stmt) {
221 loc_ = stmt->loc();
224 vector<Stmt*> stmts;
225 ParseNotAfterRule(stmt->orig, stmt->loc(), &stmts);
226 for (Stmt* a : stmts)
231 last_rule_->cmds.push_back(stmt->expr);
233 last_rule_->cmd_lineno = stmt->loc().lineno;
234 LOG("Command: %s", stmt->expr->DebugString().c_str());
237 void Evaluator::EvalIf(const IfStmt* stmt) {
238 loc_ = stmt->loc();
241 switch (stmt->op) {
245 stmt->lhs->Eval(this, &var_name);
250 is_true = (v->String().empty() == (stmt->op == CondOp::IFNDEF));
255 const string&& lhs = stmt->lhs->Eval(this);
256 const string&& rhs = stmt->rhs->Eval(this);
257 is_true = ((lhs == rhs) == (stmt->op == CondOp::IFEQ));
265 const vector<Stmt*>* stmts;
267 stmts = &stmt->true_stmts;
269 stmts = &stmt->false_stmts;
271 for (Stmt* a : *stmts) {
285 for (Stmt* stmt : mk->stmts()) {
286 LOG("%s", stmt->DebugString().c_str());
287 stmt->Eval(this);
291 void Evaluator::EvalInclude(const IncludeStmt* stmt) {
292 loc_ = stmt->loc();
295 const string&& pats = stmt->expr->Eval(this);
301 if (stmt->should_exist) {
309 if (!stmt->should_exist && g_flags.ignore_optional_include_pattern &&
318 void Evaluator::EvalExport(const ExportStmt* stmt) {
319 loc_ = stmt->loc();
322 const string&& exports = stmt->expr->Eval(this);
326 exports_[Intern(tok)] = stmt->is_export;
336 exports_[Intern(lhs)] = stmt->is_export;