From b185a3d1a30e6d580456e6d78eaf07f0b06a13bb Mon Sep 17 00:00:00 2001 From: ik Date: Fri, 11 Dec 2015 16:41:42 -0800 Subject: [PATCH] All JS-interop methods return object (per discussion in sq/JSIL#925) --- Builtins.cs | 8 +-- Verbatim.cs | 164 ++++------------------------------------------------ 2 files changed, 14 insertions(+), 158 deletions(-) diff --git a/Builtins.cs b/Builtins.cs index 84ef586..9e656c9 100644 --- a/Builtins.cs +++ b/Builtins.cs @@ -11,7 +11,7 @@ public sealed class JSGlobal { /// Retrieves a name from the global namespace (note that this is the global namespace at the time that the JSIL runtime was loaded). /// /// The name to retrieve. This may be a literal, or a string-producing expression. - public dynamic this[string name] { + public object this[string name] { get { return null; } @@ -23,7 +23,7 @@ public sealed class JSLocal { /// Retrieves a name from the local namespace. /// /// The name to retrieve. This must be a string literal! - public dynamic this[string name] { + public object this[string name] { get { return null; } @@ -67,7 +67,7 @@ public static bool IsFalsy (dynamic value) { /// /// When running as javascript, this property evaluates to the current scope's this-reference. /// - public static dynamic This { + public static object This { get { return null; } @@ -89,7 +89,7 @@ public static class Services { /// When running as JavaScript this method returns a reference to the named runtime service. /// /// The name of the runtime service. - public static dynamic Get (string serviceName, bool throwIfMissing = true) { + public static object Get (string serviceName, bool throwIfMissing = true) { if (throwIfMissing) throw new NotImplementedException("Services.get is only available at runtime and you passed true for throwIfMissing."); else diff --git a/Verbatim.cs b/Verbatim.cs index 2238738..4da6d04 100644 --- a/Verbatim.cs +++ b/Verbatim.cs @@ -14,7 +14,7 @@ public static class Verbatim { /// When running as JavaScript, the passed-in script code replaces this method call. /// /// The script expression. - public static dynamic Expression (string javascript) { + public static object Expression (string javascript) { return null; } @@ -25,7 +25,7 @@ public static dynamic Expression (string javascript) { /// /// The script expression. /// The variables to insert into the expression. - public static dynamic Expression (string javascript, params object[] variables) { + public static object Expression (string javascript, params object[] variables) { return null; } @@ -36,7 +36,7 @@ public static dynamic Expression (string javascript, params object[] variables) /// /// The script expression. /// The variables to insert into '$0' placeholder in the expression. - public static dynamic Expression(string javascript, TArg0 arg0) + public static object Expression(string javascript, TArg0 arg0) { return null; } @@ -49,7 +49,7 @@ public static dynamic Expression(string javascript, TArg0 arg0) /// The script expression. /// The variables to insert into '$0' placeholder in the expression. /// The variables to insert into '$1' placeholder in the expression. - public static dynamic Expression(string javascript, TArg0 arg0, TArg1 arg1) + public static object Expression(string javascript, TArg0 arg0, TArg1 arg1) { return null; } @@ -63,7 +63,7 @@ public static dynamic Expression(string javascript, TArg0 arg0, TA /// The variables to insert into '$0' placeholder in the expression. /// The variables to insert into '$1' placeholder in the expression. /// The variables to insert into '$2' placeholder in the expression. - public static dynamic Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2) + public static object Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2) { return null; } @@ -78,7 +78,7 @@ public static dynamic Expression(string javascript, TArg0 a /// The variables to insert into '$1' placeholder in the expression. /// The variables to insert into '$2' placeholder in the expression. /// The variables to insert into '$3' placeholder in the expression. - public static dynamic Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3) + public static object Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3) { return null; } @@ -94,7 +94,7 @@ public static dynamic Expression(string javascript, /// The variables to insert into '$2' placeholder in the expression. /// The variables to insert into '$3' placeholder in the expression. /// The variables to insert into '$4' placeholder in the expression. - public static dynamic Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4) + public static object Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4) { return null; } @@ -111,7 +111,7 @@ public static dynamic Expression(string javas /// The variables to insert into '$3' placeholder in the expression. /// The variables to insert into '$4' placeholder in the expression. /// The variables to insert into '$5' placeholder in the expression. - public static dynamic Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5) + public static object Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5) { return null; } @@ -129,7 +129,7 @@ public static dynamic Expression(strin /// The variables to insert into '$4' placeholder in the expression. /// The variables to insert into '$5' placeholder in the expression. /// The variables to insert into '$6' placeholder in the expression. - public static dynamic Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6) + public static object Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6) { return null; } @@ -148,153 +148,9 @@ public static dynamic ExpressionThe variables to insert into '$5' placeholder in the expression. /// The variables to insert into '$6' placeholder in the expression. /// The variables to insert into '$7' placeholder in the expression. - public static dynamic Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7) + public static object Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7) { return null; } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// - /// The script expression. - public static T Expression (string javascript) { - return default(T); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into the expression. - public static T Expression (string javascript, params object[] variables) { - return default(T); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into '$0' placeholder in the expression. - public static TResult Expression(string javascript, TArg0 arg0) - { - return default(TResult); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into '$0' placeholder in the expression. - /// The variables to insert into '$1' placeholder in the expression. - public static TResult Expression(string javascript, TArg0 arg0, TArg1 arg1) - { - return default(TResult); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into '$0' placeholder in the expression. - /// The variables to insert into '$1' placeholder in the expression. - /// The variables to insert into '$2' placeholder in the expression. - public static TResult Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2) - { - return default(TResult); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into '$0' placeholder in the expression. - /// The variables to insert into '$1' placeholder in the expression. - /// The variables to insert into '$2' placeholder in the expression. - /// The variables to insert into '$3' placeholder in the expression. - public static TResult Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3) - { - return default(TResult); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into '$0' placeholder in the expression. - /// The variables to insert into '$1' placeholder in the expression. - /// The variables to insert into '$2' placeholder in the expression. - /// The variables to insert into '$3' placeholder in the expression. - /// The variables to insert into '$4' placeholder in the expression. - public static TResult Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4) - { - return default(TResult); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into '$0' placeholder in the expression. - /// The variables to insert into '$1' placeholder in the expression. - /// The variables to insert into '$2' placeholder in the expression. - /// The variables to insert into '$3' placeholder in the expression. - /// The variables to insert into '$4' placeholder in the expression. - /// The variables to insert into '$5' placeholder in the expression. - public static TResult Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5) - { - return default(TResult); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into '$0' placeholder in the expression. - /// The variables to insert into '$1' placeholder in the expression. - /// The variables to insert into '$2' placeholder in the expression. - /// The variables to insert into '$3' placeholder in the expression. - /// The variables to insert into '$4' placeholder in the expression. - /// The variables to insert into '$5' placeholder in the expression. - /// The variables to insert into '$6' placeholder in the expression. - public static TResult Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6) - { - return default(TResult); - } - - /// - /// When running as C#, this method does nothing and returns null. - /// When running as JavaScript, the passed-in script code replaces this method call. - /// Variables can be referenced by index. '$0' is the first variable. - /// - /// The script expression. - /// The variables to insert into '$0' placeholder in the expression. - /// The variables to insert into '$1' placeholder in the expression. - /// The variables to insert into '$2' placeholder in the expression. - /// The variables to insert into '$3' placeholder in the expression. - /// The variables to insert into '$4' placeholder in the expression. - /// The variables to insert into '$5' placeholder in the expression. - /// The variables to insert into '$6' placeholder in the expression. - /// The variables to insert into '$7' placeholder in the expression. - public static TResult Expression(string javascript, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7) - { - return default(TResult); - } } }