Commit f5074edd authored by Jason Choy's avatar Jason Choy

Added name annotation support for interfaces, methods and params

parent e8154d95
......@@ -1243,7 +1243,7 @@ private:
MethodText makeMethodText(kj::StringPtr interfaceName, InterfaceSchema::Method method) {
auto proto = method.getProto();
auto name = proto.getName();
auto name = protoName(proto);
auto titleCase = toTitleCase(name);
auto paramSchema = schemaLoader.get(proto.getParamStructType()).asStruct();
auto resultSchema = schemaLoader.get(proto.getResultStructType()).asStruct();
......@@ -1593,7 +1593,7 @@ private:
auto paramsProto = schemaLoader.get(method.getParamStructType()).getProto();
if (paramsProto.getScopeId() == 0) {
nestedTexts.add(makeNodeText(namespace_, subScope,
toTitleCase(kj::str(method.getName(), "Params")), params));
toTitleCase(kj::str(protoName(method), "Params")), params));
}
}
{
......@@ -1601,7 +1601,7 @@ private:
auto resultsProto = schemaLoader.get(method.getResultStructType()).getProto();
if (resultsProto.getScopeId() == 0) {
nestedTexts.add(makeNodeText(namespace_, subScope,
toTitleCase(kj::str(method.getName(), "Results")), results));
toTitleCase(kj::str(protoName(method), "Results")), results));
}
}
}
......
......@@ -1683,6 +1683,9 @@ TEST(Encoding, NameAnnotation) {
nestedFieldBuilder.setGoodNestedFieldName(true);
EXPECT_EQ(true, nestedFieldBuilder.getGoodNestedFieldName());
EXPECT_FALSE(nestedFieldBuilder.hasAnotherGoodNestedFieldName());
test::RenamedInterface::RenamedMethodParams::Reader renamedInterfaceParams;
renamedInterfaceParams.getRenamedParam();
}
} // namespace
......
......@@ -720,3 +720,7 @@ struct TestNameAnnotation $Cxx.name("RenamedStruct") {
baz @5 :NestedStruct $Cxx.name("qux");
}
}
interface TestNameAnnotationInterface $Cxx.name("RenamedInterface") {
badlyNamedMethod @0 (badlyNamedParam :UInt8 $Cxx.name("renamedParam")) $Cxx.name("renamedMethod");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment