示例#1
0
        public static void EmitYield(AbstractEmitterBlock block, IType returnType)
        {
            block.Write("var $yield = []");

            block.WriteSemiColon();
            block.WriteNewLine();
        }
示例#2
0
        public static void EmitYield(AbstractEmitterBlock block, IType returnType)
        {
            block.Write("var $yield = []");

            block.WriteSemiColon();
            block.WriteNewLine();
        }
示例#3
0
        public static void EmitYieldReturn(AbstractEmitterBlock block, IType returnType)
        {
            block.WriteReturn(true);

            if (returnType != null && returnType.Name == "IEnumerator")
            {
                block.Write("Bridge.Array.toEnumerator($yield)");
            }
            else
            {
                block.Write("Bridge.Array.toEnumerable($yield)");
            }

            block.WriteSemiColon();
            block.WriteNewLine();
        }
示例#4
0
        public static void EmitYieldReturn(AbstractEmitterBlock block, IType returnType)
        {
            block.WriteReturn(true);

            if (returnType != null && returnType.Name == "IEnumerator")
            {
                block.Write("Bridge.Array.toEnumerator($yield)");
            }
            else
            {
                block.Write("Bridge.Array.toEnumerable($yield)");
            }

            block.WriteSemiColon();
            block.WriteNewLine();
        }
示例#5
0
        public static void EmitYieldReturn(AbstractEmitterBlock block, IType returnType)
        {
            block.WriteReturn(true);

            if (returnType != null && returnType.Name == "IEnumerator")
            {
                if (returnType.TypeArguments.Count > 0)
                {
                    block.Write(JS.Types.SYSTEM_ARRAY + "." + JS.Funcs.TO_ENUMERATOR + "(" + JS.Vars.YIELD + ", " + BridgeTypes.ToJsName(returnType.TypeArguments.First(), block.Emitter) + ")");
                }
                else
                {
                    block.Write(JS.Types.SYSTEM_ARRAY + "." + JS.Funcs.TO_ENUMERATOR + "(" + JS.Vars.YIELD + ")");
                }
            }
            else
            {
                block.Write(JS.Types.SYSTEM_ARRAY + "." + JS.Funcs.TO_ENUMERABLE + "(" + JS.Vars.YIELD + ")");
            }

            block.WriteSemiColon();
            block.WriteNewLine();
        }