Lines Matching refs:to
40 void WriteComment(CodeWriter* to, const std::string& comment) { in WriteComment() argument
41 to->Write("%s", comment.c_str()); in WriteComment()
42 if (!comment.empty() && comment.back() != '\n') to->Write("\n"); in WriteComment()
45 void WriteModifiers(CodeWriter* to, int mod, int mask) { in WriteModifiers() argument
49 to->Write("@Override "); in WriteModifiers()
53 to->Write("public "); in WriteModifiers()
55 to->Write("private "); in WriteModifiers()
57 to->Write("protected "); in WriteModifiers()
61 to->Write("static "); in WriteModifiers()
65 to->Write("final "); in WriteModifiers()
69 to->Write("abstract "); in WriteModifiers()
73 void WriteArgumentList(CodeWriter* to, const vector<std::shared_ptr<Expression>>& arguments) { in WriteArgumentList() argument
76 arguments[i]->Write(to); in WriteArgumentList()
78 to->Write(", "); in WriteArgumentList()
85 void Field::Write(CodeWriter* to) const { in Write()
86 WriteComment(to, comment); in Write()
88 to->Write("%s\n", a.c_str()); in Write()
90 WriteModifiers(to, this->modifiers, SCOPE_MASK | STATIC | FINAL | OVERRIDE); in Write()
91 this->variable->WriteDeclaration(to); in Write()
94 to->Write(" = %s", this->value.c_str()); in Write()
96 to->Write(";\n"); in Write()
101 void LiteralExpression::Write(CodeWriter* to) const { in Write()
102 to->Write("%s", this->value.c_str()); in Write()
107 void StringLiteralExpression::Write(CodeWriter* to) const { in Write()
108 to->Write("\"%s\"", this->value.c_str()); in Write()
113 void Variable::WriteDeclaration(CodeWriter* to) const { in WriteDeclaration()
115 to->Write("%s ", a.c_str()); in WriteDeclaration()
117 to->Write("%s %s", this->type.c_str(), this->name.c_str()); in WriteDeclaration()
120 void Variable::Write(CodeWriter* to) const { to->Write("%s", name.c_str()); } in Write()
127 void FieldVariable::Write(CodeWriter* to) const { in Write()
129 overloaded{[&](std::shared_ptr<Expression> e) { e->Write(to); }, in Write()
130 [&](const std::string& s) { to->Write("%s", s.c_str()); }, [](std::monostate) {}}, in Write()
132 to->Write(".%s", name.c_str()); in Write()
137 void LiteralStatement::Write(CodeWriter* to) const { in Write()
138 to->Write("%s", value_.c_str()); in Write()
141 void StatementBlock::Write(CodeWriter* to) const { in Write()
142 to->Write("{\n"); in Write()
143 to->Indent(); in Write()
146 this->statements[i]->Write(to); in Write()
148 to->Dedent(); in Write()
149 to->Write("}\n"); in Write()
162 void ExpressionStatement::Write(CodeWriter* to) const { in Write()
163 this->expression->Write(to); in Write()
164 to->Write(";\n"); in Write()
173 void Assignment::Write(CodeWriter* to) const { in Write()
174 this->lvalue->Write(to); in Write()
175 to->Write(" = "); in Write()
177 to->Write("(%s)", this->cast->c_str()); in Write()
179 this->rvalue->Write(to); in Write()
199 void MethodCall::Write(CodeWriter* to) const { in Write()
202 e->Write(to); in Write()
203 to->Write("."); in Write()
205 [&](const std::string& s) { to->Write("%s.", s.c_str()); }, [](std::monostate) {}}, in Write()
207 to->Write("%s(", this->name.c_str()); in Write()
208 WriteArgumentList(to, this->arguments); in Write()
209 to->Write(")"); in Write()
216 void Comparison::Write(CodeWriter* to) const { in Write()
217 to->Write("("); in Write()
218 this->lvalue->Write(to); in Write()
219 to->Write("%s", this->op.c_str()); in Write()
220 this->rvalue->Write(to); in Write()
221 to->Write(")"); in Write()
230 void NewExpression::Write(CodeWriter* to) const { in Write()
231 to->Write("new %s(", this->instantiableName.c_str()); in Write()
232 WriteArgumentList(to, this->arguments); in Write()
233 to->Write(")"); in Write()
239 void NewArrayExpression::Write(CodeWriter* to) const { in Write()
240 to->Write("new %s[", this->type.c_str()); in Write()
241 size->Write(to); in Write()
242 to->Write("]"); in Write()
247 void Cast::Write(CodeWriter* to) const { in Write()
248 to->Write("((%s)", this->type.c_str()); in Write()
249 expression->Write(to); in Write()
250 to->Write(")"); in Write()
258 void VariableDeclaration::Write(CodeWriter* to) const { in Write()
259 this->lvalue->WriteDeclaration(to); in Write()
261 to->Write(" = "); in Write()
262 this->rvalue->Write(to); in Write()
264 to->Write(";\n"); in Write()
267 void IfStatement::Write(CodeWriter* to) const { in Write()
269 to->Write("if ("); in Write()
270 this->expression->Write(to); in Write()
271 to->Write(") "); in Write()
273 this->statements->Write(to); in Write()
275 to->Write("else "); in Write()
276 this->elseif->Write(to); in Write()
282 void ReturnStatement::Write(CodeWriter* to) const { in Write()
283 to->Write("return "); in Write()
284 this->expression->Write(to); in Write()
285 to->Write(";\n"); in Write()
288 void TryStatement::Write(CodeWriter* to) const { in Write()
289 to->Write("try "); in Write()
290 this->statements->Write(to); in Write()
293 void FinallyStatement::Write(CodeWriter* to) const { in Write()
294 to->Write("finally "); in Write()
295 this->statements->Write(to); in Write()
300 void Case::Write(CodeWriter* to) const { in Write()
306 to->Write("case %s:\n", s.c_str()); in Write()
308 to->Write("default:\n"); in Write()
312 to->Write("default:\n"); in Write()
314 statements->Write(to); in Write()
319 void SwitchStatement::Write(CodeWriter* to) const { in Write()
320 to->Write("switch ("); in Write()
321 this->expression->Write(to); in Write()
322 to->Write(")\n{\n"); in Write()
323 to->Indent(); in Write()
326 this->cases[i]->Write(to); in Write()
328 to->Dedent(); in Write()
329 to->Write("}\n"); in Write()
332 void Method::Write(CodeWriter* to) const { in Write()
335 WriteComment(to, comment); in Write()
338 to->Write("%s\n", a.c_str()); in Write()
341 WriteModifiers(to, this->modifiers, in Write()
345 to->Write("%s ", this->returnType->c_str()); in Write()
348 to->Write("%s(", this->name.c_str()); in Write()
352 this->parameters[i]->WriteDeclaration(to); in Write()
354 to->Write(", "); in Write()
358 to->Write(")"); in Write()
363 to->Write(" throws "); in Write()
365 to->Write(", "); in Write()
367 to->Write("%s", this->exceptions[i].c_str()); in Write()
371 to->Write(";\n"); in Write()
373 to->Write("\n"); in Write()
374 this->statements->Write(to); in Write()
378 void LiteralClassElement::Write(CodeWriter* to) const { in Write()
379 to->Write("%s", element.c_str()); in Write()
382 void Class::Write(CodeWriter* to) const { in Write()
385 WriteComment(to, comment); in Write()
387 to->Write("%s\n", a.c_str()); in Write()
390 WriteModifiers(to, this->modifiers, ALL_MODIFIERS); in Write()
393 to->Write("class "); in Write()
395 to->Write("interface "); in Write()
404 to->Write("%s", name.c_str()); in Write()
407 to->Write(" extends %s", this->extends->c_str()); in Write()
413 to->Write(" implements"); in Write()
415 to->Write(" extends"); in Write()
418 to->Write(" %s", this->interfaces[i].c_str()); in Write()
422 to->Write("\n"); in Write()
423 to->Write("{\n"); in Write()
424 to->Indent(); in Write()
428 this->elements[i]->Write(to); in Write()
431 to->Dedent(); in Write()
432 to->Write("}\n"); in Write()
443 void Document::Write(CodeWriter* to) const { in Write()
445 to->Write("%s\n", comment_.c_str()); in Write()
447 to->Write( in Write()
452 to->Write("package %s;\n", package_.c_str()); in Write()
456 clazz_->Write(to); in Write()