(name, opts)
| 2668 | return i; |
| 2669 | } |
| 2670 | function addlabel(name, opts) { |
| 2671 | opts = opts || {}; |
| 2672 | |
| 2673 | var type = opts.type; |
| 2674 | var token = opts.token; |
| 2675 | var islet = opts.islet; |
| 2676 | if (type === "exception") { |
| 2677 | if (_.has(funct["(context)"], name)) { |
| 2678 | if (funct[name] !== true && !state.option.node) { |
| 2679 | warning("W002", state.tokens.next, name); |
| 2680 | } |
| 2681 | } |
| 2682 | } |
| 2683 | |
| 2684 | if (_.has(funct, name) && !funct["(global)"]) { |
| 2685 | if (funct[name] === true) { |
| 2686 | if (state.option.latedef) { |
| 2687 | if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) || |
| 2688 | !_.contains([funct[name], type], "unction")) { |
| 2689 | warning("W003", state.tokens.next, name); |
| 2690 | } |
| 2691 | } |
| 2692 | } else { |
| 2693 | if ((!state.option.shadow || _.contains([ "inner", "outer" ], state.option.shadow)) && |
| 2694 | type !== "exception" || funct["(blockscope)"].getlabel(name)) { |
| 2695 | warning("W004", state.tokens.next, name); |
| 2696 | } |
| 2697 | } |
| 2698 | } |
| 2699 | |
| 2700 | if (funct["(context)"] && _.has(funct["(context)"], name) && type !== "function") { |
| 2701 | if (state.option.shadow === "outer") { |
| 2702 | warning("W123", state.tokens.next, name); |
| 2703 | } |
| 2704 | } |
| 2705 | if (islet) { |
| 2706 | funct["(blockscope)"].current.add(name, type, state.tokens.curr); |
| 2707 | if (funct["(blockscope)"].atTop() && exported[name]) { |
| 2708 | state.tokens.curr.exported = true; |
| 2709 | } |
| 2710 | } else { |
| 2711 | funct["(blockscope)"].shadow(name); |
| 2712 | funct[name] = type; |
| 2713 | |
| 2714 | if (token) { |
| 2715 | funct["(tokens)"][name] = token; |
| 2716 | } |
| 2717 | |
| 2718 | setprop(funct, name, { unused: opts.unused || false }); |
| 2719 | |
| 2720 | if (funct["(global)"]) { |
| 2721 | global[name] = funct; |
| 2722 | if (_.has(implied, name)) { |
| 2723 | if (state.option.latedef) { |
| 2724 | if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) || |
| 2725 | !_.contains([funct[name], type], "unction")) { |
| 2726 | warning("W003", state.tokens.next, name); |
| 2727 | } |
no test coverage detected