Skip to content
This repository was archived by the owner on Aug 24, 2022. It is now read-only.

Commit 9d584f0

Browse files
committed
JsAPI errors fixed, first test case added.
1 parent 7c20f6d commit 9d584f0

5 files changed

Lines changed: 29 additions & 16 deletions

File tree

JSIL.Libraries/Includes/Bootstrap/Dynamic/Classes/JSIL.JSObjectHelper.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,6 @@
144144
JSIL.MakeStaticClass("JSIL.JsObjectHelpers", true, [], function ($ib) {
145145
$ = $ib;
146146

147-
$.Method({ Static: true, Public: true }, "Adapt",
148-
new JSIL.MethodSignature("!!0", [$jsilcore.TypeRef("JSIL.JsObject")], ["T"]),
149-
JsObjectHelpers_Adapt$b1
150-
)
151-
.Attribute($jsilcore.TypeRef("System.Runtime.CompilerServices.ExtensionAttribute"));
152-
153147
$.Method({ Static: true, Public: true }, "As",
154148
new JSIL.MethodSignature("!!0", [$jsilcore.TypeRef("JSIL.JsObject")], ["T"]),
155149
JsObjectHelpers_As$b1
@@ -163,14 +157,14 @@
163157
.Attribute($jsilcore.TypeRef("System.Runtime.CompilerServices.ExtensionAttribute"));
164158

165159
$.Method({ Static: true, Public: true }, "Call",
166-
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String]),
160+
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [$jsilcore.TypeRef("JSIL.JsObject"), $.String]),
167161
JsObjectHelpers_Call
168162
)
169163
.Attribute($jsilcore.TypeRef("System.Runtime.CompilerServices.ExtensionAttribute"));
170164

171165
$.Method({ Static: true, Public: true }, "Call",
172166
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [
173-
$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String,
167+
$jsilcore.TypeRef("JSIL.JsObject"), $.String,
174168
"!!0"
175169
], ["TArg1"]),
176170
JsObjectHelpers_Call$b1
@@ -179,7 +173,7 @@
179173

180174
$.Method({ Static: true, Public: true }, "Call",
181175
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [
182-
$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String,
176+
$jsilcore.TypeRef("JSIL.JsObject"), $.String,
183177
"!!0", "!!1"
184178
], ["TArg1", "TArg2"]),
185179
JsObjectHelpers_Call$b2
@@ -188,7 +182,7 @@
188182

189183
$.Method({ Static: true, Public: true }, "Call",
190184
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [
191-
$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String,
185+
$jsilcore.TypeRef("JSIL.JsObject"), $.String,
192186
"!!0", "!!1",
193187
"!!2"
194188
], ["TArg1", "TArg2", "TArg3"]),
@@ -198,7 +192,7 @@
198192

199193
$.Method({ Static: true, Public: true }, "Call",
200194
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [
201-
$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String,
195+
$jsilcore.TypeRef("JSIL.JsObject"), $.String,
202196
"!!0", "!!1",
203197
"!!2", "!!3"
204198
], ["TArg1", "TArg2", "TArg3", "TArg4"]),
@@ -208,7 +202,7 @@
208202

209203
$.Method({ Static: true, Public: true }, "Call",
210204
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [
211-
$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String,
205+
$jsilcore.TypeRef("JSIL.JsObject"), $.String,
212206
"!!0", "!!1",
213207
"!!2", "!!3",
214208
"!!4"
@@ -222,7 +216,7 @@
222216

223217
$.Method({ Static: true, Public: true }, "Call",
224218
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [
225-
$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String,
219+
$jsilcore.TypeRef("JSIL.JsObject"), $.String,
226220
"!!0", "!!1",
227221
"!!2", "!!3",
228222
"!!4", "!!5"
@@ -236,7 +230,7 @@
236230

237231
$.Method({ Static: true, Public: true }, "Call",
238232
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [
239-
$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String,
233+
$jsilcore.TypeRef("JSIL.JsObject"), $.String,
240234
"!!0", "!!1",
241235
"!!2", "!!3",
242236
"!!4", "!!5",
@@ -251,7 +245,7 @@
251245

252246
$.Method({ Static: true, Public: true }, "Call",
253247
new JSIL.MethodSignature($jsilcore.TypeRef("JSIL.JsObject"), [
254-
$jsilcore.TypeRef("JSIL.JsObject+JsFunction"), $.String,
248+
$jsilcore.TypeRef("JSIL.JsObject"), $.String,
255249
"!!0", "!!1",
256250
"!!2", "!!3",
257251
"!!4", "!!5",

Meta

Submodule Meta updated 1 file

Tests/ComparisonTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ protected IEnumerable<TestCaseData> DynamicsSource () {
129129
@"TestCases\DynamicSetIndex.cs",
130130
@"TestCases\DynamicStaticOverloadedMethods.cs",
131131
@"TestCases\DynamicUnaryOperators.cs",
132+
@"TestCases\DynamicJsAPI.cs",
132133
}, null, new AssemblyCache()
133134
);
134135
}

Tests/TestCases/DynamicJsAPI.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using JSIL;
3+
4+
public static class Program {
5+
public static void Main (string[] args) {
6+
if (Builtins.IsJavascript)
7+
{
8+
dynamic a = 5;
9+
var b = Verbatim.Expression("{GetValue: function(value) { return value + 10}}");
10+
Console.WriteLine(JsObjectHelpers.Call<object>(b, "GetValue", a));
11+
}
12+
else
13+
{
14+
Console.WriteLine(15);
15+
}
16+
}
17+
}

Tests/Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292
<None Include="SpecialTestCases\RenameInterface.cs" />
293293
<None Include="ReflectionTestCases\FailsOnMono\GetParentDefinition.cs" />
294294
<None Include="ReflectionTestCases\FailsOnMono\GetBaseDefinition.cs" />
295+
<None Include="TestCases\DynamicJsAPI.cs" />
295296
<Compile Include="TypeInformationTests.cs" />
296297
<None Include="TestCases\LongArithmetic.cs" />
297298
<None Include="InterfaceTestCases\NestedInterfaces.cs" />

0 commit comments

Comments
 (0)