本文整理汇总了C++中StringExp::toChars方法的典型用法代码示例。如果您正苦于以下问题:C++ StringExp::toChars方法的具体用法?C++ StringExp::toChars怎么用?C++ StringExp::toChars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringExp
的用法示例。
在下文中一共展示了StringExp::toChars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compileIt
void CompileDeclaration::compileIt(Scope *sc)
{
//printf("CompileDeclaration::compileIt(loc = %d) %s\n", loc.linnum, exp->toChars());
sc = sc->startCTFE();
exp = exp->semantic(sc);
exp = resolveProperties(sc, exp);
sc = sc->endCTFE();
exp = exp->ctfeInterpret();
StringExp *se = exp->toString();
if (!se)
{
exp->error("argument to mixin must be a string, not (%s)", exp->toChars());
}
else
{
se = se->toUTF8(sc);
Parser p(loc, sc->module, (utf8_t *)se->string, se->len, 0);
p.nextToken();
unsigned errors = global.errors;
decl = p.parseDeclDefs(0);
if (p.token.value != TOKeof)
exp->error("incomplete mixin declaration (%s)", se->toChars());
if (global.errors != errors)
decl = NULL;
}
}
示例2: compileIt
void CompileDeclaration::compileIt(Scope *sc)
{
//printf("CompileDeclaration::compileIt(loc = %d)\n", loc.linnum);
exp = exp->semantic(sc);
exp = resolveProperties(sc, exp);
exp = exp->optimize(WANTvalue | WANTinterpret);
if (exp->op != TOKstring)
{ exp->error("argument to mixin must be a string, not (%s)", exp->toChars());
}
else
{
StringExp *se = (StringExp *)exp;
se = se->toUTF8(sc);
Parser p(sc->module, (unsigned char *)se->string, se->len, 0);
p.loc = loc;
p.nextToken();
decl = p.parseDeclDefs(0);
if (p.token.value != TOKeof)
exp->error("incomplete mixin declaration (%s)", se->toChars());
}
}