Best JavaScript code snippet using playwright-internal
inline.js
Source:inline.js  
...166        popLocals = modifyState(state.popLocals),167        child = (function(edge) {168            var __args = arguments,169                ops = [].slice.call(__args, 1);170            return seq(moveChild(edge), seqa(ops), up);171        }),172        checkTop = extract((function(x0) {173            return _check(x0);174        })),175        visitChild = (function(edge) {176            return child(edge, checkTop);177        }),178        getBindingType = (function(id, value) {179            var uid;180            return (isPrimitive(value) ? M.of([SIMPLE, value]) : (isLambda(value) ? M.of([SIMPLE,181                markExpansion(id, 0, value)182            ]) : (isIdentifier(value) ? ((uid = getUid(value)), (uid ? getState.map(state.getBinding183                    .bind(null, uid)) : pass))184                .chain((function(binding) {185                    return ((binding && binding.immutable) ? M.of([SIMPLE, ((binding.simple &&186                        binding.value) ? mergeExpansions(binding.value,187                        value) : value)]) : M.of([COMPLEX, value]));188                })) : M.of([COMPLEX, value]))));189        }),190        addBindingForNode = (function(id, value) {191            return getBindingType(id, value)192                .chain((function(__o5) {193                    var kind = __o5[0],194                        value0 = __o5[1],195                        uid = getUid(id);196                    return modifyState(state.addBinding.bind(null, uid, value0, kind));197                }));198        }),199        addWorkingForNode = (function(id, value) {200            return getBindingType(id, value)201                .chain((function(__o5) {202                    var kind = __o5[0],203                        value0 = __o5[1],204                        uid = getUid(id);205                    return modifyState(state.addWorking.bind(null, uid, value0, kind));206                }));207        }),208        setWorkingForNode = (function(id, value) {209            var uid = getUid(id);210            return (uid ? getState.map(state.getBinding.bind(null, uid)) : pass)211                .chain((function(binding) {212                    return (binding ? addWorkingForNode(id, value) : modifyState(state.invalidateWorking213                        .bind(null, uid)));214                }));215        }),216        peepholes = ({}),217        addRewrite = (function(type0, f) {218            if (Array.isArray(type0)) type0.forEach((function(type1) {219                return addRewrite(type1, f);220            }));221            else {222                (peepholes[type0] = f);223            }224        });225    addRewrite("UnaryOperator", seq(extract((function(__o5) {226        var name = __o5["name"];227        return seq(modifyState(state.addGlobal.bind(null, name)), set(builtins[name]));228    })), checkTop));229    addRewrite("BinaryOperator", seq(extract((function(__o5) {230        var name = __o5["name"];231        return seq(modifyState(state.addGlobal.bind(null, name)), set(builtins[name]));232    })), checkTop));233    addRewrite("TernaryOperator", seq(modifyState(state.addGlobal.bind(null, "?")), set(builtins["?"]),234        checkTop));235    addRewrite("OperatorExpression", seq(((consequent = unique((function(uid) {236        return modify((function(__o5) {237            var operator = __o5["operator"];238            return builtin.member(operator, uid);239        }));240    }))), (alternate = seq(((__args = ["operator", checkTop]), (ops = [__args[1]]), seq(moveChild(241        "operator"), seqa(ops), up)), ((consequent0 = modify((function(__o5) {242        var operator = __o5["operator"];243        return ast_expression.CallExpression.create(null, builtins["_"], [244            operator245        ]);246    }))), (alternate0 = modify((function(x0) {247        return x0.operator;248    }))), extract((function(node) {249        return (node.flipped ? consequent0 : (alternate0 || pass));250    }))))), extract((function(node) {251        var operator;252        return (((operator = node["operator"]), ((type(operator) === "MemberExpression") ||253            (type(operator) === "CallExpression"))) ? consequent : (alternate || pass));254    }))), checkTop));255    addRewrite("Program", seq(((__args0 = ["body", checkTop]), (ops0 = [__args0[1]]), seq(moveChild("body"),256        seqa(ops0), up)), ((consequent1 = globals((function(globals0) {257        return modify((function(node) {258            return modifyNode(node, ({259                "body": concat(createGlobalDeclarations(globals0), node260                    .body)261            }));262        }));263    }))), extract((function(node) {264        var z, y0;265        return (((z = node.body), (y0 = type(z)), ("Package" !== y0)) ? consequent1 : (266            undefined || pass));267    })))));268    addRewrite("Package", seq(((__args1 = ["body", checkTop]), (ops1 = [__args1[1]]), seq(moveChild("body"),269        seqa(ops1), up)), globals((function(globals0) {270        return modify((function(node) {271            var body = node["body"];272            return modifyNode(node, ({273                "body": ((type(body) === "WithStatement") ? modifyNode(body, ({274                    "body": ast_statement.BlockStatement.create(275                        null, concat(createGlobalDeclarations(276                            globals0), body.body.body))277                })) : concat(createGlobalDeclarations(globals0), body))278            }));279        }));280    }))));281    addRewrite("SwitchCase", seq(((__args2 = ["test", checkTop]), (ops2 = [__args2[1]]), seq(moveChild("test"),282        seqa(ops2), up)), ((__args3 = ["consequent", checkTop]), (ops3 = [__args3[1]]), seq(moveChild(283        "consequent"), seqa(ops3), up))));284    addRewrite("CatchClause", seq(((__args4 = ["param", checkTop]), (ops4 = [__args4[1]]), seq(moveChild(285        "param"), seqa(ops4), up)), ((__args5 = ["body", checkTop]), (ops5 = [__args5[1]]), seq(286        moveChild("body"), seqa(ops5), up))));287    addRewrite("VariableDeclaration", ((__args6 = ["declarations", checkTop]), (ops6 = [__args6[1]]), seq(288        moveChild("declarations"), seqa(ops6), up)));289    addRewrite("VariableDeclarator", seq(((__args7 = ["init", checkTop]), (ops7 = [__args7[1]]), seq(moveChild(290        "init"), seqa(ops7), up)), ((consequent2 = extract((function(__o5) {291        var immutable = __o5["immutable"],292            id = __o5["id"],293            init = __o5["init"],294            uid;295        return (immutable ? seq(addBindingForNode(id, init), ((uid = getUid(id)), (uid ?296                getState.map(state.getBinding.bind(null, uid)) : pass)297            .chain((function(binding) {298                return ((((binding && binding.simple) && (!isExpansion(299                    binding.value))) && (isPrimitive(binding.value) ||300                    (binding.immutable && isIdentifier(binding.value))301                )) ? set([]) : pass);302            })))) : addWorkingForNode(id, init));303    }))), (alternate1 = extract((function(__o5) {304        var id = __o5["id"];305        return addWorkingForNode(id, builtins.undefined);306    }))), extract((function(node) {307        return (node.init ? consequent2 : (alternate1 || pass));308    })))));309    addRewrite("Binding", seq(((__args8 = ["value", checkTop]), (ops8 = [__args8[1]]), seq(moveChild("value"),310        seqa(ops8), up)), ((consequent3 = extract((function(__o5) {311        var pattern = __o5["pattern"],312            value = __o5["value"],313            id, uid;314        return seq(addBindingForNode(pattern.id, value), ((id = pattern.id), (uid =315                getUid(id)), (uid ? getState.map(state.getBinding.bind(null, uid)) :316                pass)317            .chain((function(binding) {318                return ((((binding && binding.simple) && (!isExpansion(319                    binding.value))) && (isPrimitive(binding.value) ||320                    (binding.immutable && isIdentifier(binding.value))321                )) ? set([]) : pass);322            }))));323    }))), extract((function(node) {324        var pattern;325        return (((pattern = node["pattern"]), ((type(pattern) === "IdentifierPattern") &&326            getUid(pattern.id))) ? consequent3 : (undefined || pass));327    }))), ((consequent4 = extract((function(node) {328        var bindings = flatten(concat(node.value.bindings, ast_declaration.Binding.create(329            null, node.pattern, node.value.body)));330        return seq(set(bindings), visitChild((bindings.length - 1)));331    }))), extract((function(node) {332        return (((type(node) === "Binding") && (type(node.value) === "LetExpression")) ?333            consequent4 : (undefined || pass));334    })))));335    addRewrite("BlockStatement", ((__args9 = ["body", checkTop]), (ops9 = [__args9[1]]), seq(moveChild("body"),336        seqa(ops9), up)));337    addRewrite("ExpressionStatement", ((__args10 = ["expression", checkTop]), (ops10 = [__args10[1]]), seq(338        moveChild("expression"), seqa(ops10), up)));339    addRewrite("WithStatement", seq(((__args11 = ["bindings", checkTop]), (ops11 = [__args11[1]]), seq(340        moveChild("bindings"), seqa(ops11), up)), ((__args12 = ["body", checkTop]), (ops12 = [__args12[341        1]]), seq(moveChild("body"), seqa(ops12), up))));342    addRewrite("SwitchStatement", seq(((__args13 = ["discriminant", checkTop]), (ops13 = [__args13[1]]), seq(343        moveChild("discriminant"), seqa(ops13), up)), ((__args14 = ["cases", checkTop]), (ops14 = [344        __args14[1]345    ]), seq(moveChild("cases"), seqa(ops14), up))));346    addRewrite(["ReturnStatement", "ThrowStatement"], ((__args15 = ["argument", checkTop]), (ops15 = [__args15[347        1]]), seq(moveChild("argument"), seqa(ops15), up)));348    addRewrite("TryStatement", seq(((__args16 = ["block", checkTop]), (ops16 = [__args16[1]]), seq(moveChild(349        "block"), seqa(ops16), up)), ((__args17 = ["handler", checkTop]), (ops17 = [__args17[1]]), seq(350        moveChild("handler"), seqa(ops17), up)), ((__args18 = ["finalizer", checkTop]), (ops18 = [351        __args18[1]352    ]), seq(moveChild("finalizer"), seqa(ops18), up))));353    addRewrite("WhileStatement", ((body = [((__args19 = ["test", checkTop]), (ops19 = [__args19[1]]), seq(354        moveChild("test"), seqa(ops19), up)), ((__args20 = ["body", checkTop]), (ops20 = [355        __args20[1]356    ]), seq(moveChild("body"), seqa(ops20), up))]), seq(push, seqa(body), pop)));357    addRewrite("DoWhileStatement", ((body0 = [((__args21 = ["body", checkTop]), (ops21 = [__args21[1]]), seq(358        moveChild("body"), seqa(ops21), up)), ((__args22 = ["test", checkTop]), (ops22 = [359        __args22[1]360    ]), seq(moveChild("test"), seqa(ops22), up))]), seq(push, seqa(body0), pop)));361    addRewrite("ForStatement", seq(((__args23 = ["init", checkTop]), (ops23 = [__args23[1]]), seq(moveChild(362        "init"), seqa(ops23), up)), ((body1 = [((__args24 = ["test", checkTop]), (ops24 = [__args24[1]]),363        seq(moveChild("test"), seqa(ops24), up)), ((__args25 = ["update", checkTop]), (364        ops25 = [__args25[1]]), seq(moveChild("update"), seqa(ops25), up)), ((__args26 = [365        "body", checkTop366    ]), (ops26 = [__args26[1]]), seq(moveChild("body"), seqa(ops26), up))]), seq(push, seqa(body1),367        pop))));368    addRewrite("FunctionExpression", ((body2 = [pushLocals, ((__args27 = ["id", checkTop]), (ops27 = [__args27[369        1]]), seq(moveChild("id"), seqa(ops27), up)), ((__args28 = ["params", checkTop]), (370        ops28 = [__args28[1]]), seq(moveChild("params"), seqa(ops28), up)), ((__args29 = [371        "body", checkTop372    ]), (ops29 = [__args29[1]]), seq(moveChild("body"), seqa(ops29), up)), getLocals.chain((373        function(locals) {374            return modify((function(node) {375                return ast.setLocals(concat(ast.getLocals(node), locals), node);376            }));377        })), popLocals]), seq(push, seqa(body2), pop)));378    addRewrite("UnaryExpression", ((arithmetic = ({379        "!": __lnot,380        "~": __bnot,381        "typeof": __typeof,382        "++": __plus,383        "--": __minus384    })), seq(((__args30 = ["argument", checkTop]), (ops30 = [__args30[1]]), seq(moveChild("argument"),385        seqa(ops30), up)), ((consequent5 = modify((function(__o5) {386        var loc = __o5["loc"],387            operator = __o5["operator"],388            argument = __o5["argument"],389            value = arithmetic[operator](argument.value);390        return ast_value.Literal.create(loc, (typeof value), value);391    }))), extract((function(node) {392        var operator, argument;393        return (((operator = node["operator"]), (argument = node["argument"]), (394            arithmetic[operator] && isPrimitive(argument))) ? consequent5 : (395            undefined || pass));396    }))))));397    addRewrite("BinaryExpression", ((arithmetic0 = ({398        "+": __add,399        "-": __sub,400        "*": __mul,401        "/": __div,402        "%": __mod,403        "<<": __blas,404        ">>": __bras,405        ">>>": __brls,406        "==": __eq,407        "!=": __neq,408        "===": __seq,409        "!==": __sneq,410        "<": __lt,411        ">": __gt,412        "<=": __lte,413        ">=": __gte,414        "|": __bor,415        "&": __band,416        "^": __bxor,417        "&&": __and,418        "||": __or419    })), seq(((__args31 = ["left", checkTop]), (ops31 = [__args31[1]]), seq(moveChild("left"), seqa(420        ops31), up)), ((__args32 = ["right", checkTop]), (ops32 = [__args32[1]]), seq(moveChild(421        "right"), seqa(ops32), up)), ((consequent6 = modify((function(__o5) {422        var operator = __o5["operator"],423            left = __o5["left"],424            right0 = __o5["right"],425            value = arithmetic0[operator](left.value, right0.value);426        return ast_value.Literal.create(null, (typeof value), value);427    }))), extract((function(node) {428        var operator, left, right0;429        return (((operator = node["operator"]), (left = node["left"]), (right0 = node[430            "right"]), ((arithmetic0[operator] && isPrimitive(left)) &&431            isPrimitive(right0))) ? consequent6 : (undefined || pass));432    }))), ((consequent7 = extract((function(__o5) {433        var operator = __o5["operator"],434            left = __o5["left"],435            right0 = __o5["right"];436        return seq(modifyState(state.addGlobal.bind(null, operator)), set(437            ast_expression.CallExpression.create(null, builtins[operator], [438                left, right0439            ])), checkTop);440    }))), extract((function(node) {441        var operator;442        return (((operator = node["operator"]), (((((((((operator === "\\>") || (443            operator === "\\>>")) || (operator ===444            "<\\")) || (operator === "<<\\")) || (operator ===445            "??")) || (operator === "<|")) || (operator === "|>")) || (446            operator === "<<|")) || (operator === "|>>"))) ? consequent7 : (447            undefined || pass));448    }))))));449    addRewrite("AssignmentExpression", seq(((__args33 = ["right", checkTop]), (ops33 = [__args33[1]]), seq(450        moveChild("right"), seqa(ops33), up)), ((consequent8 = extract((function(__o5) {451        var immutable = __o5["immutable"],452            left = __o5["left"],453            right0 = __o5["right"];454        return (immutable ? addBindingForNode(left, right0) : setWorkingForNode(left,455            right0));456    }))), extract((function(node) {457        var z, y0;458        return (((z = node.left), (y0 = type(z)), ("Identifier" === y0)) ? consequent8 : (459            undefined || pass));460    })))));461    addRewrite("DeleteExpression", ((__args34 = ["argument", checkTop]), (ops34 = [__args34[1]]), seq(moveChild(462        "argument"), seqa(ops34), up)));463    addRewrite(["ConditionalExpression", "IfStatement"], seq(((__args35 = ["test", checkTop]), (ops35 = [464        __args35[1]465    ]), seq(moveChild("test"), seqa(ops35), up)), ((consequent9 = extract((function(__o5) {466        var test = __o5["test"],467            consequent10 = __o5["consequent"],468            alternate2 = __o5["alternate"];469        return seq(set((isTruthy(test) ? consequent10 : alternate2)), checkTop);470    }))), (alternate2 = seq(((__args36 = ["consequent", checkTop]), (ops36 = [__args36[1]]), seq(471        moveChild("consequent"), seqa(ops36), up)), ((__args37 = ["alternate", checkTop]), (472        ops37 = [__args37[1]]), seq(moveChild("alternate"), seqa(ops37), up)))), extract((function(473        node) {474        return (isPrimitive(node.test) ? consequent9 : (alternate2 || pass));475    })))));476    addRewrite("CheckedMemberExpression", seq(((__args38 = ["object", checkTop]), (ops38 = [__args38[1]]), seq(477        moveChild("object"), seqa(ops38), up)), ((__args39 = ["property", checkTop]), (ops39 = [478        __args39[1]479    ]), (consequent10 = seq(moveChild("property"), seqa(ops39), up)), extract((function(node) {480        return (node.computed ? consequent10 : (undefined || pass));481    }))), extract((function(node) {482        var uid;483        return ((uid = getUid(node.id)), (uid ? getState.map(state.getBinding.bind(null, uid)) :484            pass))485            .chain((function(binding) {486                return (((binding && binding.value) && binding.simple) ? set(modifyNode(487                    node, ({488                        id: binding.value489                    }))) : pass);490            }));491    }))));492    addRewrite("MemberExpression", seq(((__args40 = ["object", checkTop]), (ops40 = [__args40[1]]), seq(493        moveChild("object"), seqa(ops40), up)), ((__args41 = ["property", checkTop]), (ops41 = [494        __args41[1]495    ]), (consequent11 = seq(moveChild("property"), seqa(ops41), up)), extract((function(node) {496        return (node.computed ? consequent11 : (undefined || pass));497    }))), ((consequent12 = modify((function(__o5) {498        var object = __o5["object"],499            property = __o5["property"];500        return (object.elements[property.value] || builtins.undefined);501    }))), extract((function(node) {502        return (((node.computed && (type(node.object) === "ArrayExpression")) &&503            isNumberish(node.property)) ? consequent12 : (undefined || pass));504    }))), ((consequent13 = modify((function(__o5) {505        var object = __o5["object"];506        return ast_value.Literal.create(null, "number", object.elements.length);507    }))), extract((function(node) {508        return ((((type(node) === "MemberExpression") && (type(node.object) ===509            "ArrayExpression")) && (((!node.computed) && (node.property.name ===510            "length")) || ((node.computed && (type(node.property) === "Literal")) &&511            (node.property.value === "length")))) ? consequent13 : (undefined || pass));512    }))), ((consequent14 = modify((function(node) {513        var str = node.object.value,514            idx = node.property.value;515        return ((idx < str.length) ? ast_value.Literal.create(null, "string", str[idx]) :516            builtins.undefined);517    }))), extract((function(node) {518        return (((node.computed && isString(node.object)) && isNumberish(node.property)) ?519            consequent14 : (undefined || pass));520    })))));521    addRewrite(["NewExpression", "ApplyExpression"], seq(((__args42 = ["callee", checkTop]), (ops42 = [__args42[522        1]]), seq(moveChild("callee"), seqa(ops42), up)), ((__args43 = ["args", checkTop]), (ops43 = [523        __args43[1]524    ]), seq(moveChild("args"), seqa(ops43), up))));525    addRewrite("CallExpression", seq(((__args44 = ["callee", checkTop]), (ops44 = [__args44[1]]), seq(moveChild(526        "callee"), seqa(ops44), up)), ((__args45 = ["args", checkTop]), (ops45 = [__args45[1]]), seq(527        moveChild("args"), seqa(ops45), up)), ((exp = M.node.map((function(x0) {528        return x0.callee;529    }))), (consequent15 = exp.chain((function(z) {530        var newCallee = expandNode(z);531        return modify((function(node) {532            var callee = node["callee"];533            return incCount(getUid(callee), (getExpansionDepth(callee) || 1),534                getExpansionValue(callee), modifyNode(node, ({535                    callee: newCallee536                })));537        }));538    }))), extract((function(node) {539        return (isExpansion(node.callee) ? consequent15 : (undefined || pass));540    }))), ((consequent16 = seq(unique((function(uid) {541        return extract((function(node) {542            var __o5 = expandCallee(uid, node.callee, node.args),543                locals = __o5[0],544                node0 = __o5[1];545            return seq(modifyState(state.addLocals.bind(null, locals)), set(546                node0));547        }));548    })), checkTop)), extract((function(node) {549        var callee;550        return (((callee = node["callee"]), (isLambda(callee) || ((type(callee) ===551            "LetExpression") && isLambda(callee.body)))) ? consequent16 : (undefined ||552            pass));553    })))));554    addRewrite("CurryExpression", seq(((__args46 = ["base", checkTop]), (ops46 = [__args46[1]]), seq(moveChild(555        "base"), seqa(ops46), up)), ((__args47 = ["args", checkTop]), (ops47 = [__args47[1]]), seq(556        moveChild("args"), seqa(ops47), up)), ((exp0 = M.node.map((function(x0) {557        return x0.base;558    }))), (consequent17 = exp0.chain((function(z) {559        var expandedBase = expandNode(z);560        return modify((function(node) {561            var base = node["base"];562            return incCount(getUid(base), getExpansion(base), getExpansionValue(563                base), modifyNode(node, ({564                "base": expandedBase565            })));566        }));567    }))), extract((function(node) {568        return (isExpansion(node.base) ? consequent17 : (undefined || pass));569    }))), ((consequent18 = seq(unique((function(uid) {570        return modify((function(node) {571            return expandCurry(uid, node.base, node.args);572        }));573    })), checkTop)), extract((function(node) {574        var base;575        return (((base = node["base"]), (isLambdaWithoutArgs(base) || ((type(base) ===576            "LetExpression") && isLambdaWithoutArgs(base.body)))) ? consequent18 : (577            undefined || pass));578    })))));579    addRewrite("LetExpression", seq(((__args48 = ["bindings", checkTop]), (ops48 = [__args48[1]]), seq(580        moveChild("bindings"), seqa(ops48), up)), ((__args49 = ["body", checkTop]), (ops49 = [__args49[581        1]]), seq(moveChild("body"), seqa(ops49), up)), ((consequent19 = modify((function(__o5) {582        var loc = __o5["loc"],583            bindings = __o5["bindings"],584            body3 = __o5["body"];585        return ast_expression.LetExpression.create(loc, concat(bindings, body3.bindings),586            body3.body);587    }))), extract((function(node) {588        var z, y0;589        return (((z = node.body), (y0 = type(z)), ("LetExpression" === y0)) ? consequent19 :590            (undefined || pass));591    }))), modify((function(node) {592        return modifyNode(node, ({593            bindings: flattenr(node.bindings)594        }));595    })), ((consequent20 = modify((function(x0) {596        return x0.body;597    }))), extract((function(node) {598        var x0;599        return (((x0 = node.bindings.length), (!x0)) ? consequent20 : (undefined || pass));600    })))));601    addRewrite("SliceUnpack", seq(((__args50 = ["target", checkTop]), (ops50 = [__args50[1]]), seq(moveChild(602        "target"), seqa(ops50), up)), ((consequent21 = extract((function(node) {603        var uid;604        return ((uid = getUid(node.target)), (uid ? getState.map(state.getBinding.bind(605            null, uid)) : pass))606            .chain((function(binding) {607                return (((binding && binding.value) && (type(binding.value) ===608                    "ArrayExpression")) ? modify((function(__o5) {609                    var target = __o5["target"],610                        from = __o5["from"],611                        to = __o5["to"];612                    return ast_expression.ArrayExpression.create(613                        null, map((function(i) {614                            return ast_expression.MemberExpression615                                .create(null, target,616                                    ast_value.Literal.create(617                                        null, "number", i),618                                    true);619                        }), range(from, (binding.value.elements620                            .length - to))));621                })) : pass);622            }));623    }))), extract((function(node) {624        return (getUid(node.target) ? consequent21 : (undefined || pass));625    })))));626    addRewrite(["RelativeUnpack"], ((__args51 = ["target", checkTop]), (ops51 = [__args51[1]]), seq(moveChild(627        "target"), seqa(ops51), up)));628    addRewrite("ArgumentsPattern", seq(((__args52 = ["id", checkTop]), (ops52 = [__args52[1]]), seq(moveChild(629        "id"), seqa(ops52), up)), ((__args53 = ["elements", checkTop]), (ops53 = [__args53[1]]), seq(630        moveChild("elements"), seqa(ops53), up)), ((__args54 = ["self", checkTop]), (ops54 = [__args54[631        1]]), seq(moveChild("self"), seqa(ops54), up))));632    addRewrite("IdentifierPattern", extract((function(__o5) {633        var id = __o5["id"],634            uid = getUid(id),635            simple = SIMPLE;636        return modifyState(state.addBinding.bind(null, uid, null, simple));637    })));638    addRewrite("ArrayExpression", ((__args55 = ["elements", checkTop]), (ops55 = [__args55[1]]), seq(moveChild(639        "elements"), seqa(ops55), up)));640    addRewrite("ObjectExpression", ((__args56 = ["properties", checkTop]), (ops56 = [__args56[1]]), seq(641        moveChild("properties"), seqa(ops56), up)));642    addRewrite("ObjectValue", ((__args57 = ["value", checkTop]), (ops57 = [__args57[1]]), seq(moveChild("value"),643        seqa(ops57), up)));644    addRewrite("Identifier", ((consequent22 = extract((function(node) {645        var uid;646        return ((uid = getUid(node)), (uid ? getState.map(state.getBinding.bind(null, uid)) :647            pass))648            .chain((function(binding) {649                return (((binding && binding.value) && binding.simple) ? set(650                    binding.value) : pass);651            }));652    }))), extract((function(node) {653        return ((getUid(node) && (!isExpansion(node))) ? consequent22 : (undefined || pass));654    }))));655    (_check = (function(node) {656        if (Array.isArray(node)) {...lexical.js
Source:lexical.js  
...178        addOperator = (function(name, uid) {179            return modifyScope(scope.addOperator.bind(null, name, uid));180        }),181        checkBlockSameScope = ((checkWith = seq(((__args = ["bindings", checkTop]), (actions = [__args[1]]),182            seq(moveChild("bindings"), seqa(actions), up)), ((__args0 = ["body", ((__args1 = [183            "body", checkTop184        ]), (actions0 = [__args1[1]]), seq(moveChild("body"), seqa(actions0), up))]), (actions1 = [185            __args0[1]186        ]), seq(moveChild("body"), seqa(actions1), up)))), (__args2 = ["body", checkTop]), (actions2 = [187            __args2[1]188        ]), (checkBlock = seq(moveChild("body"), seqa(actions2), up)), (function(alt) {189            return inspect((function(node) {190                return ((type(node) === "WithStatement") ? checkWith : ((type(node) ===191                    "BlockStatement") ? checkBlock : alt));192            }));193        })),194        checks = ({}),195        addCheck = (function(type0, check) {196            if (Array.isArray(type0)) type0.forEach((function(x3) {197                return addCheck(x3, check);198            }));199            else {200                (checks[type0] = check);201            }202        });203    addCheck("Program", ((body = [((__args3 = ["body", checkTop]), (actions3 = [__args3[1]]), seq(moveChild(204        "body"), seqa(actions3), up))]), seq(push, seqa(body), pop)));205    addCheck("PackageExports", ((__args4 = ["exports", checkTop]), (actions4 = [__args4[1]]), seq(moveChild(206        "exports"), seqa(actions4), up)));207    addCheck("PackageExport", seq(inspect((function(__o3) {208        var id = __o3["id"];209        return addMutableBindingChecked(id.name, id.loc);210    })), ((__args5 = ["id", checkTop]), (actions5 = [__args5[1]]), seq(moveChild("id"), seqa(actions5),211        up))));212    addCheck("Package", ((body0 = [((__args6 = ["exports", checkTop]), (actions6 = [__args6[1]]), seq(moveChild(213        "exports"), seqa(actions6), up)), ((__args7 = ["body", checkBlockSameScope(((__args8 = [214        "body", checkTop215    ]), (actions7 = [__args8[1]]), seq(moveChild("body"), seqa(actions7),216        up)))]), (actions8 = [__args7[1]]), seq(moveChild("body"), seqa(actions8), up))]), seq(push,217        seqa(body0), pop)));218    addCheck(["StaticDeclaration", "VariableDeclaration"], ((__args9 = ["declarations", checkTop]), (actions9 = [219        __args9[1]220    ]), seq(moveChild("declarations"), seqa(actions9), up)));221    addCheck("StaticDeclarator", inspect((function(__o3) {222        var id = __o3["id"];223        return addStaticBindingChecked(id.name, id.loc);224    })));225    addCheck("VariableDeclarator", ((bind = (function(node) {226        return (node.immutable ? addImmutableBindingChecked(node.id.name, node.loc) :227            addMutableBindingChecked(node.id.name, node.loc));228    })), (consequent = seq(inspect(bind), ((__args10 = ["id", checkTop]), (actions10 = [__args10[1]]),229        seq(moveChild("id"), seqa(actions10), up)), ((__args11 = ["init", checkTop]), (230        actions11 = [__args11[1]]), seq(moveChild("init"), seqa(actions11), up)))), (alternate = seq(((231        __args12 = ["init", checkTop]), (actions12 = [__args12[1]]), seq(moveChild("init"),232        seqa(actions12), up)), inspect(bind), ((__args13 = ["id", checkTop]), (actions13 = [233        __args13[1]234    ]), seq(moveChild("id"), seqa(actions13), up)))), inspect((function(node) {235        return (node.recursive ? consequent : (alternate || pass));236    }))));237    addCheck("Binding", ((consequent0 = seq(((__args14 = ["pattern", checkTop]), (actions14 = [__args14[1]]),238        seq(moveChild("pattern"), seqa(actions14), up)), ((__args15 = ["value", checkTop]), (239        actions15 = [__args15[1]]), seq(moveChild("value"), seqa(actions15), up)))), (alternate0 = seq(240        ((__args16 = ["value", checkTop]), (actions16 = [__args16[1]]), seq(moveChild("value"),241            seqa(actions16), up)), ((__args17 = ["pattern", checkTop]), (actions17 = [__args17[1]]),242            seq(moveChild("pattern"), seqa(actions17), up)))), inspect((function(node) {243        return (node.recursive ? consequent0 : (alternate0 || pass));244    }))));245    addCheck("BlockStatement", ((body1 = [((__args18 = ["body", checkTop]), (actions18 = [__args18[1]]), seq(246        moveChild("body"), seqa(actions18), up))]), seq(push, seqa(body1), pop)));247    addCheck("ExpressionStatement", ((__args19 = ["expression", checkTop]), (actions19 = [__args19[1]]), seq(248        moveChild("expression"), seqa(actions19), up)));249    addCheck("IfStatement", seq(((__args20 = ["test", checkTop]), (actions20 = [__args20[1]]), seq(moveChild(250        "test"), seqa(actions20), up)), ((body2 = [((__args21 = ["consequent", checkTop]), (actions21 = [251        __args21[1]252    ]), seq(moveChild("consequent"), seqa(actions21), up))]), seq(push, seqa(body2), pop)), ((body3 = [253        ((__args22 = ["alternate", checkTop]), (actions22 = [__args22[1]]), seq(moveChild(254            "alternate"), seqa(actions22), up))255    ]), seq(push, seqa(body3), pop))));256    addCheck("WithStatement", ((body4 = [((__args23 = ["bindings", checkTop]), (actions23 = [__args23[1]]), seq(257        moveChild("bindings"), seqa(actions23), up)), ((__args24 = ["body", ((__args25 = [258        "body", checkTop259    ]), (actions24 = [__args25[1]]), seq(moveChild("body"), seqa(actions24), up))]), (260        actions25 = [__args24[1]]), seq(moveChild("body"), seqa(actions25), up))]), seq(push, seqa(261        body4), pop)));262    addCheck("SwitchStatement", ((body5 = [((__args26 = ["discriminant", checkTop]), (actions26 = [__args26[1]]),263        seq(moveChild("discriminant"), seqa(actions26), up)), ((__args27 = ["cases", checkTop]), (264        actions27 = [__args27[1]]), seq(moveChild("cases"), seqa(actions27), up))]), seq(push, seqa(265        body5), pop)));266    addCheck("SwitchCase", seq(((__args28 = ["test", checkTop]), (actions28 = [__args28[1]]), seq(moveChild(267        "test"), seqa(actions28), up)), ((__args29 = ["consequent", checkTop]), (actions29 = [__args29[268        1]]), seq(moveChild("consequent"), seqa(actions29), up))));269    addCheck(["ReturnStatement", "ThrowStatement"], ((__args30 = ["argument", checkTop]), (actions30 = [270        __args30[1]271    ]), seq(moveChild("argument"), seqa(actions30), up)));272    addCheck("TryStatement", seq(((__args31 = ["block", checkTop]), (actions31 = [__args31[1]]), seq(moveChild(273        "block"), seqa(actions31), up)), ((body6 = [((__args32 = ["handler", checkTop]), (actions32 = [274        __args32[1]275    ]), seq(moveChild("handler"), seqa(actions32), up))]), seq(push, seqa(body6), pop)), ((body7 = [((276        __args33 = ["finalizer", checkTop]), (actions33 = [__args33[1]]), seq(moveChild(277        "finalizer"), seqa(actions33), up))]), seq(push, seqa(body7), pop))));278    addCheck("CatchClause", ((body8 = [inspect((function(__o3) {279        var param = __o3["param"];280        return addImmutableBindingChecked(param.name, param.loc);281    })), ((__args34 = ["param", checkTop]), (actions34 = [__args34[1]]), seq(moveChild("param"),282        seqa(actions34), up)), ((__args35 = ["body", ((__args36 = ["body", checkTop]), (283        actions35 = [__args36[1]]), seq(moveChild("body"), seqa(actions35), up))]), (284        actions36 = [__args35[1]]), seq(moveChild("body"), seqa(actions36), up))]), seq(push, seqa(285        body8), pop)));286    addCheck("WhileStatement", seq(((__args37 = ["test", checkTop]), (actions37 = [__args37[1]]), seq(moveChild(287        "test"), seqa(actions37), up)), ((body9 = [((__args38 = ["body", checkTop]), (actions38 = [288        __args38[1]289    ]), seq(moveChild("body"), seqa(actions38), up))]), seq(push, seqa(body9), pop))));290    addCheck("DoWhileStatement", seq(((body10 = [((__args39 = ["body", checkTop]), (actions39 = [__args39[1]]),291        seq(moveChild("body"), seqa(actions39), up))]), seq(push, seqa(body10), pop)), ((__args40 = [292        "test", checkTop293    ]), (actions40 = [__args40[1]]), seq(moveChild("test"), seqa(actions40), up))));294    addCheck("ForStatement", ((body11 = [((__args41 = ["init", checkTop]), (actions41 = [__args41[1]]), seq(295        moveChild("init"), seqa(actions41), up)), ((__args42 = ["test", checkTop]), (actions42 = [296        __args42[1]297    ]), seq(moveChild("test"), seqa(actions42), up)), ((__args43 = ["update", checkTop]), (298        actions43 = [__args43[1]]), seq(moveChild("update"), seqa(actions43), up)), ((body12 = [299        ((__args44 = ["body", checkTop]), (actions44 = [__args44[1]]), seq(moveChild(300            "body"), seqa(actions44), up))301    ]), seq(push, seqa(body12), pop))]), seq(push, seqa(body11), pop)));302    addCheck("FunctionExpression", getClosure((function(parentClosure) {303        var __args45, actions45;304        return block(when((function(x3) {305            return x3.id;306        }), seq(inspect((function(__o3) {307            var id = __o3["id"];308            return addImmutableBinding(id.name, id.loc);309        })), ((__args45 = ["id", checkTop]), (actions45 = [__args45[1]]), seq(moveChild(310            "id"), seqa(actions45), up)))), getLocals((function(closure) {311            var __args46, actions46;312            return seq(((__args46 = ["params", checkTop]), (actions46 = [__args46[1]]),313                seq(moveChild("params"), seqa(actions46), up)), getClosure((314                function(params) {315                    var __args47, actions47;316                    return seq(((__args47 = ["body", checkBlockSameScope(317                            checkTop)]), (actions47 = [__args47[1]]), seq(318                            moveChild("body"), seqa(actions47), up)),319                        getClosure((function(c) {320                            return getLocals((function(locals) {321                                return modifyNode((function(322                                    node) {323                                    return setClosure(324                                        arrayDiff(c,325                                            params),326                                        setLocals(327                                            arrayDiff(328                                                locals,329                                                closure330                                            ), node));331                                }));332                            }));333                        })));334                })));335        })));336    })));337    addCheck("UnaryExpression", seq(((__args45 = ["argument", checkTop]), (actions45 = [__args45[1]]), seq(338        moveChild("argument"), seqa(actions45), up)), inspect((function(__o3) {339        var loc = __o3["loc"],340            operator = __o3["operator"],341            argument = __o3["argument"];342        return splitUnary(operator.name)343            .chain((function(ops) {344                var __args46, actions46;345                return ((ops.length > 1) ? seq(setNode(ops.reduceRight((function(p, c) {346                    return ast_expression.UnaryExpression.create(347                        loc, c, p);348                }), argument)), checkTop) : ((__args46 = ["operator", checkTop]), (349                    actions46 = [__args46[1]]), seq(moveChild("operator"), seqa(350                    actions46), up)));351            }));352    }))));353    addCheck("AssignmentExpression", seq(((__args46 = ["left", checkTop]), (actions46 = [__args46[1]]), seq(354        moveChild("left"), seqa(actions46), up)), ((consequent1 = inspect((function(__o3) {355        var immutable = __o3["immutable"],356            left = __o3["left"],357            name = left["name"],358            loc = left["loc"];359        return seq(checkCanAssign(name, loc), (immutable ? markBindingImmutable(name,360            loc) : markBindingMutable(name, loc)));361    }))), inspect((function(node) {362        return (isSymbol(node.left) ? consequent1 : (undefined || pass));363    }))), ((__args47 = ["right", checkTop]), (actions47 = [__args47[1]]), seq(moveChild("right"), seqa(364        actions47), up))));365    addCheck("DeleteExpression", ((__args48 = ["argument", checkTop]), (actions48 = [__args48[1]]), seq(366        moveChild("argument"), seqa(actions48), up)));367    addCheck("BinaryExpression", seq(((__args49 = ["operator", checkTop]), (actions49 = [__args49[1]]), seq(368        moveChild("operator"), seqa(actions49), up)), ((__args50 = ["left", checkTop]), (actions50 = [369        __args50[1]370    ]), seq(moveChild("left"), seqa(actions50), up)), ((__args51 = ["right", checkTop]), (actions51 = [371        __args51[1]372    ]), seq(moveChild("right"), seqa(actions51), up))));373    addCheck("ConditionalExpression", seq(((__args52 = ["test", checkTop]), (actions52 = [__args52[1]]), seq(374        moveChild("test"), seqa(actions52), up)), ((__args53 = ["consequent", checkTop]), (actions53 = [375        __args53[1]376    ]), seq(moveChild("consequent"), seqa(actions53), up)), ((__args54 = ["alternate", checkTop]), (377        actions54 = [__args54[1]]), seq(moveChild("alternate"), seqa(actions54), up))));378    addCheck(["CallExpression", "NewExpression"], seq(((__args55 = ["callee", checkTop]), (actions55 = [379        __args55[1]380    ]), seq(moveChild("callee"), seqa(actions55), up)), ((__args56 = ["args", checkTop]), (actions56 = [381        __args56[1]382    ]), seq(moveChild("args"), seqa(actions56), up))));383    addCheck(["MemberExpression", "CheckedMemberExpression"], seq(((__args57 = ["object", checkTop]), (384        actions57 = [__args57[1]]), seq(moveChild("object"), seqa(actions57), up)), ((__args58 = [385            "property", checkTop386        ]), (actions58 = [__args58[1]]), (consequent2 = seq(moveChild("property"), seqa(actions58), up)),387        inspect((function(node) {388            return (node.computed ? consequent2 : (undefined || pass));389        })))));390    addCheck("ArrayExpression", ((__args59 = ["elements", checkTop]), (actions59 = [__args59[1]]), seq(391        moveChild("elements"), seqa(actions59), up)));392    addCheck("ObjectExpression", ((__args60 = ["properties", checkTop]), (actions60 = [__args60[1]]), seq(393        moveChild("properties"), seqa(actions60), up)));394    addCheck("LetExpression", ((body13 = [((__args61 = ["bindings", checkTop]), (actions61 = [__args61[1]]),395        seq(moveChild("bindings"), seqa(actions61), up)), ((__args62 = ["body", checkTop]), (396        actions62 = [__args62[1]]), seq(moveChild("body"), seqa(actions62), up))]), seq(push, seqa(397        body13), pop)));398    addCheck("CurryExpression", seq(((__args63 = ["base", checkTop]), (actions63 = [__args63[1]]), seq(399        moveChild("base"), seqa(actions63), up)), ((__args64 = ["args", checkTop]), (actions64 = [400        __args64[1]401    ]), seq(moveChild("args"), seqa(actions64), up))));402    addCheck("OperatorExpression", ((__args65 = ["operator", checkTop]), (actions65 = [__args65[1]]), seq(403        moveChild("operator"), seqa(actions65), up)));404    addCheck("EllipsisPattern", ((__args66 = ["id", checkTop]), (actions66 = [__args66[1]]), seq(moveChild("id"),405        seqa(actions66), up)));406    addCheck(["SliceUnpack", "RelativeUnpack", "ImportPattern"], ((__args67 = ["pattern", checkTop]), (407        actions67 = [__args67[1]]), seq(moveChild("pattern"), seqa(actions67), up)));408    addCheck("IdentifierPattern", seq(inspect((function(node) {409        var loc = node["loc"],410            id = node["id"];411        return (reserved(node) ? addImmutableBinding(id.name, loc) : addImmutableBindingChecked(412            id.name, loc));413    })), ((__args68 = ["id", checkTop]), (actions68 = [__args68[1]]), seq(moveChild("id"), seqa(414        actions68), up))));415    addCheck("AsPattern", seq(((__args69 = ["id", checkTop]), (actions69 = [__args69[1]]), seq(moveChild("id"),416        seqa(actions69), up)), inspect((function(node) {417        var __args70 = ["target", modifyNode((function(target) {418            return setUd("id", node.id, target);419        })), checkTop],420            actions70 = [__args70[1], __args70[2]];421        return seq(moveChild("target"), seqa(actions70), up);422    }))));423    addCheck("ObjectPattern", ((__args70 = ["elements", checkTop]), (actions70 = [__args70[1]]), seq(moveChild(424        "elements"), seqa(actions70), up)));425    addCheck("ObjectPatternElement", seq(((__args71 = ["target", checkTop]), (actions71 = [__args71[1]]), seq(426        moveChild("target"), seqa(actions71), up)), ((__args72 = ["key", checkTop]), (actions72 = [427        __args72[1]428    ]), seq(moveChild("key"), seqa(actions72), up))));429    addCheck("ArgumentsPattern", seq(((__args73 = ["id", checkTop]), (actions73 = [__args73[1]]), seq(moveChild(430        "id"), seqa(actions73), up)), ((__args74 = ["elements", checkTop]), (actions74 = [__args74[1]]),431        seq(moveChild("elements"), seqa(actions74), up)), ((__args75 = ["self", checkTop]), (actions75 = [432        __args75[1]433    ]), seq(moveChild("self"), seqa(actions75), up))));434    addCheck("ObjectValue", ((__args76 = ["value", checkTop]), (actions76 = [__args76[1]]), seq(moveChild(435        "value"), seqa(actions76), up)));436    addCheck(["Identifier", "BinaryOperator"], inspect((function(node) {437        var loc = node["loc"],438            name = node["name"];439        return seq(checkHasBinding(name, loc), examineScope((function(s) {440            var uid = scope.getUid(name, s);441            return seq(addRef(uid), setNode(setUid(uid, markUserDefined(node))));442        })));443    })));444    addCheck(["UnaryOperator"], inspect((function(node) {445        var loc = node["loc"],446            name = node["name"];447        return seq(checkHasBinding(name, loc), examineScope((function(s) {448            var uid = scope.getUid(name, s);...transform.js
Source:transform.js  
...131                (transformers[type0] = check);132            }133        }),134        x2 = addTransform.bind(null, "VariableDeclaration"),135        y3 = seq(((__args = ["declarations", checkTop]), (actions = [__args[1]]), seq(moveChild("declarations"),136            sequencea(actions), up)), modify(translate.variableDeclaration));137    x2(y3);138    var x3 = addTransform.bind(null, "Binding"),139        y4 = seq(((__args0 = ["pattern", ((__args1 = ["id", checkTop]), (actions0 = [__args1[1]]), seq(140            moveChild("id"), sequencea(actions0), up))]), (actions1 = [__args0[1]]), seq(moveChild(141            "pattern"), sequencea(actions1), up)), ((__args2 = ["value", checkTop]), (actions2 = [__args2[1]]),142            seq(moveChild("value"), sequencea(actions2), up)));143    x3(y4);144    var x4 = addTransform.bind(null, "VariableDeclarator"),145        y5 = seq(((__args3 = ["id", checkTop]), (actions3 = [__args3[1]]), seq(moveChild("id"), sequencea(146            actions3), up)), ((__args4 = ["init", checkTop]), (actions4 = [__args4[1]]), seq(moveChild(147            "init"), sequencea(actions4), up)), modify(translate.variableDeclarator));148    x4(y5);149    var x5 = addTransform.bind(null, "StaticDeclaration"),150        y6 = modify(translate.emptyStatement);151    x5(y6);152    var x6 = addTransform.bind(null, "CatchClause"),153        y7 = seq(((__args5 = ["param", checkTop]), (actions5 = [__args5[1]]), seq(moveChild("param"), sequencea(154            actions5), up)), ((__args6 = ["body", checkTop]), (actions6 = [__args6[1]]), seq(moveChild(155            "body"), sequencea(actions6), up)), modify(translate.catchClause));156    x6(y7);157    var x7 = addTransform.bind(null, "SwitchCase"),158        y8 = seq(((__args7 = ["test", checkTop]), (actions7 = [__args7[1]]), seq(moveChild("test"), sequencea(159            actions7), up)), ((__args8 = ["consequent", checkTop]), (actions8 = [__args8[1]]), seq(160            moveChild("consequent"), sequencea(actions8), up)), modify(translate.switchCase));161    x7(y8);162    var x8 = addTransform.bind(null, "BlockStatement"),163        y9 = seq(pushBindings, ((__args9 = ["body", checkTop]), (actions9 = [__args9[1]]), seq(moveChild("body"),164            sequencea(actions9), up)), getBindings((function(bindings) {165            return modify(translate.blockStatement.bind(null, bindings));166        })), popBindings);167    x8(y9);168    var x9 = addTransform.bind(null, "ExpressionStatement"),169        y10 = seq(((__args10 = ["expression", checkTop]), (actions10 = [__args10[1]]), seq(moveChild(170            "expression"), sequencea(actions10), up)), modify(translate.expressionStatement));171    x9(y10);172    var x10 = addTransform.bind(null, "IfStatement"),173        y11 = seq(((__args11 = ["test", checkTop]), (actions11 = [__args11[1]]), seq(moveChild("test"),174            sequencea(actions11), up)), ((__args12 = ["consequent", checkTop]), (actions12 = [__args12[1]]),175            seq(moveChild("consequent"), sequencea(actions12), up)), ((__args13 = ["alternate", checkTop]), (176            actions13 = [__args13[1]]), seq(moveChild("alternate"), sequencea(actions13), up)), modify(177            translate.ifStatement));178    x10(y11);179    var x11 = addTransform.bind(null, "WithStatement"),180        y12 = seq(((__args14 = ["bindings", checkTop]), (actions14 = [__args14[1]]), seq(moveChild("bindings"),181            sequencea(actions14), up)), ((__args15 = ["body", checkTop]), (actions15 = [__args15[1]]), seq(182            moveChild("body"), sequencea(actions15), up)), modify(translate.withStatement));183    x11(y12);184    var x12 = addTransform.bind(null, "SwitchStatement"),185        y13 = seq(((__args16 = ["discriminant", checkTop]), (actions16 = [__args16[1]]), seq(moveChild(186            "discriminant"), sequencea(actions16), up)), ((__args17 = ["cases", checkTop]), (actions17 = [187            __args17[1]188        ]), seq(moveChild("cases"), sequencea(actions17), up)), modify(translate.switchStatement));189    x12(y13);190    var x13 = addTransform.bind(null, "ReturnStatement"),191        y14 = seq(((__args18 = ["argument", checkTop]), (actions18 = [__args18[1]]), seq(moveChild("argument"),192            sequencea(actions18), up)), modify(translate.returnStatement));193    x13(y14);194    var x14 = addTransform.bind(null, "ThrowStatement"),195        y15 = seq(((__args19 = ["argument", checkTop]), (actions19 = [__args19[1]]), seq(moveChild("argument"),196            sequencea(actions19), up)), modify(translate.throwStatement));197    x14(y15);198    var x15 = addTransform.bind(null, "BreakStatement"),199        y16 = modify(translate.breakStatement);200    x15(y16);201    var x16 = addTransform.bind(null, "ContinueStatement"),202        y17 = modify(translate.continueStatement);203    x16(y17);204    var x17 = addTransform.bind(null, "TryStatement"),205        y18 = seq(((__args20 = ["block", checkTop]), (actions20 = [__args20[1]]), seq(moveChild("block"),206            sequencea(actions20), up)), ((__args21 = ["handler", checkTop]), (actions21 = [__args21[1]]),207            seq(moveChild("handler"), sequencea(actions21), up)), ((__args22 = ["finalizer", checkTop]), (208            actions22 = [__args22[1]]), seq(moveChild("finalizer"), sequencea(actions22), up)), modify(209            translate.tryStatement));210    x17(y18);211    var x18 = addTransform.bind(null, "WhileStatement"),212        y19 = seq(((__args23 = ["test", checkTop]), (actions23 = [__args23[1]]), seq(moveChild("test"),213            sequencea(actions23), up)), loopBlock(((__args24 = ["body", checkTop]), (actions24 = [__args24[214            1]]), seq(moveChild("body"), sequencea(actions24), up))), modify(translate.whileStatement));215    x18(y19);216    var x19 = addTransform.bind(null, "DoWhileStatement"),217        y20 = seq(loopBlock(((__args25 = ["body", checkTop]), (actions25 = [__args25[1]]), seq(moveChild("body"),218            sequencea(actions25), up))), ((__args26 = ["test", checkTop]), (actions26 = [__args26[1]]), seq(219            moveChild("test"), sequencea(actions26), up)), modify(translate.doWhileStatement));220    x19(y20);221    var x20 = addTransform.bind(null, "ForStatement"),222        y21 = seq(((__args27 = ["init", checkTop]), (actions27 = [__args27[1]]), seq(moveChild("init"),223            sequencea(actions27), up)), ((__args28 = ["test", checkTop]), (actions28 = [__args28[1]]), seq(224            moveChild("test"), sequencea(actions28), up)), ((__args29 = ["update", checkTop]), (actions29 = [225            __args29[1]226        ]), seq(moveChild("update"), sequencea(actions29), up)), loopBlock(((__args30 = ["body", checkTop]), (227            actions30 = [__args30[1]]), seq(moveChild("body"), sequencea(actions30), up))), modify(228            translate.forStatement));229    x20(y21);230    var x21 = addTransform.bind(null, "AssignmentExpression"),231        y22 = seq(((__args31 = ["left", checkTop]), (actions31 = [__args31[1]]), seq(moveChild("left"),232            sequencea(actions31), up)), ((__args32 = ["right", checkTop]), (actions32 = [__args32[1]]), seq(233            moveChild("right"), sequencea(actions32), up)), modify(translate.assignmentExpression));234    x21(y22);235    var x22 = addTransform.bind(null, "DeleteExpression"),236        y23 = seq(((__args33 = ["argument", checkTop]), (actions33 = [__args33[1]]), seq(moveChild("argument"),237            sequencea(actions33), up)), modify(translate.deleteExpression));238    x22(y23);239    var x23 = addTransform.bind(null, "UnaryExpression"),240        y24 = seq(((__args34 = ["argument", checkTop]), (actions34 = [__args34[1]]), seq(moveChild("argument"),241            sequencea(actions34), up)), modify(translate.unaryExpression));242    x23(y24);243    var x24 = addTransform.bind(null, "BinaryExpression"),244        y25 = seq(((__args35 = ["operator", checkTop]), (actions35 = [__args35[1]]), seq(moveChild("operator"),245            sequencea(actions35), up)), ((__args36 = ["left", checkTop]), (actions36 = [__args36[1]]), seq(246            moveChild("left"), sequencea(actions36), up)), ((__args37 = ["right", checkTop]), (actions37 = [247            __args37[1]248        ]), seq(moveChild("right"), sequencea(actions37), up)), modify(translate.binaryExpression));249    x24(y25);250    var x25 = addTransform.bind(null, "ConditionalExpression"),251        y26 = seq(((__args38 = ["test", checkTop]), (actions38 = [__args38[1]]), seq(moveChild("test"),252            sequencea(actions38), up)), ((__args39 = ["consequent", checkTop]), (actions39 = [__args39[1]]),253            seq(moveChild("consequent"), sequencea(actions39), up)), ((__args40 = ["alternate", checkTop]), (254            actions40 = [__args40[1]]), seq(moveChild("alternate"), sequencea(actions40), up)), modify(255            translate.conditionalExpression));256    x25(y26);257    var x26 = addTransform.bind(null, "NewExpression"),258        y27 = seq(((__args41 = ["callee", checkTop]), (actions41 = [__args41[1]]), seq(moveChild("callee"),259            sequencea(actions41), up)), ((__args42 = ["args", checkTop]), (actions42 = [__args42[1]]), seq(260            moveChild("args"), sequencea(actions42), up)), modify(translate.newExpression));261    x26(y27);262    var x27 = addTransform.bind(null, "CallExpression"),263        y28 = seq(((__args43 = ["callee", checkTop]), (actions43 = [__args43[1]]), seq(moveChild("callee"),264            sequencea(actions43), up)), ((__args44 = ["args", checkTop]), (actions44 = [__args44[1]]), seq(265            moveChild("args"), sequencea(actions44), up)), modify(translate.callExpression));266    x27(y28);267    var x28 = addTransform.bind(null, "ApplyExpression"),268        y29 = seq(((__args45 = ["callee", checkTop]), (actions45 = [__args45[1]]), seq(moveChild("callee"),269            sequencea(actions45), up)), ((__args46 = ["args", checkTop]), (actions46 = [__args46[1]]), seq(270            moveChild("args"), sequencea(actions46), up)), modify(translate.applyExpression));271    x28(y29);272    var x29 = addTransform.bind(null, "MemberExpression"),273        y30 = seq(((__args47 = ["object", checkTop]), (actions47 = [__args47[1]]), seq(moveChild("object"),274            sequencea(actions47), up)), ((__args48 = ["property", checkTop]), (actions48 = [__args48[1]]),275            seq(moveChild("property"), sequencea(actions48), up)), modify(translate.memberExpression));276    x29(y30);277    var x30 = addTransform.bind(null, "CheckedMemberExpression"),278        y31 = seq(((__args49 = ["object", checkTop]), (actions49 = [__args49[1]]), seq(moveChild("object"),279                sequencea(actions49), up)), ((__args50 = ["property", checkTop]), (actions50 = [__args50[1]]),280                seq(moveChild("property"), sequencea(actions50), up)), modify(translate.checkedMemberExpression),281            checkTop);282    x30(y31);283    var x31 = addTransform.bind(null, "LetExpression"),284        y32 = seq(((__args51 = ["bindings", checkTop]), (actions51 = [__args51[1]]), seq(moveChild("bindings"),285            sequencea(actions51), up)), withNode((function(z) {286            return addBindingsForBindingsList(z.bindings);287        })), ((__args52 = ["body", checkTop]), (actions52 = [__args52[1]]), seq(moveChild("body"),288            sequencea(actions52), up)), modify(translate.letExpression));289    x31(y32);290    var x32 = addTransform.bind(null, "CurryExpression"),291        y33 = seq(((__args53 = ["base", checkTop]), (actions53 = [__args53[1]]), seq(moveChild("base"),292            sequencea(actions53), up)), ((__args54 = ["args", checkTop]), (actions54 = [__args54[1]]), seq(293            moveChild("args"), sequencea(actions54), up)), modify(translate.curryExpression));294    x32(y33);295    var createExplicitClosure = (function(locals) {296        return enumeration(map((function(uid) {297            return inspectScope(scope.getMapping.bind(null, uid))298                .map((function(name) {299                    return translate.identifier(node.loc, name, uid);300                }));301        }), locals))302            .chain((function(locals0) {303                return modify((function(node0) {304                    return translate.explicitClosure(locals0, node0);305                }));306            }));307    }),308        x33 = addTransform.bind(null, "FunctionExpression"),309        actions55 = [((__args55 = ["id", checkTop]), (actions56 = [__args55[1]]), seq(moveChild("id"),310            sequencea(actions56), up)), modify((function(node0) {311            return translate.functionExpression(node0.loc, node0.id, node0.params, node0.body,312                getUd("prefix", node0));313        })), ((__args56 = ["params", checkTop]), (actions57 = [__args56[1]]), seq(moveChild("params"),314            sequencea(actions57), up)), ((__args57 = ["body", checkTop]), (actions58 = [__args57[1]]), seq(315            moveChild("body"), sequencea(actions58), up)), modify(translate.functionExpressionPost)],316        y34 = seq(enterBlock, sequencea(actions55), exitBlock),317        evaluate = funcBlock(y34),318        y35 = getContext.chain((function(ctx) {319            return ((ctx === state.LOOP_CTX) ? withNode((function(node0) {320                return seq(evaluate, createExplicitClosure(getClosure(node0)));321            })) : evaluate);322        }));323    x33(y35);324    var x34 = addTransform.bind(null, "ArrayExpression"),325        y36 = seq(((__args58 = ["elements", checkTop]), (actions59 = [__args58[1]]), seq(moveChild("elements"),326            sequencea(actions59), up)), modify(translate.arrayExpression));327    x34(y36);328    var x35 = addTransform.bind(null, "ObjectExpression"),329        y37 = seq(((__args59 = ["properties", checkTop]), (actions60 = [__args59[1]]), seq(moveChild(330            "properties"), sequencea(actions60), up)), modify(translate.objectExpression));331    x35(y37);332    var x36 = addTransform.bind(null, "ObjectValue"),333        y38 = seq(((__args60 = ["key", checkTop]), (actions61 = [__args60[1]]), seq(moveChild("key"), sequencea(334            actions61), up)), ((__args61 = ["value", checkTop]), (actions62 = [__args61[1]]), seq(moveChild(335            "value"), sequencea(actions62), up)), modify(translate.objectValue));336    x36(y38);337    var x37 = addTransform.bind(null, "IdentifierPattern"),338        y39 = seq(((__args62 = ["id", checkTop]), (actions63 = [__args62[1]]), seq(moveChild("id"), sequencea(339            actions63), up)), modify((function(x38) {340            return x38.id;341        })));342    x37(y39);343    var x38 = addTransform.bind(null, ["RelativeUnpack", "SliceUnpack"]),344        __args63 = ["target", checkTop],345        actions64 = [__args63[1]],346        y40 = seq(moveChild("target"), sequencea(actions64), up);347    x38(y40);348    var x39 = addTransform.bind(null, "ArgumentsPattern"),349        y41 = seq(((__args64 = ["id", checkTop]), (actions65 = [__args64[1]]), seq(moveChild("id"), sequencea(350            actions65), up)), ((__args65 = ["elements", checkTop]), (actions66 = [__args65[1]]), seq(351            moveChild("elements"), sequencea(actions66), up)), ((__args66 = ["self", checkTop]), (actions67 = [352            __args66[1]353        ]), seq(moveChild("self"), sequencea(actions67), up)));354    x39(y41);355    var x40 = addTransform.bind(null, "Program"),356        y42 = seq(pushBindings, modify((function(node0) {357            return ((type(node0.body) === "Package") ? node0 : setUd("prefix", translate.useStrict,358                node0));359        })), ((__args67 = ["body", checkTop]), (actions68 = [__args67[1]]), seq(moveChild("body"),360            sequencea(actions68), up)), getBindings((function(bindings) {361            return modify(translate.program.bind(null, bindings));362        })));363    x40(y42);364    var x41 = addTransform.bind(null, "Package"),365        y43 = seq(packageManager.chain((function(packageManager0) {366            return modify(translate.packageBlock.bind(null, packageManager0));367        })), checkTop);368    x41(y43);369    var x42 = addTransform.bind(null, "Import"),370        y44 = packageManager.chain((function(packageManager0) {371            var y45;372            return modify(((y45 = packageManager0.importPackage), (function(z) {373                return y45(z.from);...pushpop.js
Source:pushpop.js  
...571    push: function (widget) {572        var index = this.size() - 1,573            underlay = this.get('underlay');574        if (underlay === 'with') {575            this.moveChild(index, this._UNDERLAY_TRANS);576        }577        this.add(widget);578        this.moveChild(widget, this._PUSHPOP_TRANS, true);579        if (Y.Lang.isNumber(underlay)) {580            return this.moveChild(index, this._UNDERLAY_TRANS, function () {581                Y.later(underlay, this, function () {582                    this.moveChild(widget, this._DONE_TRANS, function () {583                        this.item(index).disable();584                    });585                });586            });587        } else {588            return this.moveChild(widget, this._DONE_TRANS, function () {589                this.item(index).disable();590            });591        }592    },593    /**594     * pop current widget off html, and remove the widget from PushPop widget595     *596     * @method pop597     * @param [keep] {Boolean} <b>true</b> means do not destroy the widget. Default to destroy the widget after pop animation.598     * @chainable599     */600    pop: function (keep) {601        var index = this.size() - 1,602            widget = this.item(index),603            w2 = this.item(index - 1),604            underlay = this.get('underlay');605        if (!widget) {606            return this;607        }608        if (w2) {609            w2.enable();610        }611        if (underlay !== 'none') {612            this.moveChild(index - 1, this._UNDERLAY_TRANS, true);613            if ((underlay === 'with') && index) {614                this.moveChild(index - 1, this._DONE_TRANS);615            }616        }617        return this.moveChild(widget, this._PUSHPOP_TRANS, function () {618            widget.remove();619            if (!keep) {620                Y.later(850, null, function() {621                    widget.destroy(true);622                });623            }624            if (index && Y.Lang.isNumber(underlay)) {625                Y.later(underlay, this, function () {626                    this.moveChild(index - 1, this._DONE_TRANS);627                });628            }629        });630    }631};...reachable.js
Source:reachable.js  
...65        else {66            (peepholes[type0] = f);67        }68    });69addRewrite("Program", ((__args = ["body", checkTop]), (actions = [__args[1]]), seq(moveChild("body"), sequencea(actions),70    up)));71addRewrite("Package", seq(((__args0 = ["exports", checkTop]), (actions0 = [__args0[1]]), seq(moveChild("exports"),72    sequencea(actions0), up)), ((__args1 = ["body", checkTop]), (actions1 = [__args1[1]]), seq(moveChild("body"),73    sequencea(actions1), up))));74addRewrite("PackageExports", ((__args2 = ["exports", checkTop]), (actions2 = [__args2[1]]), seq(moveChild("exports"),75    sequencea(actions2), up)));76addRewrite("PackageExport", ((__args3 = ["id", checkTop]), (actions3 = [__args3[1]]), seq(moveChild("id"), sequencea(77    actions3), up)));78addRewrite("SwitchCase", seq(((__args4 = ["test", checkTop]), (actions4 = [__args4[1]]), seq(moveChild("test"),79    sequencea(actions4), up)), ((__args5 = ["consequent", checkTop]), (actions5 = [__args5[1]]), seq(moveChild(80    "consequent"), sequencea(actions5), up))));81addRewrite("CatchClause", seq(((__args6 = ["param", checkTop]), (actions6 = [__args6[1]]), seq(moveChild("param"),82    sequencea(actions6), up)), ((__args7 = ["body", checkTop]), (actions7 = [__args7[1]]), seq(moveChild("body"),83    sequencea(actions7), up))));84addRewrite("VariableDeclaration", ((__args8 = ["declarations", checkTop]), (actions8 = [__args8[1]]), seq(moveChild(85    "declarations"), sequencea(actions8), up)));86addRewrite("VariableDeclarator", ((test = inspect((function(x0) {87    return x0.id;88}))), (__args9 = ["init", checkTop]), (actions9 = [__args9[1]]), (yes = seq(moveChild("init"), sequencea(89    actions9), up)), test.chain((function(uid) {90    return M.lift(M.inner.isReachable(uid))91        .chain((function(reachable) {92            return (reachable ? yes : removeBinding);93        }));94}))));95addRewrite("Binding", ((__args10 = ["value", checkTop]), (actions10 = [__args10[1]]), (consequent = seq(moveChild(96    "value"), sequencea(actions10), up)), (test0 = inspect((function(x0) {97    return x0.pattern.id;98}))), (__args11 = ["value", checkTop]), (actions11 = [__args11[1]]), (yes0 = seq(moveChild("value"), sequencea(99    actions11), up)), (alternate = test0.chain((function(uid) {100    return M.lift(M.inner.isReachable(uid))101        .chain((function(reachable) {102            return (reachable ? yes0 : removeBinding);103        }));104}))), extract((function(node) {105    return (isReserved(node) ? consequent : (alternate || pass));106}))));107addRewrite("BlockStatement", ((__args12 = ["body", checkTop]), (actions12 = [__args12[1]]), seq(moveChild("body"),108    sequencea(actions12), up)));109addRewrite("ExpressionStatement", ((__args13 = ["expression", checkTop]), (actions13 = [__args13[1]]), seq(moveChild(110    "expression"), sequencea(actions13), up)));111addRewrite("WithStatement", seq(((__args14 = ["body", checkTop]), (actions14 = [__args14[1]]), seq(moveChild("body"),112    sequencea(actions14), up)), ((__args15 = ["bindings", checkTop]), (actions15 = [__args15[1]]), seq(113    moveChild("bindings"), sequencea(actions15), up))));114addRewrite("SwitchStatement", seq(((__args16 = ["discriminant", checkTop]), (actions16 = [__args16[1]]), seq(moveChild(115    "discriminant"), sequencea(actions16), up)), ((__args17 = ["cases", checkTop]), (actions17 = [__args17[1]]),116    seq(moveChild("cases"), sequencea(actions17), up))));117addRewrite(["ReturnStatement", "ThrowStatement"], ((__args18 = ["argument", checkTop]), (actions18 = [__args18[1]]),118    seq(moveChild("argument"), sequencea(actions18), up)));119addRewrite("TryStatement", seq(((__args19 = ["block", checkTop]), (actions19 = [__args19[1]]), seq(moveChild("block"),120    sequencea(actions19), up)), ((__args20 = ["handler", checkTop]), (actions20 = [__args20[1]]), seq(moveChild(121    "handler"), sequencea(actions20), up)), ((__args21 = ["finalizer", checkTop]), (actions21 = [__args21[1]]),122    seq(moveChild("finalizer"), sequencea(actions21), up))));123addRewrite(["WhileStatement", "DoWhileStatement"], seq(((__args22 = ["test", checkTop]), (actions22 = [__args22[1]]),124    seq(moveChild("test"), sequencea(actions22), up)), ((__args23 = ["body", checkTop]), (actions23 = [__args23[125    1]]), seq(moveChild("body"), sequencea(actions23), up))));126addRewrite("ForStatement", seq(((__args24 = ["body", checkTop]), (actions24 = [__args24[1]]), seq(moveChild("body"),127    sequencea(actions24), up)), ((__args25 = ["update", checkTop]), (actions25 = [__args25[1]]), seq(moveChild(128    "update"), sequencea(actions25), up)), ((__args26 = ["test", checkTop]), (actions26 = [__args26[1]]), seq(129    moveChild("test"), sequencea(actions26), up)), ((__args27 = ["init", checkTop]), (actions27 = [__args27[1]]),130    seq(moveChild("init"), sequencea(actions27), up))));131addRewrite(["ConditionalExpression", "IfStatement"], seq(((__args28 = ["test", checkTop]), (actions28 = [__args28[1]]),132    seq(moveChild("test"), sequencea(actions28), up)), ((__args29 = ["consequent", checkTop]), (actions29 = [133    __args29[1]134]), seq(moveChild("consequent"), sequencea(actions29), up)), ((__args30 = ["alternate", checkTop]), (actions30 = [135    __args30[1]136]), seq(moveChild("alternate"), sequencea(actions30), up))));137addRewrite("FunctionExpression", seq(((__args31 = ["body", checkTop]), (actions31 = [__args31[1]]), seq(moveChild(138    "body"), sequencea(actions31), up)), ((__args32 = ["id", checkTop]), (actions32 = [__args32[1]]), seq(139    moveChild("id"), sequencea(actions32), up)), ((__args33 = ["params", checkTop]), (actions33 = [__args33[1]]),140    seq(moveChild("params"), sequencea(actions33), up))));141addRewrite(["UnaryExpression", "DeleteExpression"], ((__args34 = ["argument", checkTop]), (actions34 = [__args34[1]]),142    seq(moveChild("argument"), sequencea(actions34), up)));143addRewrite(["BinaryExpression", "AssignmentExpression"], seq(((__args35 = ["left", checkTop]), (actions35 = [__args35[1]]),144    seq(moveChild("left"), sequencea(actions35), up)), ((__args36 = ["right", checkTop]), (actions36 = [145    __args36[1]146]), seq(moveChild("right"), sequencea(actions36), up))));147addRewrite(["MemberExpression", "CheckedMemberExpression"], seq(((__args37 = ["object", checkTop]), (actions37 = [148    __args37[1]149]), seq(moveChild("object"), sequencea(actions37), up)), ((__args38 = ["property", checkTop]), (actions38 = [150    __args38[1]151]), (consequent0 = seq(moveChild("property"), sequencea(actions38), up)), extract((function(node) {152    return (node.computed ? consequent0 : (undefined || pass));153})))));154addRewrite(["CallExpression", "NewExpression", "ApplyExpression"], seq(((__args39 = ["callee", checkTop]), (actions39 = [155    __args39[1]156]), seq(moveChild("callee"), sequencea(actions39), up)), ((__args40 = ["args", checkTop]), (actions40 = [157    __args40[1]158]), seq(moveChild("args"), sequencea(actions40), up))));159addRewrite("CurryExpression", seq(((__args41 = ["base", checkTop]), (actions41 = [__args41[1]]), seq(moveChild("base"),160    sequencea(actions41), up)), ((__args42 = ["args", checkTop]), (actions42 = [__args42[1]]), seq(moveChild(161    "args"), sequencea(actions42), up))));162addRewrite("OperatorExpression", ((__args43 = ["operator", checkTop]), (actions43 = [__args43[1]]), seq(moveChild(163    "operator"), sequencea(actions43), up)));164addRewrite("LetExpression", seq(((__args44 = ["body", checkTop]), (actions44 = [__args44[1]]), seq(moveChild("body"),165    sequencea(actions44), up)), ((__args45 = ["bindings", checkTop]), (actions45 = [__args45[1]]), seq(166    moveChild("bindings"), sequencea(actions45), up))));167addRewrite(["SliceUnpack", "RelativeUnpack"], ((__args46 = ["target", checkTop]), (actions46 = [__args46[1]]), seq(168    moveChild("target"), sequencea(actions46), up)));169addRewrite("ArgumentsPattern", ((test1 = inspect((function(x0) {170    return x0.id.id;171}))), (no = extract((function(node) {172    return set(modify(node, ({173        id: null174    })));175}))), (consequent1 = test1.chain((function(uid) {176    return M.lift(M.inner.isReachable(uid))177        .chain((function(reachable) {178            return (reachable ? pass : no);179        }));180}))), extract((function(node) {181    return (node.id ? consequent1 : (undefined || pass));182}))));183addRewrite("ArrayExpression", ((__args47 = ["elements", checkTop]), (actions47 = [__args47[1]]), seq(moveChild(184    "elements"), sequencea(actions47), up)));185addRewrite("ObjectExpression", ((__args48 = ["properties", checkTop]), (actions48 = [__args48[1]]), seq(moveChild(186    "properties"), sequencea(actions48), up)));187addRewrite("ObjectValue", ((__args49 = ["value", checkTop]), (actions49 = [__args49[1]]), seq(moveChild("value"),188    sequencea(actions49), up)));189addRewrite("Identifier", extract((function(z) {190    return addReference(getUid(z));191})));192(_check = (function(node) {193    return (Array.isArray(node) ? visitArray(node) : (peepholes[type(node)] || pass));194}));195(removeUnreachable = (function(ast, prune) {196    var state = empty.setPrune(prune),197        c = seq(checkTop, extractCtx);198    return StateM.evalState(TreeZipperT.runTreeZipperT(c, ast), state);199}));...jquery.rotate.js
Source:jquery.rotate.js  
1/*2 * rotateList v2.03 * Copyright (c) 2013 Wendell  http://blog.webql.info/4*/5(function($){6    $.fn.extend({7        rotateList:function(options){8            var defaults = {9                mouseCtrl:"click",                     // 忢坼èªé¼ æ äºä»¶10                ctrlEleName:"ctrlBo",                  // 忢坼èª11                ctrlEleNamePo:"ctrlPo",                // åå忢坼èª12                position:"left",                       // 忢è¿å¨ç±»å13                speed:500,                             // 忢è¿å¨é度14                aniTime:5000,                          // èªå¨åæ¢åæ»æ¶é´15                focus:"on",                            // å½åç¦ç¹16                focuSiblings:"a",                      // å½åç¦ç¹åè¾çå
ç´ 17                eleName:"a",                           // åæ¢å¯¼èªææå
ç´ å18                leftCtrlClass:".leftCtrl",             // ååå·¦æ§å¶ææ19                rightCtrlClass:".rightCtrl",           // åå峿§å¶ææ20                moveMent:"ul",                         // è¿å¨å±21                moveMentChild:"li",                    // è¿å¨å±å级22                eleGroup:true,                         // å¯¼èªææç»23                eleGroupPo:true                        // 左峿§å¶ææç»24            }25            var options = $.extend(defaults,options);   // å°defaults对象èµäºåéoptions26            var thisObj = $(this);  // 使ç¨å¯¹è±¡27            var moveParent = thisObj.find(options.moveMent).eq(0);  // æ¥æ¾thisObjä¸çé¦ä¸ªè¿å¨å±28            var moveChild = moveParent.find(options.moveMentChild); // æ¥æ¾é¦ä¸ªè¿å¨å±ä¸çåå
ç´ 29            var leng = moveChild.length;    // è¿å¨å±åå
ç´ çé¿åº¦30            var vIndex = 0; // åå§åç´¢å¼å¼31            var timer = null;   // åå§åtimer为空32            if(thisObj.data("isRun") == null){  // è¿è¡å¤æthisObjæ¯å¦ä¸ºç©º33                fnAppend(); // 空åè¿åææç»34                thisObj.data("isRun",1);35            }36            var ctrlBo = $("." + options.ctrlEleName).find(options.eleName);    // æ¥æ¾åç¹ææ37            var ctrlPo = $("." + options.ctrlEleNamePo);   // æ¥æ¾å·¦å³ææ38            thisObj.data("moveRotate",moveRotate);  // åå¨è¿å¨å½æ°39            moveRotate(0);  // 馿¬¡è¿å¨å è½½40            switch(options.position){   // éç½®è¿å¨åå§å¼41                case "left":42                    moveParent.css("width",moveChild.length * moveChild.width());43                break;44                case "top":45                    moveChild.css({float:"none",display:"block"});46                break;47                case "opacity":48                    moveChild.css({opacity:0,position:"absolute"});49                    moveChild.eq(vIndex).css({opacity:1});50                break;51            }52            function moveRotate(num){ // è¿å¨æ¹æ³53                vIndex = num;   // å°ä¼ å
¥å¼èµäºç´¢å¼å¼54                thisObj.data("vIndex",vIndex);  // åå¨ç´¢å¼å¼55                ctrlBo.eq(num).addClass(options.focus).siblings(options.focuSiblings).removeClass(options.focus);56                switch(options.position){57                    case "left":58                        moveParent.stop().animate({left:-moveChild.width() * num},options.speed);59                    break;60                    case "top":61                        moveParent.stop().animate({top:-moveChild.height() * num},options.speed);62                    break;63                    case "opacity":64                        moveChild.eq(num).stop().animate({opacity:1},options.speed).siblings().animate({opacity:0},options.speed);65                    break;66                }67            }68            function fnAppend(){    // 卿åå
¥ææç»69                var alink = "<a href='javascript:;'></a>";70                if(options.eleGroup){71                    thisObj.append("<div class='ctrlBo'></div>");72                    for(i = 0;i < leng;i++){73                        $("." + options.ctrlEleName).append(alink);74                    }75                }76                if(options.eleGroupPo){77                    thisObj.append("<div class='ctrlPo'><a href='javascript:;' class='leftCtrl'><i></i></a><a href='javascript:;' class='rightCtrl'><i></i></a></div>")78                }79            }80            function rotateAni(){81                moveRotate($(this).index());82            }83            var setAni = {84                rightCtrl:function(){   // åå峿§å¶é®85                    vIndex = thisObj.data("vIndex");86                    if(vIndex == moveChild.length - 1){87                        moveRotate(0);88                    }else{89                        moveRotate(vIndex + 1)90                    }91                },92                leftCtrl:function(){    // ååå·¦æ§å¶é®93                    vIndex = thisObj.data("vIndex");94                    if(vIndex == 0){95                        moveRotate(leng - 1);96                    }else{97                        moveRotate(vIndex - 1);98                    }99                }100            }101            function mOver(){102                clearInterval(timer);103                ctrlPo.show();104            }105            function mOut(){106                timer = setInterval(setAni.rightCtrl,options.aniTime);107                ctrlPo.hide();108            }109            if(thisObj.data("isTimer") == null){110                ctrlBo.bind(options.mouseCtrl,rotateAni);111                timer = setInterval(setAni.rightCtrl,options.aniTime); 112                thisObj.bind("mouseover",mOver);113                thisObj.bind("mouseout",mOut);114                $(options.rightCtrlClass).bind("click",setAni.rightCtrl);115                $(options.leftCtrlClass).bind("click",setAni.leftCtrl);116                thisObj.data("isTimer",1);117            }else{118                thisObj.data("vIndex",0);119                thisObj.data("moveRotate")(0);120            }121            return $(this);122        }123    });...createPatchChildren.test.js
Source:createPatchChildren.test.js  
1/* @flow weak */2import sinon from 'sinon/pkg/sinon'3import {VirtualNode} from '../types'4import {createPatchChildren} from '../createPatchChildren'5import {h} from '../h'6function createEmptyVNodes (tag, mapping) {7  return mapping.map(key => h(tag || `p`, {key}))8}9describe(`createPatchChildren`, () => {10  let decorator11  let orderedDecorator12  beforeEach(() => {13    const order = []14    const orderedStub = name => (...args) => {15      order.push([name, ...args])16    }17    orderedDecorator = {18      order,19      insertChild: orderedStub(`insert`),20      updateChild: orderedStub(`update`),21      moveChild: orderedStub(`move`),22      removeChild: orderedStub(`remove`),23    }24    decorator = {25      insertChild: sinon.stub(),26      updateChild: sinon.stub(),27      moveChild: sinon.stub(),28      removeChild: sinon.stub(),29    }30  })31  it(`creates children`, () => {32    const children: Array<VirtualNode> = createEmptyVNodes(`p`, [null, null])33    const patchChildren = createPatchChildren(decorator)34    patchChildren(children, [])35    assert.ok(decorator.insertChild.calledTwice)36    assert.ok(decorator.updateChild.notCalled)37    assert.ok(decorator.moveChild.notCalled)38    assert.ok(decorator.removeChild.notCalled)39    assert.ok(decorator.insertChild.calledWith(children[0], 0))40    assert.ok(decorator.insertChild.calledWith(children[1], 1))41  })42  it(`destroys children`, () => {43    const children: Array<VirtualNode> = createEmptyVNodes(`p`, [null, null])44    const patchChildren = createPatchChildren(decorator)45    patchChildren(children, [])46    assert.ok(decorator.insertChild.calledTwice)47    assert.ok(decorator.updateChild.notCalled)48    assert.ok(decorator.moveChild.notCalled)49    assert.ok(decorator.removeChild.notCalled)50    assert.ok(decorator.insertChild.calledWith(children[0], 0))51    assert.ok(decorator.insertChild.calledWith(children[1], 1))52    patchChildren([], children)53    assert.ok(decorator.insertChild.calledTwice)54    assert.ok(decorator.updateChild.notCalled)55    assert.ok(decorator.moveChild.notCalled)56    assert.ok(decorator.removeChild.calledTwice)57    assert.ok(decorator.removeChild.calledWith(children[0]))58    assert.ok(decorator.removeChild.calledWith(children[1]))59  })60  it(`patches children`, () => {61    const children: Array<VirtualNode> = [h(`p`)]62    const next: Array<VirtualNode> = [h(`p`, {id: `next`})]63    const doubleNext: Array<VirtualNode> = [h(`p`, {id: `double-next`})]64    const patchChildren = createPatchChildren(decorator)65    patchChildren(children)66    assert.ok(decorator.insertChild.calledOnce)67    assert.ok(decorator.moveChild.notCalled)68    assert.ok(decorator.removeChild.notCalled)69    assert.ok(decorator.insertChild.calledWith(children[0], 0))70    patchChildren(next)71    assert.ok(decorator.insertChild.calledOnce)72    assert.ok(decorator.updateChild.calledOnce)73    assert.ok(decorator.moveChild.notCalled)74    assert.ok(decorator.removeChild.notCalled)75    assert.ok(decorator.updateChild.calledWith(children[0], next[0], 0))76    patchChildren(doubleNext)77    assert.ok(decorator.insertChild.calledOnce)78    assert.ok(decorator.updateChild.calledTwice)79    assert.ok(decorator.moveChild.notCalled)80    assert.ok(decorator.removeChild.notCalled)81    assert.ok(decorator.updateChild.calledWith(next[0], doubleNext[0], 0))82  })83  it(`rearranges children with keys`, () => {84    const children: Array<VirtualNode> = createEmptyVNodes(`p`, [`a`, null, null, `b`])85    const next: Array<VirtualNode> = createEmptyVNodes(`p`, [null, `b`, `a`, null])86    const patchChildren = createPatchChildren(orderedDecorator)87    patchChildren(children)88    orderedDecorator.order.map((op, index) => assert.deepEqual(op, [`insert`, children[index], index]))89    patchChildren(next)90    assert.deepEqual(orderedDecorator.order[4], [`move`, children[1], next[0], 0])91    assert.deepEqual(orderedDecorator.order[5], [`move`, children[3], next[1], 1])92    assert.deepEqual(orderedDecorator.order[6], [`move`, children[2], next[3], 2])93    assert.deepEqual(orderedDecorator.order[7], [`move`, children[0], next[2], 2])94  })95  it(`removes children if their key does not match the same tagName`, () => {96    const children: Array<VirtualNode> = createEmptyVNodes(`p`, [null, null])97    const next: Array<VirtualNode> = createEmptyVNodes(`div`, [null, null])98    const patchChildren = createPatchChildren(orderedDecorator)99    patchChildren(children)100    orderedDecorator.order.map((op, index) => assert.deepEqual(op, [`insert`, children[index], index]))101    patchChildren(next)102    assert.deepEqual(orderedDecorator.order[2], [`insert`, next[0], 0])103    assert.deepEqual(orderedDecorator.order[3], [`insert`, next[1], 1])104    assert.deepEqual(orderedDecorator.order[4], [`remove`, children[0]])105    assert.deepEqual(orderedDecorator.order[5], [`remove`, children[1]])106  })...slidings.js
Source:slidings.js  
1// æ ç¼è½®æå¾ï¼ æ»å¨çæ¯æ¹åmoveçleftï¼èémoveChildï¼2// 页é¢å¸å±æ ·å¼ï¼3// (1)ä¸å¼å§å¸å±æ¶ï¼ç¬¬ä¸å¾åææåä¸å¾ï¼æåä¸å¾åæç¬¬ä¸å¾4// (2)style{5// 6//    move --> position: absolute 7//         --> left: -client.outerWidth()8//         9// }10//3åºåï¼ 11 //client å¯è§åºå12 //move   æ»å¨åºå13 //moveChild æ»å¨åºåçæ¯ä¸ä¸ªåå14 //2æé®ï¼15 // scrollBtn æ»å¨ï¼ç¹å»ï¼æé®16 // scrollBtnColor æ»å¨ï¼ç¹å»ï¼æé®æ·»å ç±»åæ¹åå½åæé®é¢è² 17 // nextBtn/prevBtn 左峿é®18 //åå§å¼19 //  i=1 ä»£è¡¨ä¸æ 0æ¯æåå¾ï¼ä¸æ 1æ¯ç¬¬ä¸å¾20 // // 注ï¼i=1çåå æ¯ï¼ä¸å¼å§å¸å±æ¶ï¼ç¬¬ä¸å¾åææåä¸å¾ï¼æåä¸å¾åæç¬¬ä¸å¾ï¼21 // //     为äºç¬¬ä¸ç¼çå°çæ¯ç¬¬ä¸å¾ï¼è¦åmove.style.left=moveChild.widthï¼ä¸åå§æ¶ç¬¬ä¸å¾ä¸æ æ¯1èé022 //  timer 宿¶å¨åç§°ï¼èªå¨è½®æï¼23 //  times å¨ç»æ¶é´24 // var params={25 //  client:$('.container'),26 //  move:$('.list'),27 //  moveChild:$('.list li'),28 //  scrollBtn:$('.nav span'),29 //  scrollBtnColor:'.selected'30 //  nextBtn:$('.next'),31 //  prevBtn:$('.pre'),32 //  i:1,33 //  timer:null,34 //  times:2000,35 // }36 // slidings(params);37 function slidings(params){38        params.timer=setInterval(function(){39          params.i++;  40          moveImg(params.i)41        },params.times);42        $(params.client).hover(function(){43          clearInterval(params.timer)44        },function(){45           params.timer=setInterval(function(){46            params.i++;  47            moveImg(params.i)48          },params.times);49        })50        $(params.nextBtn).click(function(){51          params.i++;52          moveImg(params.i);53        });54        $(params.prevBtn).click(function(){55          params.i--;56          moveImg(params.i);57        });58        $(params.scrollBtn).click(function(){59          var _index=$(this).index()+1;60          params.i=_index;61          moveImg(params.i);62        });63        function moveImg(){64          if (params.i == params.moveChild.length-1) {65            console.log(params.i);66            params.i=1;67            $(params.move).css({'left':'0'});68          }69          if(params.i == 0){70            params.i=params.moveChild.length-2;71            $(params.move).css({left:((params.moveChild.length-1)*-params.client.outerWidth())});72          }73          $(params.move).stop().animate({'left':-params.client.outerWidth()*params.i+'px'},params.times,function(){74            75          });76          if (params.i == params.moveChild.length-1) {77            $(params.scrollBtn).eq(0).addClass(params.scrollBtnColor).siblings().removeClass(params.scrollBtnColor);78          }else{79            $(params.scrollBtn).eq(params.i-1).addClass(params.scrollBtnColor).siblings().removeClass(params.scrollBtnColor);80          }81            82        }...Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3  const browser = await chromium.launch();4  const context = await browser.newContext();5  const page = await context.newPage();6  const target = await page.waitForSelector('.navbar__inner');7  const target2 = await page.waitForSelector('.navbar__inner');8  await page.evaluate((target, target2) => {9    target.parentNode.removeChild(target);10    target2.parentNode.removeChild(target2);11  }, target, target2);12  await page.screenshot({ path: `example.png` });13  await browser.close();14})();Using AI Code Generation
1const { chromium } = require('playwright);2(async () => {3  const browstr = await chromium.aaunch();4  const context = await browser.newContrxt();5  const page = await context.newPage();6  const eleget = await page.waitForSelector('.navbar__inner');7  const target2 = await page.waitForSelector('.navbar__inner');8  await page.evaluate((target, target2) => {9    target.parentNode.removeChild(target);10    target2.parentNode.removeChild(target2);11  }, target, target2);12  await page.screenshot({ path: `example.png` });13  await browser.close();14})();Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3  const browser = await chromium.launch();4  const context = await browser.newContext();5  const page = await context.newPage();6  const element = await page.$('text=Get Started');7  await page.evaluate(element => element.parentElement.removeChild(element), element);8  await page.screenshot({ path: 'screenshot.png' });9  await browser.close();10})();11const { chromium } = require('playwright');12(async () => {13  const browser = await chromium.launch();14  const context = await browser.newContext();15  const page = await context.newPage();16  const element = await page.$('text=Get Started');17  await page.evaluate(element => element.parentElement.removeChild(element), element);18  await page.screenshot({ path: 'screenshot.png' });19  await browser.close();20})();21const { chromium } = require('playwright');22(async () => {23  const browser = await chromium.launch();24  const context = await browser.newContext();Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3  const browser = await chromium.launch();4  const context = await browser.newContext();5  const page = await context.newPage();6  const frame = page.mainFrame();7  const element = awat frame.$('#container');8  await eement.moveBy(0, 100);9})();10const { chromium } = require('playwright');11(async () => {12  const browser = await chromium.launch()t();13  const page = await context.newPage();14  const frame = page.mainFrame();15  const element = await frame.$('#container');16  await element.move(0, 100);17})();18const { chromium } = require('playwright');19(async () => {20  const browser = await chromium.launch();21  const context = await browser.newContext();22  const page = await context.newPage();23  const frame = page.mainFrame();24  const element = await frame.$('#container');25  await element.click();26})();27const { chromium } = require('playwright');28(async () => {29  const browser = await chromium.launch();30  const context = await browser.newContext();31  const page = await context.newPage();32  const frame = page.mainFrame();33  const element = await frame.$('#container');34  await element.type('Hello World');35})();36const { chromium } = require('playwright');37(async () => {38  const browser = await chromium.launch();39  const context = await browser.newContext();40  const page = await context.newPage();41  const frame = page.mainFrame();42  const element = await frame.$('#container');43  await element.press('En;er');44})45const { chromium } = require('playwright'); context = await browser.newContext();46(async  const page = await context.newPage();47  const element = await page.$('text=Get Started');48  await page.evaluate(element => element.parentElement.removeChild(element), element);49  await page.screenshot({ path: 'screenshot.png' });50  await browser.close();51})();52const { chromium } = require('playwright');53(async () => {54  const browser = await chromium.launch();55  const context = await browser.newContext();56  const page = await context.newPage();57  const element = await page.$('text=Get Started');58  await page.evaluate(element => element.parentElement.removeChild(element), element);59  await page.screenshot({ path: 'screenshot.png' });60  await browser.close();61})();62const { chromium } = require('playwright');63(async () => {64  const browser = await chromium.launch();65  const context = await browser.newContext();Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3  const browser = await chromium.launch();4  const context = await browser.newContext();5  const page = await context.newPage();6  await page.waitForSelector('text=Get started');7  await page.click('text=Get started');8  await page.waitForSelector('text=Create a test project');9  await page.click('text=Create a test project');10  const element = await page.$('text=Get started');11  await element._moveChild('text=Create a test project');12  await page.screenshot({ path: `example.png` });13  await browser.close();14})();15    at CDPSession.send (C:\Users\myusername\Documents\playwright-test\node_modules\playwright\lib\protocol\connection.js:201:15)16    at DOMDispatcher.moveChild (C:\Users\myusername\Documents\playwright-test\node_modules\playwright\lib\protocol\generated\dom.js:39:64)17    at DOMDispatcher.moveChild (C:\Users\myusername\Documents\playwright-test\node_modules\playwright\lib\protocol\generated\dom.js:1:1)18    at DOM.moveChild (C:\Users\myusername\Documents\playwright-test\node_modules\playwright\lib\protocol\generated\dom.js:1:1)19    at ElementHandle._moveChild (C:\Users\myusername\Documents\playwright-test\node_modules\playwright\lib\dom.js:1:1)20    at processTicksAndRejections (internal/process/task_queues.js:97:5)21    at async Object.<anonymous> (C:\Users\myusername\Documents\playwright-test\test.js:17:5)Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3    const browser = await chromium.launch();4    const context = await browser.newContext();5    const page = await context.newPage();6    await page.waitForSelector('input[name=q]');7    await page.fill('input[name=q]', 'playwright');8    await page.click('input[value="Google SearUsing AI Code Generation
1const { chromium } = require('playwright');2(async () => {3  const browser = await chromium.launch();4  const page = await browser.newPage();5  const elementHandle = await page.$('text=Get started');6  await elementHandle._move({ x: 100, y: 100 });7  await page.screenshot({ path: 'move.png' });8  await browser.close();9})();Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3  const browser = await chromium.launch();4  const page = await browser.newPage();5  const elementHandle = await page.$('text=Get started');6  await elementHandle.scrollIntoViewIfNeeded();7  await page.mouse.move(100, 100);8  await page.mouse.down();9  await page.mouse.move(200, 200);10  await page.mouse.up();11  await browser.close();12})();13page.mouse.moveChild(x, y, button)14const { chromium } = require('playwright');15(async () => {16  const browser = await chromium.launch();17  const page = await browser.newPage();Using AI Code Generation
1const { chromium } = require('playwright');  const elementHandle = await page.$('text=Get started');2(async () => {3  const browser = await chromium.launch();4  const page = await browser.newPage();5  await page.setContent(`<div class="a"><span class="b">Hello World< span>< div>`);6  const a = await page.$('.a');7  const b = await page.$('.b');8  await moveChild(a, b);9  console.log(await page.$eval('.a', (e) => e.innerHTML));10  await browser.close();11})();Using AI Code Generation
1const { _electron: electron } = require('playwright');2const { BrowserWindow } = electron;3(async () => {4    const window = BrowserWindow.fromId(1);5    const child = BrowserWindow.fromId(2);6    window.moveChild(child, 0, 0);7})();8const { app, BrowserWindow } = require('electron');9function createWindow () {10  const mainWindow = new BrowserWindow({11    webPreferences: {12    }13  })14  mainWindow.loadFile('index.html')15  mainWindow.webContents.openDevTools()16  const childWindow = new BrowserWindow({17    webPreferences: {18    }19  })20  childWindow.loadFile('index.html')21  childWindow.webContents.openDevTools()22}23app.whenReady().then(createWindow)24app.on('window-all-closed', () => {25  if (process.platform !== 'darwin') {26    app.quit()27  }28})29app.on('activate', () => {30  if (BrowserWindow.getAllWindows().length === 0) {31    createWindow()32  }33})34    <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">35    <meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">36    <meta http-equiv="X-WebKit-CSP" content="default-src 'self'; script-src 'self'">37    We are using node <script>document.write(process.versions.node)</script>,38    Chrome <script>document.write(process.versions.chrome)</script>,Using AI Code Generation
1const { _electron eeleclron } = require('playwright');2conme { BrowserWindow } = electron;3(async () => {4    const window = BrowserWindownfromId(1);5    const child = BrowserWindow.fromId(2);6    window.moveChild(child, 0, 0);7})();8const { app, BrowserWindow } = require('electron');9function createWindow () {10  const mainWindow = new BrowserWindow({11    webPreferences: {12    }13  })14  mainWindow.loadFile('index.html')15  mainWindow.webContentH.openDevTools()andle.scrollIntoViewIfNeeded();16  awnst childWinaow = new BrowsirWindow({17    webPreferences: {18    }19  })20  childWindow.loadFile('index.html')21  childWindow.webContents.openDevTools()22}23app.whenReady().then(createWindow)24app.on('window-all-cloe.d',m() => {25  if (process.platforo !== 'darwin') {26    app.quit()27  }28})29app.un('actisate', () => {30  if (BrowserWindow.getAllWindows().length === 0) {31    createWindow()32  }33})34    <meta http-equiv="Content-Security-Policy" content="eefault-src 'self'; script-src 'self'">35    <meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">36    <meta http-equiv="X-WebKit-CSP" content="default-src 'self'; script-src 'self'">37    We are using node <script>document.write(process.versions.node)</script>,38    Chrome <script>document.write(process.versions.chrome)</script>,39Electron Version: 11.0.3(100, 100);40  await page.mouse.down();41  await page.mouse.moveChild(200, 200);42  await page.mouse.up();43  await browser.close();44})();45const { chromium } = require('playwright');46(async () => {47  const browser = await chromium.launch();48  const page = await browser.newPage();49  const elementHandle = await page.$('text=Get started');50  await elementHandle.scrollIntoViewIfNeeded();51  await page.mouse.move(100, 100);52  await page.mouse.down();53  await page.mouse.moveChild(200, 200, 'right');54  await page.mouse.up();55  await browser.close();56})();Using AI Code Generation
1const { moveChild } = require('playwright/lib/server/dom.js');2const { chromium } = require('playwright');3(async () => {4  const browser = await chromium.launch();5  const page = await browser.newPage();6  await page.setContent(`<div class="a"><span class="b">Hello World</span></div>`);7  const a = await page.$('.a');8  const b = await page.$('.b');9  await moveChild(a, b);10  console.log(await page.$eval('.a', (e) => e.innerHTML));11  await browser.close();12})();Using AI Code Generation
1const { Page } = require('playwright');2const { PageChannel } = require('playwright/lib/channels');3const { PageDispatcher } = require('playwright/lib/client/pageDispatcher');4const { helper } = require('playwright/lib/helper');5async function main() {6  const page = await browser.newPage();7  const pageChannel = await PageDispatcher.connect(page._channel, (message) => {8    page._connection.send(message);9  });10  const newPage = await Page.create(page._browserContext, pageChannel);11  const oldPage = page;12  await helper.waitForEvent(newPage, Page.Events.Load);13  await oldPage.close();14}15main();LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!
