Skip to content

Commit 8b7100f

Browse files
type resolver for complex generic types
1 parent 5d1b2cb commit 8b7100f

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

Reinforced.Typings/Exceptions/ErrorMessages.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ class ErrorMessages
101101
/// Class {0} (base for {1}) is exported as interface. It is potentially unsafe facility.
102102
/// </summary>
103103
public static readonly ErrorMessage RTW0005_BaseClassExportingAsInterface = new ErrorMessage(0005, "Class {0} (base for {1}) is exported as interface. It is potentially unsafe facility.", "Class code generation");
104-
104+
105+
/// <summary>
106+
/// Error parsering XMLDOC file {0}: {1}
107+
/// </summary>
108+
public static readonly ErrorMessage RTW0006_DocumentationParseringError = new ErrorMessage(0006, "Error parsering XMLDOC file {0}: {1}", "JSDOC");
105109
#endregion
106110
}
107111
}

Reinforced.Typings/Exceptions/RtWarning.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
namespace Reinforced.Typings.Exceptions
88
{
99
/// <summary>
10-
/// Represents warning message that could be displayed during build
10+
/// Represents warning message that could be displayed during build.
11+
/// Warnings can be added to global warnings collection located at ExportContext.Warnings.
12+
/// ExportContext instance can be found inside every TsCodeGeneratorBase
1113
/// </summary>
1214
public class RtWarning
1315
{
@@ -26,6 +28,12 @@ public class RtWarning
2628
/// </summary>
2729
public string Text { get; set; }
2830

31+
/// <summary>
32+
/// Instantiates new RtWarning that is suitable be added to warnings collection.
33+
/// </summary>
34+
/// <param name="code">Warning code</param>
35+
/// <param name="subcategory">Warning subcategory (optional). Important! Warning subcategory should not contain word "warning" and ":" symbol</param>
36+
/// <param name="text">Warning text</param>
2937
public RtWarning(int code, string subcategory = null, string text = null)
3038
{
3139
Code = code;

Reinforced.Typings/TypeResolver.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ private RtTypeName ResolveTypeNameInner(Type t)
282282
if (tsFriendly != null && tsFriendly != AnyType)
283283
{
284284
var parametrized = new RtSimpleTypeName(tsFriendly.TypeName,
285-
def.GetGenericArguments().Select(ResolveTypeNameInner).ToArray());
285+
t.GetGenericArguments().Select(ResolveTypeNameInner).ToArray())
286+
{
287+
Namespace = tsFriendly.Namespace
288+
};
286289
return Cache(t, parametrized);
287290
}
288291
}

Reinforced.Typings/Xmldoc/DocumentationManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ internal void CacheDocumentation(string docFilePath, List<RtWarning> warnings)
6363
catch (Exception ex)
6464
{
6565
_isDocumentationExists = false;
66+
warnings.Add(ErrorMessages.RTW0006_DocumentationParseringError.Warn(docFilePath,ex.Message));
6667
}
6768
}
6869

package/Reinforced.Typings.nuspec

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>Reinforced.Typings</id>
5-
<version>1.2.2</version>
5+
<version>1.2.3</version>
66
<title>Reinforced.Typings</title>
77
<authors>Pavel B. Novikov</authors>
88
<owners>Pavel B. Novikov</owners>
@@ -16,10 +16,7 @@
1616
<tags>mvc, web, typescript</tags>
1717
<licenseUrl>https://github.com/reinforced/Reinforced.Typings/blob/master/LICENSE.md</licenseUrl>
1818
<releaseNotes>
19-
- Visual Studio-friendly warning and error messages
20-
- Extracting types information from .exe assemblies
21-
- Initialization expression for fields AST
22-
- Assembly signing
19+
- Generic type resolvation improvement
2320
</releaseNotes>
2421
</metadata>
2522
</package>

0 commit comments

Comments
 (0)