示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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());
        }
示例#4
0
        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());
        }
示例#5
0
 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]();"));
 }
示例#6
0
 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]();"));
 }
示例#7
0
 public static void GetInternalStackTrace(IMethod method, JsBlock code)
 {
     code.Add("".Return());
 }
示例#8
0
        public static void op_Inequality(IMethod method, JsBlock code)
        {
            var args = method.JsArgs();

            code.Add(args[0].Op(args[1], "!=").Return());
        }
示例#9
0
        public static void get_m_value(IMethod method, JsBlock code)
        {
            var arg = method.JsArgs()[0];

            code.Add(arg.Get(SpecialFields.BoxValue).Return());
        }
示例#10
0
        public static void ToString(IMethod method, JsBlock code)
        {
            var arg = method.JsArgs()[0];

            code.Add(arg.Get("toString").Call().Return());
        }
示例#11
0
 public static void get_IsFlashPlayer(JsBlock code)
 {
     code.Add(false.Return());
 }
示例#12
0
 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());
 }
示例#13
0
 public static void ToString(JsBlock code)
 {
     code.Add("String.fromCharCode".Id().Call("this".Id().Get(SpecialFields.BoxValue)).Return());
 }
示例#14
0
        public static void ReferenceEquals(IMethod method, JsBlock code)
        {
            var args = method.JsArgs();

            code.Add(new JsBinaryOperator(args[0], args[1], "===").Return());
        }
示例#15
0
 public static void MemberwiseClone(JsBlock code)
 {
     code.Add("$clone".Id().Call("this".Id()).Return());
 }
示例#16
0
        public static void InitializeArray(IMethod method, JsBlock code)
        {
            var args = method.JsArgs();

            code.Add("$initarr".Id().Call(args).AsStatement());
        }
示例#17
0
 public static void get_FullName(JsBlock code)
 {
     code.Add(new JsText("return this.ns ? this.ns + '.' + this.name : this.name;"));
 }
示例#18
0
 public static void WriteLine0(MethodContext context, JsBlock code)
 {
     code.Add("console.log".Id().Call(""));
 }
示例#19
0
 public static void CreateInstanceDefault(JsBlock code)
 {
     code.Add("this".Id().Get("$new").Call().Return());
 }
示例#20
0
        public static void Equals(IMethod method, JsBlock code)
        {
            var args = method.JsArgs();

            code.Add(args[0].Op(args[1], "==").Return());
        }
示例#21
0
        public static void Console_Write(IMethod method, JsBlock code)
        {
            var arg = method.JsArgs()[0];

            code.Add("console.log".Id().Call(arg));
        }
示例#22
0
        public static void NewArray(IMethod method, JsBlock code)
        {
            var args = method.JsArgs();

            code.Add("new Array".Id().Call(args).Return());
        }
示例#23
0
        public static void CopyArray(IMethod method, JsBlock code)
        {
            var arg = method.JsArgs()[0];

            code.Add(arg.Get("concat").Call().Return());
        }
示例#24
0
        public static void isNaN(IMethod method, JsBlock code)
        {
            var arg = method.JsArgs()[0];

            code.Add("isNaN".Id().Call(arg).Return());
        }
示例#25
0
        public static void set_m_value(IMethod method, JsBlock code)
        {
            var args = method.JsArgs();

            code.Add(args[0].Set(SpecialFields.BoxValue, args[1]));
        }
示例#26
0
        public static void op_Implicit(IMethod method, JsBlock code)
        {
            var args = method.JsArgs();

            code.Add(args[0].Return());
        }
示例#27
0
 public static void get_UseEOL(JsBlock code)
 {
     code.Add(false.Return());
 }
示例#28
0
 public static void ToString(JsBlock code)
 {
     code.Add("this".Id().Get(SpecialFields.BoxValue).Get("toString").Call().Return());
 }
示例#29
0
        public static void ToString(JsBlock code)
        {
            var value = "this".Id().Get(SpecialFields.BoxValue);

            code.Add(value.Ternary("True", "False").Return());
        }
示例#30
0
        public static void set_InternalMessage(IMethod method, JsBlock code)
        {
            var value = method.JsArgs()[0];

            code.Add("this.$message".Id().Set(value));
        }