(name, opts)
| 2819 | return i; |
| 2820 | } |
| 2821 | function addlabel(name, opts) { |
| 2822 | opts = opts || {}; |
| 2823 | |
| 2824 | var type = opts.type; |
| 2825 | var token = opts.token; |
| 2826 | var islet = opts.islet; |
| 2827 | if (type === "exception") { |
| 2828 | if (_.has(funct["(context)"], name)) { |
| 2829 | if (funct[name] !== true && !state.option.node) { |
| 2830 | warning("W002", state.tokens.next, name); |
| 2831 | } |
| 2832 | } |
| 2833 | } |
| 2834 | |
| 2835 | if (_.has(funct, name) && !funct["(global)"]) { |
| 2836 | if (funct[name] === true) { |
| 2837 | if (state.option.latedef) { |
| 2838 | if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) || |
| 2839 | !_.contains([funct[name], type], "unction")) { |
| 2840 | warning("W003", state.tokens.next, name); |
| 2841 | } |
| 2842 | } |
| 2843 | } else { |
| 2844 | if ((!state.option.shadow || _.contains([ "inner", "outer" ], state.option.shadow)) && |
| 2845 | type !== "exception" || funct["(blockscope)"].getlabel(name)) { |
| 2846 | warning("W004", state.tokens.next, name); |
| 2847 | } |
| 2848 | } |
| 2849 | } |
| 2850 | |
| 2851 | if (funct["(context)"] && _.has(funct["(context)"], name) && type !== "function") { |
| 2852 | if (state.option.shadow === "outer") { |
| 2853 | warning("W123", state.tokens.next, name); |
| 2854 | } |
| 2855 | } |
| 2856 | if (islet) { |
| 2857 | funct["(blockscope)"].current.add(name, type, state.tokens.curr); |
| 2858 | if (funct["(blockscope)"].atTop() && exported[name]) { |
| 2859 | state.tokens.curr.exported = true; |
| 2860 | } |
| 2861 | } else { |
| 2862 | funct["(blockscope)"].shadow(name); |
| 2863 | funct[name] = type; |
| 2864 | |
| 2865 | if (token) { |
| 2866 | funct["(tokens)"][name] = token; |
| 2867 | } |
| 2868 | |
| 2869 | setprop(funct, name, { unused: opts.unused || false }); |
| 2870 | |
| 2871 | if (funct["(global)"]) { |
| 2872 | global[name] = funct; |
| 2873 | if (_.has(implied, name)) { |
| 2874 | if (state.option.latedef) { |
| 2875 | if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) || |
| 2876 | !_.contains([funct[name], type], "unction")) { |
| 2877 | warning("W003", state.tokens.next, name); |
| 2878 | } |
no test coverage detected