Skip to content

Commit a228240

Browse files
committed
Added ecma String and updated other.
1 parent 53e34b1 commit a228240

11 files changed

Lines changed: 195 additions & 10 deletions

File tree

CSharpToJavaScript/APIs/JS/Ecma/BigInt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public BigInt AasUintN(Number bits, BigInt bigint)
2323
throw new System.NotImplementedException();
2424
}
2525
}
26-
public class BigIntPrototype
26+
public class BigIntPrototype : FunctionPrototype
2727
{
2828
public BigIntPrototype() { }
2929

CSharpToJavaScript/APIs/JS/Ecma/Boolean.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public partial class Boolean : BooleanPrototype
2121
public Boolean(dynamic value) { }
2222
}
2323
[To(ToAttribute.FirstCharToLowerCase)]
24-
public partial class BooleanPrototype : ObjectPrototype
24+
public partial class BooleanPrototype : FunctionPrototype
2525
{
2626

2727
public BooleanPrototype() { }

CSharpToJavaScript/APIs/JS/Ecma/Date.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static float UTC(float year, float month = 0, float date = 1, float hours
3333
}
3434

3535
[To(ToAttribute.FirstCharToLowerCase)]
36-
public class DatePrototype
36+
public class DatePrototype : FunctionPrototype
3737
{
3838
public float GetDate()
3939
{

CSharpToJavaScript/APIs/JS/Ecma/Error.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public Error(string message, object? options = null)
1919
}
2020

2121
[To(ToAttribute.FirstCharToLowerCase)]
22-
public class ErrorPrototype : ObjectPrototype
22+
public class ErrorPrototype : FunctionPrototype
2323
{
2424
public string Message { get; set; } = string.Empty;
2525
public string Name { get; set; } = "Error";

CSharpToJavaScript/APIs/JS/Ecma/Function.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public dynamic Apply(dynamic thisArg, dynamic argArray)
3838
throw new System.NotImplementedException();
3939
}
4040

41-
public dynamic Bbind(dynamic thisArg, params dynamic[] args)
41+
public dynamic Bind(dynamic thisArg, params dynamic[] args)
4242
{
4343
throw new System.NotImplementedException();
4444
}

CSharpToJavaScript/APIs/JS/Ecma/Math.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace CSharpToJavaScript.APIs.JS
55
{
66
//https://262.ecma-international.org/14.0/#sec-math-object
77
[To(ToAttribute.Default)]
8-
public partial class Math
8+
public partial class Math : ObjectPrototype
99
{
1010
public const float E = 2.7182818284590452354f;
1111
public const float LN10 = 2.302585092994046f;

CSharpToJavaScript/APIs/JS/Ecma/Number.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public int ParseInt(string str, dynamic radix)
6767
}
6868
}
6969
[To(ToAttribute.FirstCharToLowerCase)]
70-
public class NumberPrototype
70+
public class NumberPrototype : FunctionPrototype
7171
{
7272
public string ToExponential(dynamic fractionDigits)
7373
{

CSharpToJavaScript/APIs/JS/Ecma/Object.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public static string[] Values(dynamic O)
151151
}
152152

153153
[To(ToAttribute.FirstCharToLowerCase)]
154-
public class ObjectPrototype
154+
public class ObjectPrototype
155155
{
156156
public ObjectPrototype() { }
157157

CSharpToJavaScript/APIs/JS/Ecma/RegExp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public RegExp([StringSyntax(StringSyntaxAttribute.Regex)] string pattern, string
1616

1717
//TODO! match etc.!!!! How? Extension methods?
1818
[To(ToAttribute.FirstCharToLowerCase)]
19-
public class RegExpPrototype
19+
public class RegExpPrototype : FunctionPrototype
2020
{
2121
public bool DotAll { get; }
2222
public string Flags { get; }
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
using CSharpToJavaScript.Utils;
2+
using System;
3+
using System.Buffers;
4+
using System.Collections;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using System.Reflection;
8+
using System.Text;
9+
using System.Text.RegularExpressions;
10+
using System.Threading.Tasks;
11+
12+
namespace CSharpToJavaScript.APIs.JS
13+
{
14+
//https://262.ecma-international.org/14.0/#sec-string-objects
15+
[To(ToAttribute.Default)]
16+
public partial class String : StringPrototype
17+
{
18+
public dynamic Value { get; set; }
19+
20+
public static implicit operator String(string value) { return new String(value) { Value = value }; }
21+
public static implicit operator string(String value) { return new String(value) { Value = value }; }
22+
23+
[To(ToAttribute.FirstCharToLowerCase)]
24+
public StringPrototype Prototype { get; } = new();
25+
26+
[To(ToAttribute.FirstCharToLowerCase)]
27+
public int Length { get; } = 0;
28+
29+
[To(ToAttribute.Default)]
30+
public String(string value = "") { }
31+
32+
[To(ToAttribute.FirstCharToLowerCase)]
33+
public static string FromCharCode(params Number[] codeUnits)
34+
{
35+
throw new System.NotImplementedException();
36+
}
37+
[To(ToAttribute.FirstCharToLowerCase)]
38+
public static string FromCodePoint(params Number[] codePoints)
39+
{
40+
throw new System.NotImplementedException();
41+
}
42+
//TODO template
43+
[To(ToAttribute.FirstCharToLowerCase)]
44+
public static string Raw(dynamic template, params string[] substitutions)
45+
{
46+
throw new System.NotImplementedException();
47+
}
48+
49+
}
50+
51+
[To(ToAttribute.FirstCharToLowerCase)]
52+
public partial class StringPrototype : FunctionPrototype
53+
{
54+
public StringPrototype() { }
55+
56+
public int At(int index)
57+
{
58+
throw new System.NotImplementedException();
59+
}
60+
public string CharAt(int pos)
61+
{
62+
throw new System.NotImplementedException();
63+
}
64+
public int CharCodeAt(int pos)
65+
{
66+
throw new System.NotImplementedException();
67+
}
68+
public int CodePointAt(int pos)
69+
{
70+
throw new System.NotImplementedException();
71+
}
72+
public string Concat(params string[] args )
73+
{
74+
throw new System.NotImplementedException();
75+
}
76+
public bool EndsWith(string searchString, int endPosition = 0 )
77+
{
78+
throw new System.NotImplementedException();
79+
}
80+
public bool Includes(string searchString, int position = 0 )
81+
{
82+
throw new System.NotImplementedException();
83+
}
84+
public bool IndexOf(string searchString, int position = 0 )
85+
{
86+
throw new System.NotImplementedException();
87+
}
88+
public bool LastIndexOf(string searchString, int position = 0 )
89+
{
90+
throw new System.NotImplementedException();
91+
}
92+
public int LocaleCompare(string that, dynamic reserved1 = null, dynamic reserved2 = null )
93+
{
94+
throw new System.NotImplementedException();
95+
}
96+
public dynamic[] Match(RegExp regexp)
97+
{
98+
throw new System.NotImplementedException();
99+
}
100+
public dynamic[] MatchAll(RegExp regexp )
101+
{
102+
throw new System.NotImplementedException();
103+
}
104+
public string Normalize(string form = "NFC")
105+
{
106+
throw new System.NotImplementedException();
107+
}
108+
public string PadEnd(int maxLength, string fillString = "" )
109+
{
110+
throw new System.NotImplementedException();
111+
}
112+
public string PadStart(int maxLength, string fillString = "")
113+
{
114+
throw new System.NotImplementedException();
115+
}
116+
public string Repeat(int count )
117+
{
118+
throw new System.NotImplementedException();
119+
}
120+
public string Replace(string searchValue, string replaceValue )
121+
{
122+
throw new System.NotImplementedException();
123+
}
124+
public string ReplaceAll(string searchValue, string replaceValue )
125+
{
126+
throw new System.NotImplementedException();
127+
}
128+
public int Search(Regex regexp )
129+
{
130+
throw new System.NotImplementedException();
131+
}
132+
public string Slice(int start,int end )
133+
{
134+
throw new System.NotImplementedException();
135+
}
136+
public string[] Split(string separator, int limit = 0)
137+
{
138+
throw new System.NotImplementedException();
139+
}
140+
public bool StartsWith(string searchString, int position = 0 )
141+
{
142+
throw new System.NotImplementedException();
143+
}
144+
public string Substring(int start,int end = 0)
145+
{
146+
throw new System.NotImplementedException();
147+
}
148+
public string ToLocaleLowerCase(dynamic reserved1 = null, dynamic reserved2 = null)
149+
{
150+
throw new System.NotImplementedException();
151+
}
152+
public string ToLocaleUpperCase(dynamic reserved1 = null, dynamic reserved2 = null)
153+
{
154+
throw new System.NotImplementedException();
155+
}
156+
public string ToLowerCase()
157+
{
158+
throw new System.NotImplementedException();
159+
}
160+
public string ToString()
161+
{
162+
throw new System.NotImplementedException();
163+
}
164+
public string ToUpperCase()
165+
{
166+
throw new System.NotImplementedException();
167+
}
168+
public string Trim()
169+
{
170+
throw new System.NotImplementedException();
171+
}
172+
public string TrimEnd()
173+
{
174+
throw new System.NotImplementedException();
175+
}
176+
public string TrimStart()
177+
{
178+
throw new System.NotImplementedException();
179+
}
180+
public String ValueOf()
181+
{
182+
throw new System.NotImplementedException();
183+
}
184+
}
185+
}

0 commit comments

Comments
 (0)