public static void WriteLine_Boolean(IMethod method, JsBlock code) { var arg = method.JsArgs()[0]; var val = new JsText(string.Format("{0} ? 'True' : 'False'", arg.Value)); code.Add("console.log".Id().Call(val)); }
public static void WriteLine_Object(MethodContext context, JsBlock code) { var objectType = context.ResolveSystemType(SystemTypeCode.Object); var toString = objectType.Methods.Find("ToString").First(); context.Host.CompileCallMethod(toString); var arg = context.Method.JsArgs()[0]; var val = "$tostr".Id().Call(arg); code.Add("console.log".Id().Call(val)); }
private static void GetBytesImpl(MethodContext context, JsBlock code, string encodeFunc) { var arrayType = context.ResolveSystemType(SystemTypeCode.Array); var elementType = context.ResolveSystemType(SystemTypeCode.UInt8); context.Host.CompileClass(arrayType); context.Host.CompileClass(elementType); context.Host.RegisterArrayType(elementType); var arg = context.Method.JsArgs()[0]; code.Add("$toSystemByteArray".Id().Call(encodeFunc.Id().Call(arg)).Return()); }
public static void Ctor(MethodContext context, JsBlock code) { var method = context.Method; var args = method.JsArgs(); var build = method.DeclaringType.Methods.Find("Build", method.Parameters.Count); if (build == null) { throw new InvalidOperationException("Unable to find String.Build."); } context.Host.CompileMethod(build); code.Add(build.JsFullName(method.DeclaringType).Id().Call(args).Return()); }
public static void get_UnderlyingSystemType(JsBlock code) { code.Add(new JsText("if (this.$valueType === undefined) return null;")); code.Add(new JsText("return $types[this.$valueType]();")); }
public static void get_ElementType(JsBlock code) { code.Add(new JsText("if (this.$elemType === undefined) return null;")); code.Add(new JsText("return $types[this.$elemType]();")); }
public static void GetInternalStackTrace(IMethod method, JsBlock code) { code.Add("".Return()); }
public static void op_Inequality(IMethod method, JsBlock code) { var args = method.JsArgs(); code.Add(args[0].Op(args[1], "!=").Return()); }
public static void get_m_value(IMethod method, JsBlock code) { var arg = method.JsArgs()[0]; code.Add(arg.Get(SpecialFields.BoxValue).Return()); }
public static void ToString(IMethod method, JsBlock code) { var arg = method.JsArgs()[0]; code.Add(arg.Get("toString").Call().Return()); }
public static void get_IsFlashPlayer(JsBlock code) { code.Add(false.Return()); }
public static void get_Length(JsBlock code) { //TODO: use field instead of "m_value" const code.Add("this".Id().Get("m_value").Get("length").Return()); }
public static void ToString(JsBlock code) { code.Add("String.fromCharCode".Id().Call("this".Id().Get(SpecialFields.BoxValue)).Return()); }
public static void ReferenceEquals(IMethod method, JsBlock code) { var args = method.JsArgs(); code.Add(new JsBinaryOperator(args[0], args[1], "===").Return()); }
public static void MemberwiseClone(JsBlock code) { code.Add("$clone".Id().Call("this".Id()).Return()); }
public static void InitializeArray(IMethod method, JsBlock code) { var args = method.JsArgs(); code.Add("$initarr".Id().Call(args).AsStatement()); }
public static void get_FullName(JsBlock code) { code.Add(new JsText("return this.ns ? this.ns + '.' + this.name : this.name;")); }
public static void WriteLine0(MethodContext context, JsBlock code) { code.Add("console.log".Id().Call("")); }
public static void CreateInstanceDefault(JsBlock code) { code.Add("this".Id().Get("$new").Call().Return()); }
public static void Equals(IMethod method, JsBlock code) { var args = method.JsArgs(); code.Add(args[0].Op(args[1], "==").Return()); }
public static void Console_Write(IMethod method, JsBlock code) { var arg = method.JsArgs()[0]; code.Add("console.log".Id().Call(arg)); }
public static void NewArray(IMethod method, JsBlock code) { var args = method.JsArgs(); code.Add("new Array".Id().Call(args).Return()); }
public static void CopyArray(IMethod method, JsBlock code) { var arg = method.JsArgs()[0]; code.Add(arg.Get("concat").Call().Return()); }
public static void isNaN(IMethod method, JsBlock code) { var arg = method.JsArgs()[0]; code.Add("isNaN".Id().Call(arg).Return()); }
public static void set_m_value(IMethod method, JsBlock code) { var args = method.JsArgs(); code.Add(args[0].Set(SpecialFields.BoxValue, args[1])); }
public static void op_Implicit(IMethod method, JsBlock code) { var args = method.JsArgs(); code.Add(args[0].Return()); }
public static void get_UseEOL(JsBlock code) { code.Add(false.Return()); }
public static void ToString(JsBlock code) { code.Add("this".Id().Get(SpecialFields.BoxValue).Get("toString").Call().Return()); }
public static void ToString(JsBlock code) { var value = "this".Id().Get(SpecialFields.BoxValue); code.Add(value.Ternary("True", "False").Return()); }
public static void set_InternalMessage(IMethod method, JsBlock code) { var value = method.JsArgs()[0]; code.Add("this.$message".Id().Set(value)); }