本文整理汇总了C++中ASTNode::name方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTNode::name方法的具体用法?C++ ASTNode::name怎么用?C++ ASTNode::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTNode
的用法示例。
在下文中一共展示了ASTNode::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST_F(ParserTests_Types, GlobalUntyped) {
ASTNode* node = this->parseNode("value\n");
node = node->childAtIndex(0);
ASSERT_EQ("Variable Declaration", node->nodeName());
ASSERT_EQ("value", node->name());
ASSERT_EQ(DataType::Undefined, node->dataType().kind());
}
示例2: test
TEST_F(ParserTests_Atomics, AtomicStatementWithFallbackFunctions) {
ASTNode* node = this->parseNodeWithBodies("def fn_1(*Void ptr) -> Bool\n"
" return true\n"
"end\n"
"def fn_2(*Void ptr) -> Bool\n"
" return true\n"
"end\n"
"def test(*Void ptr)\n"
" atomic:fallback(fn_1, fn_2, ptr)\n"
" abort\n"
" end\n"
"end\n");
ASSERT_EQ(3, node->childCount());
node = node->childAtIndex(2);
ASSERT_EQ("Function Definition", node->nodeName());
ASSERT_EQ(1, node->childCount());
node = node->childAtIndex(0);
ASSERT_EQ("Atomic Statement", node->nodeName());
auto atomicNode = dynamic_cast<AtomicStatementNode*>(node);
node = atomicNode->lockFunction();
ASSERT_TRUE(node != nullptr);
ASSERT_EQ("Function Variable", node->nodeName());
ASSERT_EQ("fn_1", node->name());
node = atomicNode->unlockFunction();
ASSERT_TRUE(node != nullptr);
ASSERT_EQ("Function Variable", node->nodeName());
ASSERT_EQ("fn_2", node->name());
node = atomicNode->lockContext();
ASSERT_TRUE(node != nullptr);
ASSERT_EQ("Local Variable", node->nodeName());
ASSERT_EQ("ptr", node->name());
}