Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dotnet): use fully-qualified type names #651

Merged
merged 4 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# jsii

[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=aws/jsii)](https://dependabot.com)
![Build Status](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiOThRRFVsVlRBTEhocVZOckE0bFlFWEtwNU0xUmtNUlRRclY0R2VYTGJaOXRlaVdaVnREV2lhVGtDUzQzUDRMMCtuYWpSTWo4N1FGTEV5Zm9yZ0dEb2dBPSIsIml2UGFyYW1ldGVyU3BlYyI6InFVbktYSlpDem1YN1JCeU8iLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
[![npm](https://img.shields.io/npm/v/jsii)](https://www.npmjs.com/package/jsii)

__jsii__ allows code in any language to naturally interact with JavaScript classes.

Expand Down Expand Up @@ -281,7 +283,7 @@ jsii configuration is read from the `jsii` section in the module's
__jsii-pacmak__. This is where target artifacts are emitted during packaging.
Each artifact will be emitted under `<outdir>/<target>` (e.g. `dist/java`,
`dist/js`, etc). Conventionally we use `"dist"` for outdir.
* `tsc` - this section allows to adjust the compiler options of the generated `tsconfig.json`.
* `tsc` - this section allows to adjust the compiler options of the generated `tsconfig.json`.
Currently you can set `outDir` and `rootDir`. Setting `rootDir` automatically adjusts the `include` config.

### Java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,6 @@ System.Action<UsingDirectiveSyntax> GetInspector(string expected)
}
}

[Fact(DisplayName = Prefix + nameof(CreatesUsingStatementForType))]
public void CreatesUsingStatementForType()
{
EnumType type = new EnumType
(
fullyQualifiedName: "myEnumFqn",
assembly: "myModule",
name: "myEnum",
members: new EnumMember[] { }
);

Symbols.MapNamespace(type.QualifiedNamespace, "MyNamespace");

NamespaceSet namespaces = new NamespaceSet(Symbols, SF.ParseName("MyCurrentNamespace"));
namespaces.Add(type);

SyntaxList<UsingDirectiveSyntax> usings = namespaces.GetUsings();
AssertUsings
(
usings,
"using Amazon.JSII.Runtime.Deputy;",
"using MyNamespace;"
);
}

[Fact(DisplayName = Prefix + nameof(CreatesUsingStatementForObjectReference))]
public void CreatesUsingStatementForObjectReference()
{
Expand All @@ -62,8 +37,7 @@ public void CreatesUsingStatementForObjectReference()
AssertUsings
(
usings,
"using Amazon.JSII.Runtime.Deputy;",
"using MyNamespace;"
"using Amazon.JSII.Runtime.Deputy;"
);
}

Expand Down Expand Up @@ -261,7 +235,6 @@ public void SortsUsingStatementsAlphaNumerically()
AssertUsings
(
usings,
"using AAA;",
"using Amazon.JSII.Runtime.Deputy;"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,50 +70,50 @@ public static void MapTypeName(this ISymbolMap symbols, string fullyQualifiedNam
var defaultName = frameworkName;

symbols
.GetInterfaceProxyName(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetInterfaceProxyName(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(proxyName);
symbols
.GetInterfaceDefaultName(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetInterfaceDefaultName(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(defaultName);
symbols
.GetInterfaceProxyNameSyntaxToken(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetInterfaceProxyNameSyntaxToken(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(SF.ParseToken(proxyName));
symbols
.GetInterfaceDefaultNameSyntaxToken(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetInterfaceDefaultNameSyntaxToken(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(SF.ParseToken(defaultName));
symbols
.GetInterfaceProxyNameSyntax(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetInterfaceProxyNameSyntax(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(SF.ParseName(proxyName));
symbols
.GetInterfaceDefaultNameSyntax(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetInterfaceDefaultNameSyntax(Arg.Is<InterfaceType>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(SF.ParseName(defaultName));

frameworkName = $"I{frameworkName}";
break;
case TypeKind.Class:
symbols
.GetAbstractClassProxyName(Arg.Is<ClassType>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetAbstractClassProxyName(Arg.Is<ClassType>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(proxyName);
break;
}

symbols
.GetName(Arg.Is<Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetName(Arg.Is<Type>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(frameworkName);
symbols
.GetName(Arg.Is<string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetName(Arg.Is<string>(fqn => fqn == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(frameworkName);
symbols
.GetNameSyntaxToken(Arg.Is<Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetNameSyntaxToken(Arg.Is<Type>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(SF.ParseToken(frameworkName));
symbols
.GetNameSyntaxToken(Arg.Is<string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetNameSyntaxToken(Arg.Is<string>(fqn => fqn == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(SF.ParseToken(frameworkName));
symbols
.GetNameSyntax(Arg.Is<Type>(t => t.FullyQualifiedName == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetNameSyntax(Arg.Is<Type>(t => t.FullyQualifiedName == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(SF.ParseName(frameworkName));
symbols
.GetNameSyntax(Arg.Is<string>(fqn => fqn == fullyQualifiedName), disambiguate: Arg.Any<bool>())
.GetNameSyntax(Arg.Is<string>(fqn => fqn == fullyQualifiedName), qualified: Arg.Any<bool>())
.Returns(SF.ParseName(frameworkName));
symbols
.GetTypeSyntax(Arg.Is<TypeReference>(t => t.FullyQualifiedName == fullyQualifiedName), false)
Expand Down
Loading