本文整理汇总了C++中ASTPrinter::printName方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTPrinter::printName方法的具体用法?C++ ASTPrinter::printName怎么用?C++ ASTPrinter::printName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTPrinter
的用法示例。
在下文中一共展示了ASTPrinter::printName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printImpl
void TupleTypeRepr::printImpl(ASTPrinter &Printer,
const PrintOptions &Opts) const {
Printer.callPrintStructurePre(PrintStructureKind::TupleType);
SWIFT_DEFER { Printer.printStructurePost(PrintStructureKind::TupleType); };
Printer << "(";
for (unsigned i = 0, e = Bits.TupleTypeRepr.NumElements; i != e; ++i) {
if (i) Printer << ", ";
Printer.callPrintStructurePre(PrintStructureKind::TupleElement);
auto name = getElementName(i);
if (isNamedParameter(i)) {
// Printing empty Identifier is same as printing '_'.
Printer.printName(Identifier(),
PrintNameContext::FunctionParameterExternal);
if (!name.empty()) {
Printer << " ";
Printer.printName(name, PrintNameContext::FunctionParameterLocal);
}
Printer << ": ";
} else {
if (!name.empty()) {
Printer.printName(name, PrintNameContext::TupleElement);
Printer << ": ";
}
}
printTypeRepr(getElementType(i), Printer, Opts);
Printer.printStructurePost(PrintStructureKind::TupleElement);
if (hasEllipsis() && getEllipsisIndex() == i)
Printer << "...";
}
Printer << ")";
}
示例2: printImpl
void NamedTypeRepr::printImpl(ASTPrinter &Printer,
const PrintOptions &Opts) const {
if (!Id.empty()) {
Printer.printName(Id, PrintNameContext::TupleElement);
Printer << ": ";
}
printTypeRepr(Ty, Printer, Opts);
}