Skip to content

Commit 894823a

Browse files
committed
Backup work
1 parent 530ae25 commit 894823a

File tree

11 files changed

+157
-15
lines changed

11 files changed

+157
-15
lines changed

Source/EventHorizon.Blazor.TypeScript.Interop.Generator/AstParser/NodeImpl/NodeJS_ASTWrapper.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ string source
6060
).GetAwaiter().GetResult();
6161

6262
// Use for testing the generated AST
63-
//File.WriteAllText(
64-
// Path.Combine(
65-
// ".",
66-
// "AstParser",
67-
// "NodeImpl",
68-
// "NodeJS",
69-
// "_generated",
70-
// "ast.json"
71-
// ),
72-
// result
73-
//);
63+
File.WriteAllText(
64+
Path.Combine(
65+
".",
66+
"AstParser",
67+
"NodeImpl",
68+
"NodeJS",
69+
"_generated",
70+
"ast.json"
71+
),
72+
result
73+
);
7474
var ast = JsonSerializer.Deserialize<ASTModel>(
7575
result,
7676
new JsonSerializerOptions

Source/EventHorizon.Blazor.TypeScript.Interop.Generator/Templates/ConstructorWithArgumentsTemplate.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
)[[BASE_CLASS_CALL]]
44
{
55
var entity = EventHorizonBlazorInterop.New(
6-
new string[] { [[PROPERTY_NAMESPACE]], "[[CLASS_NAME]]" },
6+
new string[] { [[PROPERTY_NAMESPACE]]"[[CLASS_NAME]]" },
77
[[PROPERTY_ARGUMENTS]]
88
);
99
___guid = entity.___guid;

Source/EventHorizon.Blazor.TypeScript.Interop.Generator/Writers/AccessorsSectionWriter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ClassGenerationTemplates templates
7676
}
7777
}
7878

79-
if(isEnum)
79+
if (isEnum)
8080
{
8181
propertyGetterResultType = templates.InteropGet;
8282
}
@@ -96,6 +96,11 @@ ClassGenerationTemplates templates
9696
propertyGetterResultType = templates.InteropGetArray;
9797
}
9898

99+
if (entityNamespace == @"""")
100+
{
101+
entityNamespace = string.Empty;
102+
}
103+
99104
template = template
100105
.Replace(
101106
"[[PROPERTY_GETTER]]",

Source/EventHorizon.Blazor.TypeScript.Interop.Generator/Writers/ConstructorSectionWriter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ ClassGenerationTemplates templates
5656
.Select(part => @$"""{part}""")
5757
);
5858

59+
if (entityNamespace == @"""""")
60+
{
61+
entityNamespace = string.Empty;
62+
}
63+
5964
return template.Replace(
6065
"[[CLASS_NAME]]",
6166
classStatement.Name

Source/EventHorizon.Blazor.TypeScript.Interop.Generator/Writers/PropertiesSectionWriter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ ClassGenerationTemplates templates
116116
template = "// [[NAME]] is not supported by the platform yet";
117117
}
118118

119+
if (entityNamespace == @"""")
120+
{
121+
entityNamespace = string.Empty;
122+
}
123+
119124
template = template
120125
.Replace(
121126
"[[PROPERTY_GETTER]]",

Source/Server/EventHorizon.Blazor.Interop.Generator/Templates/ConstructorWithArgumentsTemplate.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
)
44
{
55
var entity = await EventHorizonBlazorInterop.New(
6-
new string[] { [[PROPERTY_NAMESPACE]], "[[CLASS_NAME]]" },
6+
new string[] { [[PROPERTY_NAMESPACE]]"[[CLASS_NAME]]" },
77
[[PROPERTY_ARGUMENTS]]
88
);
99

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/// Generated - Do Not Edit
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text.Json.Serialization;
5+
using System.Threading.Tasks;
6+
using EventHorizon.Blazor.Interop;
7+
using EventHorizon.Blazor.Interop.Callbacks;
8+
using Microsoft.JSInterop;
9+
10+
11+
12+
[JsonConverter(typeof(CachedEntityConverter<ExampleClass>))]
13+
public class ExampleClass : CachedEntityObject
14+
{
15+
#region Static Accessors
16+
17+
public static decimal Now
18+
{
19+
get
20+
{
21+
return EventHorizonBlazorInterop.Get<decimal>(
22+
"ExampleClass",
23+
"Now"
24+
);
25+
}
26+
}
27+
#endregion
28+
29+
#region Static Properties
30+
31+
#endregion
32+
33+
#region Static Methods
34+
35+
#endregion
36+
37+
#region Accessors
38+
39+
#endregion
40+
41+
#region Properties
42+
43+
#endregion
44+
45+
#region Constructor
46+
public ExampleClass() : base() { }
47+
48+
public ExampleClass(
49+
ICachedEntity entity
50+
) : base(entity)
51+
{
52+
___guid = entity.___guid;
53+
}
54+
#endregion
55+
56+
#region Methods
57+
58+
#endregion
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export class ExampleClass {
2+
static get Now(): number;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/// Generated - Do Not Edit
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text.Json.Serialization;
5+
using System.Threading.Tasks;
6+
using EventHorizon.Blazor.Interop;
7+
using EventHorizon.Blazor.Interop.Callbacks;
8+
using Microsoft.JSInterop;
9+
10+
11+
12+
[JsonConverter(typeof(CachedEntityConverter<ExampleClass>))]
13+
public class ExampleClass : CachedEntityObject
14+
{
15+
#region Static Accessors
16+
17+
#endregion
18+
19+
#region Static Properties
20+
21+
#endregion
22+
23+
#region Static Methods
24+
25+
#endregion
26+
27+
#region Accessors
28+
29+
#endregion
30+
31+
#region Properties
32+
33+
#endregion
34+
35+
#region Constructor
36+
public ExampleClass() : base() { }
37+
38+
public ExampleClass(
39+
ICachedEntity entity
40+
) : base(entity)
41+
{
42+
___guid = entity.___guid;
43+
}
44+
45+
public ExampleClass(
46+
string arg1
47+
)
48+
{
49+
var entity = EventHorizonBlazorInterop.New(
50+
new string[] { "ExampleClass" },
51+
arg1
52+
);
53+
___guid = entity.___guid;
54+
}
55+
#endregion
56+
57+
#region Methods
58+
59+
#endregion
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export class ExampleClass {
2+
constructor(arg1: string) { }
3+
}

0 commit comments

Comments
 (0)