Exemple #1
0
        private void CompileOp(IType type, UnaryOperator op)
        {
            // exclude natively supported types
            if (!HasOperators(type))
            {
                return;
            }

            var method = _operators.Find(op, type);

            if (method == null)
            {
                return;
            }

            if (method.Data != null)
            {
                return;
            }

            var jsMethod = CompileMethod(method);

            var func = new JsFunction(null);

            func.Body.Add(jsMethod.FullName.Id().Call("this".Id()).Return());

            ExtendPrototype(type, func, op.JsName());
        }