Exemple #1
0
bool Flower::onParseComplete(Unit* unit)
{
	std::list<Symbol*> calls;
	printf("Flower.onParseComplete()\n");

	for (auto& call: FlowCallIterator(unit)) {
		if (call->callee()->name() != "assert" && call->callee()->name() != "assert_fail")
			continue;

		ListExpr* args = call->args();
		if (args->empty()) continue;

		// add a string argument that equals the expression's source code
		Expr* arg = args->at(0);
		std::string source = arg->sourceLocation().text();
		args->push_back(new StringExpr(source, SourceLocation()));
	}

	return true;
}