From 881a59b2c988a779dd175f0135860520e012278f Mon Sep 17 00:00:00 2001 From: Kuba Ober Date: Thu, 29 Aug 2019 12:01:08 -0400 Subject: [PATCH] Test namespace generation in imported types. --- .../Properties/Resources.Designer.cs | 10 ++++++++ capnpc-csharp.tests/Properties/Resources.resx | 3 +++ .../Resources/UnitTest10.capnp.bin | Bin 0 -> 1616 bytes capnpc-csharp.tests/UnitTest10.capnp | 9 +++++++ capnpc-csharp.tests/UnitTest10b.capnp | 7 +++++ capnpc-csharp.tests/UnitTests.cs | 24 ++++++++++++++++++ capnpc-csharp/Generator/GenNames.cs | 2 +- 7 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 capnpc-csharp.tests/Resources/UnitTest10.capnp.bin create mode 100644 capnpc-csharp.tests/UnitTest10.capnp create mode 100644 capnpc-csharp.tests/UnitTest10b.capnp diff --git a/capnpc-csharp.tests/Properties/Resources.Designer.cs b/capnpc-csharp.tests/Properties/Resources.Designer.cs index 26b2a07..ad396a7 100644 --- a/capnpc-csharp.tests/Properties/Resources.Designer.cs +++ b/capnpc-csharp.tests/Properties/Resources.Designer.cs @@ -70,6 +70,16 @@ namespace capnpc_csharp.Tests.Properties { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] UnitTest10_capnp { + get { + object obj = ResourceManager.GetObject("UnitTest10_capnp", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Byte[]. /// diff --git a/capnpc-csharp.tests/Properties/Resources.resx b/capnpc-csharp.tests/Properties/Resources.resx index 20c6d62..43736d8 100644 --- a/capnpc-csharp.tests/Properties/Resources.resx +++ b/capnpc-csharp.tests/Properties/Resources.resx @@ -118,6 +118,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\UnitTest10.capnp.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\UnitTest3.capnp.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/capnpc-csharp.tests/Resources/UnitTest10.capnp.bin b/capnpc-csharp.tests/Resources/UnitTest10.capnp.bin new file mode 100644 index 0000000000000000000000000000000000000000..dade3aa90ae451daf5849f33963c81461de09820 GIT binary patch literal 1616 zcmaJ>ziSjx5T3o{qKO7CL5ZDMiAGFf=Qe^6jRX|@(b&j(o^XZlj=N2vK}aN3Vv~Rb zEdr^6jkYFYM2kcl@y9>lzYr^fD1P62JMQhv?G4PE_h#PAelzoCMMOS<9d*k9HbVuG zui#_YcY_1)6wb?#BKz!m6l+m>Wbn(g$(Iv<-W;&n{ACBGdGIcH2wX%^#?PbEw`bn1 z>~5`>aG?kUvsXr6Pe1zg*1zA2INzW=0_l*s8zr2(Eb^>}#_7wd_nZRwKZce#Pe2}r z?1XoH?#YkR$LZBU+{IN{-V7GD-#>koMI~|)#t*QMLAK(Bsx3|a?s+ly{niHi!nj)R z!1L~haRYY04g=7iZxdPZ9c*K3RT1YB6z3q>w{gf$b+~D&@r_C|9veMVj_RhavD`Zf zMDsxyISalz6;~RN&R!7hJI@7Vd>E3M`#9-Ozl*h67+#1PTpsdjLiXb$<>6rmBQ(+d zO0yo7D|!JkXcM=^Y`0z<*`N3+&R(3afj=+q{C%)?_b1P%!2b7mhB`M-&Qo5V&tb7R z!Z0$X7DsWlW}4RF|B}}IPLlCuV{Bzzo~b=CYvJuz1B{B)Q8t0Xy^WaYDs`galb}7CDe{wvcYTz0RAj*Svha&WY-o_aQLzB{C(=U%y*~f%&mt{BNao&Ca8~W6h86 VmVSzp{!8Eye*mB(rE# new Generator.CodeGenerator(model, new Generator.GeneratorOptions()); diff --git a/capnpc-csharp/Generator/GenNames.cs b/capnpc-csharp/Generator/GenNames.cs index f71a253..ea6b3a3 100644 --- a/capnpc-csharp/Generator/GenNames.cs +++ b/capnpc-csharp/Generator/GenNames.cs @@ -235,7 +235,7 @@ namespace CapnpC.Generator return qtype; } - NameSyntax GetQName(Model.Type type, TypeDefinition scope) + internal NameSyntax GetQName(Model.Type type, TypeDefinition scope) { // FIXME: With the help of the 'scope' parameter we will be able to generate abbreviated // qualified names. Unfortunately the commented approach is too naive. It will fail if