本文整理汇总了C++中SNode::findChild方法的典型用法代码示例。如果您正苦于以下问题:C++ SNode::findChild方法的具体用法?C++ SNode::findChild怎么用?C++ SNode::findChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SNode
的用法示例。
在下文中一共展示了SNode::findChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyVariable
void DerivationWriter :: copyVariable(SNode node)
{
SNode local = node.firstChild();
_writer.newNode(lxVariable);
if (_hints != lxNone) {
copyHints(_hints);
_hints = lxNone;
}
unpackNode(local, 0);
_writer.closeNode();
SNode current = node.findChild((LexicalType)nsAssigning);
if (current != lxNone) {
_writer.newNode(lxExpression);
_writer.appendNode(lxAssign);
unpackNode(local, 1);
unpackChildren(current);
_writer.closeNode();
}
}
示例2: optimizeEmbeddableGet
bool CompilerLogic :: optimizeEmbeddableGet(_CompilerScope& scope, _Compiler& compiler, SNode node)
{
SNode callNode = node.findSubNode(lxDirectCalling, lxSDirctCalling);
SNode callTarget = callNode.findChild(lxCallTarget);
ClassInfo info;
defineClassInfo(scope, info, callTarget.argument);
ref_t subject = info.methodHints.get(Attribute(callNode.argument, maEmbeddableGet));
// if it is possible to replace get&subject operation with eval&subject2:local
if (subject != 0) {
compiler.injectEmbeddableGet(node, callNode, subject);
return true;
}
else return false;
}
示例3: optimizeEmbeddable
bool CompilerLogic :: optimizeEmbeddable(SNode node, _CompilerScope& scope)
{
// check if it is a virtual call
if (node == lxDirectCalling && getVerb(node.argument) == GET_MESSAGE_ID && getParamCount(node.argument) == 0) {
SNode callTarget = node.findChild(lxCallTarget);
ClassInfo info;
defineClassInfo(scope, info, callTarget.argument);
if (info.methodHints.get(Attribute(node.argument, maEmbeddableIdle)) == -1) {
// if it is an idle call, remove it
node = lxExpression;
return true;
}
}
return false;
}
示例4: recognizeEmbeddableGet
bool CompilerLogic :: recognizeEmbeddableGet(_CompilerScope& scope, SNode root, ref_t returningType, ref_t& subject)
{
if (returningType != 0 && defineStructSize(scope, scope.attributeHints.get(returningType), 0, true) > 0) {
root = root.findChild(lxNewFrame);
if (SyntaxTree::matchPattern(root, lxObjectMask, 2,
SNodePattern(lxExpression),
SNodePattern(lxReturning)))
{
SNode message = SyntaxTree::findPattern(root, 2,
SNodePattern(lxExpression),
SNodePattern(lxDirectCalling, lxSDirctCalling));
// if it is eval&subject2:var[1] message
if (getParamCount(message.argument) != 1)
return false;
// check if it is operation with $self
SNode target = SyntaxTree::findPattern(root, 3,
SNodePattern(lxExpression),
SNodePattern(lxDirectCalling, lxSDirctCalling),
SNodePattern(lxThisLocal));
//// if the target was optimized
//if (target == lxExpression) {
// target = SyntaxTree::findChild(target, lxLocal);
//}
if (target == lxNone || target.argument != 1)
return false;
// check if the argument is returned
SNode arg = SyntaxTree::findPattern(root, 4,
SNodePattern(lxExpression),
SNodePattern(lxDirectCalling, lxSDirctCalling),
SNodePattern(lxExpression),
SNodePattern(lxLocalAddress));
if (arg == lxNone) {
arg = SyntaxTree::findPattern(root, 5,
SNodePattern(lxExpression),
SNodePattern(lxDirectCalling, lxSDirctCalling),
SNodePattern(lxExpression),
SNodePattern(lxExpression),
SNodePattern(lxLocalAddress));
}
SNode ret = SyntaxTree::findPattern(root, 4,
SNodePattern(lxReturning),
SNodePattern(lxExpression),
SNodePattern(lxBoxing),
SNodePattern(lxLocalAddress));
if (arg != lxNone && ret != lxNone && arg.argument == ret.argument) {
subject = getSignature(message.argument);
return true;
}
}
}
return false;
}