-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGlobalObject.cs
More file actions
149 lines (141 loc) · 4.68 KB
/
GlobalObject.cs
File metadata and controls
149 lines (141 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using CSharpToJavaScript.Utils;
using System;
namespace CSharpToJavaScript.APIs.JS.Ecma;
public partial class GlobalObject
{
/// <summary>
/// Translates this method into the "===" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality
/// </remarks>
/// <param name="left">x</param>
/// <param name="right">y</param>
/// <returns></returns>
[Binary("===")]
public static bool EqualsStrict(dynamic left, dynamic right)
{
return left == right;
}
/// <summary>
/// Translates this method into the "!==" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_inequality
/// </remarks>
/// <param name="left">x</param>
/// <param name="right">y</param>
/// <returns></returns>
[Binary("!==")]
public static bool InequalsStrict(dynamic left, dynamic right)
{
return left != right;
}
/// <summary>
/// Translates this method into the "delete" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
/// </remarks>
/// <param name="arg">object.property</param>
/// <returns>true for all cases except when the property is an own non-configurable property, in which case false is returned in non-strict mode.</returns>
[Unary("delete ")]
public static bool Delete(dynamic arg)
{
return true;
}
/// <summary>
/// Translates this method into the "void" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void
/// </remarks>
/// <param name="arg">expression</param>
/// <returns>Undefined</returns>
[Unary("void ")]
public static Undefined Void(dynamic arg)
{
return new Undefined();
}
/// <summary>
/// Translates this method into the "typeof" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
/// </remarks>
/// <param name="operand">An expression representing the object or primitive whose type is to be returned.</param>
/// <returns>string</returns>
[Unary("typeof ")]
public static string TypeOf(object operand)
{
return string.Empty;
}
/// <summary>
/// Translates this method into the "typeof" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
/// </remarks>
/// <param name="operand">An expression representing the object or primitive whose type is to be returned.</param>
/// <returns>string</returns>
[Unary("typeof ")]
public static string TypeOf(Func<dynamic> operand)
{
return string.Empty;
}
/// <summary>
/// Translates this method into the "typeof" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
/// </remarks>
/// <typeparam name="O">An expression representing the object or primitive whose type is to be returned.</typeparam>
/// <returns>string</returns>
[GenericUnary("typeof ")]
public static string TypeOf<O>()
{
return string.Empty;
}
/// <summary>
/// Translates this method into the "instanceof" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
/// </remarks>
/// <typeparam name="C">Constructor to test against.</typeparam>
/// <param name="obj">The object to test.</param>
/// <returns>bool</returns>
[GenericBinary(" instanceof ")]
public static bool InstanceOf<C>(dynamic obj)
{
return true;
}
/// <summary>
/// Translates this method into the "in" operator.
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in
/// </remarks>
/// <param name="prop">A string or symbol representing a property name (non-symbols will be coerced to strings). Can also be a private element identifier.</param>
/// <param name="obj">Object to check if it (or its prototype chain) contains the property with specified name (prop).</param>
/// <returns>bool</returns>
[Binary("in")]
public static bool In(dynamic prop, dynamic obj)
{
return true;
}
/// <summary>
/// Translates this method into the "," operator. (As a binary)
/// </summary>
/// <remarks>
/// See mdn: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_operator
/// </remarks>
/// <param name="expr1">First expression.</param>
/// <param name="expr2">Second expression.</param>
/// <returns>dynamic</returns>
[Binary(",")]
public static dynamic Comma(dynamic expr1, dynamic expr2)
{
return expr2;
}
}