Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../includes/handleba...
File: handlebars.js
_currentRules: function _currentRules() {
[2500] Fix | Delete
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
[2501] Fix | Delete
},
[2502] Fix | Delete
topState: function topState() {
[2503] Fix | Delete
return this.conditionStack[this.conditionStack.length - 2];
[2504] Fix | Delete
},
[2505] Fix | Delete
pushState: function begin(condition) {
[2506] Fix | Delete
this.begin(condition);
[2507] Fix | Delete
} };
[2508] Fix | Delete
lexer.options = {};
[2509] Fix | Delete
lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
[2510] Fix | Delete
[2511] Fix | Delete
function strip(start, end) {
[2512] Fix | Delete
return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start);
[2513] Fix | Delete
}
[2514] Fix | Delete
[2515] Fix | Delete
var YYSTATE = YY_START;
[2516] Fix | Delete
switch ($avoiding_name_collisions) {
[2517] Fix | Delete
case 0:
[2518] Fix | Delete
if (yy_.yytext.slice(-2) === "\\\\") {
[2519] Fix | Delete
strip(0, 1);
[2520] Fix | Delete
this.begin("mu");
[2521] Fix | Delete
} else if (yy_.yytext.slice(-1) === "\\") {
[2522] Fix | Delete
strip(0, 1);
[2523] Fix | Delete
this.begin("emu");
[2524] Fix | Delete
} else {
[2525] Fix | Delete
this.begin("mu");
[2526] Fix | Delete
}
[2527] Fix | Delete
if (yy_.yytext) return 15;
[2528] Fix | Delete
[2529] Fix | Delete
break;
[2530] Fix | Delete
case 1:
[2531] Fix | Delete
return 15;
[2532] Fix | Delete
break;
[2533] Fix | Delete
case 2:
[2534] Fix | Delete
this.popState();
[2535] Fix | Delete
return 15;
[2536] Fix | Delete
[2537] Fix | Delete
break;
[2538] Fix | Delete
case 3:
[2539] Fix | Delete
this.begin('raw');return 15;
[2540] Fix | Delete
break;
[2541] Fix | Delete
case 4:
[2542] Fix | Delete
this.popState();
[2543] Fix | Delete
// Should be using `this.topState()` below, but it currently
[2544] Fix | Delete
// returns the second top instead of the first top. Opened an
[2545] Fix | Delete
// issue about it at https://github.com/zaach/jison/issues/291
[2546] Fix | Delete
if (this.conditionStack[this.conditionStack.length - 1] === 'raw') {
[2547] Fix | Delete
return 15;
[2548] Fix | Delete
} else {
[2549] Fix | Delete
strip(5, 9);
[2550] Fix | Delete
return 'END_RAW_BLOCK';
[2551] Fix | Delete
}
[2552] Fix | Delete
[2553] Fix | Delete
break;
[2554] Fix | Delete
case 5:
[2555] Fix | Delete
return 15;
[2556] Fix | Delete
break;
[2557] Fix | Delete
case 6:
[2558] Fix | Delete
this.popState();
[2559] Fix | Delete
return 14;
[2560] Fix | Delete
[2561] Fix | Delete
break;
[2562] Fix | Delete
case 7:
[2563] Fix | Delete
return 65;
[2564] Fix | Delete
break;
[2565] Fix | Delete
case 8:
[2566] Fix | Delete
return 68;
[2567] Fix | Delete
break;
[2568] Fix | Delete
case 9:
[2569] Fix | Delete
return 19;
[2570] Fix | Delete
break;
[2571] Fix | Delete
case 10:
[2572] Fix | Delete
this.popState();
[2573] Fix | Delete
this.begin('raw');
[2574] Fix | Delete
return 23;
[2575] Fix | Delete
[2576] Fix | Delete
break;
[2577] Fix | Delete
case 11:
[2578] Fix | Delete
return 55;
[2579] Fix | Delete
break;
[2580] Fix | Delete
case 12:
[2581] Fix | Delete
return 60;
[2582] Fix | Delete
break;
[2583] Fix | Delete
case 13:
[2584] Fix | Delete
return 29;
[2585] Fix | Delete
break;
[2586] Fix | Delete
case 14:
[2587] Fix | Delete
return 47;
[2588] Fix | Delete
break;
[2589] Fix | Delete
case 15:
[2590] Fix | Delete
this.popState();return 44;
[2591] Fix | Delete
break;
[2592] Fix | Delete
case 16:
[2593] Fix | Delete
this.popState();return 44;
[2594] Fix | Delete
break;
[2595] Fix | Delete
case 17:
[2596] Fix | Delete
return 34;
[2597] Fix | Delete
break;
[2598] Fix | Delete
case 18:
[2599] Fix | Delete
return 39;
[2600] Fix | Delete
break;
[2601] Fix | Delete
case 19:
[2602] Fix | Delete
return 51;
[2603] Fix | Delete
break;
[2604] Fix | Delete
case 20:
[2605] Fix | Delete
return 48;
[2606] Fix | Delete
break;
[2607] Fix | Delete
case 21:
[2608] Fix | Delete
this.unput(yy_.yytext);
[2609] Fix | Delete
this.popState();
[2610] Fix | Delete
this.begin('com');
[2611] Fix | Delete
[2612] Fix | Delete
break;
[2613] Fix | Delete
case 22:
[2614] Fix | Delete
this.popState();
[2615] Fix | Delete
return 14;
[2616] Fix | Delete
[2617] Fix | Delete
break;
[2618] Fix | Delete
case 23:
[2619] Fix | Delete
return 48;
[2620] Fix | Delete
break;
[2621] Fix | Delete
case 24:
[2622] Fix | Delete
return 73;
[2623] Fix | Delete
break;
[2624] Fix | Delete
case 25:
[2625] Fix | Delete
return 72;
[2626] Fix | Delete
break;
[2627] Fix | Delete
case 26:
[2628] Fix | Delete
return 72;
[2629] Fix | Delete
break;
[2630] Fix | Delete
case 27:
[2631] Fix | Delete
return 87;
[2632] Fix | Delete
break;
[2633] Fix | Delete
case 28:
[2634] Fix | Delete
// ignore whitespace
[2635] Fix | Delete
break;
[2636] Fix | Delete
case 29:
[2637] Fix | Delete
this.popState();return 54;
[2638] Fix | Delete
break;
[2639] Fix | Delete
case 30:
[2640] Fix | Delete
this.popState();return 33;
[2641] Fix | Delete
break;
[2642] Fix | Delete
case 31:
[2643] Fix | Delete
yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80;
[2644] Fix | Delete
break;
[2645] Fix | Delete
case 32:
[2646] Fix | Delete
yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80;
[2647] Fix | Delete
break;
[2648] Fix | Delete
case 33:
[2649] Fix | Delete
return 85;
[2650] Fix | Delete
break;
[2651] Fix | Delete
case 34:
[2652] Fix | Delete
return 82;
[2653] Fix | Delete
break;
[2654] Fix | Delete
case 35:
[2655] Fix | Delete
return 82;
[2656] Fix | Delete
break;
[2657] Fix | Delete
case 36:
[2658] Fix | Delete
return 83;
[2659] Fix | Delete
break;
[2660] Fix | Delete
case 37:
[2661] Fix | Delete
return 84;
[2662] Fix | Delete
break;
[2663] Fix | Delete
case 38:
[2664] Fix | Delete
return 81;
[2665] Fix | Delete
break;
[2666] Fix | Delete
case 39:
[2667] Fix | Delete
return 75;
[2668] Fix | Delete
break;
[2669] Fix | Delete
case 40:
[2670] Fix | Delete
return 77;
[2671] Fix | Delete
break;
[2672] Fix | Delete
case 41:
[2673] Fix | Delete
return 72;
[2674] Fix | Delete
break;
[2675] Fix | Delete
case 42:
[2676] Fix | Delete
yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72;
[2677] Fix | Delete
break;
[2678] Fix | Delete
case 43:
[2679] Fix | Delete
return 'INVALID';
[2680] Fix | Delete
break;
[2681] Fix | Delete
case 44:
[2682] Fix | Delete
return 5;
[2683] Fix | Delete
break;
[2684] Fix | Delete
}
[2685] Fix | Delete
};
[2686] Fix | Delete
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
[2687] Fix | Delete
lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } };
[2688] Fix | Delete
return lexer;
[2689] Fix | Delete
})();
[2690] Fix | Delete
parser.lexer = lexer;
[2691] Fix | Delete
function Parser() {
[2692] Fix | Delete
this.yy = {};
[2693] Fix | Delete
}Parser.prototype = parser;parser.Parser = Parser;
[2694] Fix | Delete
return new Parser();
[2695] Fix | Delete
})();exports["default"] = handlebars;
[2696] Fix | Delete
module.exports = exports["default"];
[2697] Fix | Delete
[2698] Fix | Delete
/***/ }),
[2699] Fix | Delete
/* 48 */
[2700] Fix | Delete
/***/ (function(module, exports, __webpack_require__) {
[2701] Fix | Delete
[2702] Fix | Delete
'use strict';
[2703] Fix | Delete
[2704] Fix | Delete
var _interopRequireDefault = __webpack_require__(1)['default'];
[2705] Fix | Delete
[2706] Fix | Delete
exports.__esModule = true;
[2707] Fix | Delete
[2708] Fix | Delete
var _visitor = __webpack_require__(49);
[2709] Fix | Delete
[2710] Fix | Delete
var _visitor2 = _interopRequireDefault(_visitor);
[2711] Fix | Delete
[2712] Fix | Delete
function WhitespaceControl() {
[2713] Fix | Delete
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
[2714] Fix | Delete
[2715] Fix | Delete
this.options = options;
[2716] Fix | Delete
}
[2717] Fix | Delete
WhitespaceControl.prototype = new _visitor2['default']();
[2718] Fix | Delete
[2719] Fix | Delete
WhitespaceControl.prototype.Program = function (program) {
[2720] Fix | Delete
var doStandalone = !this.options.ignoreStandalone;
[2721] Fix | Delete
[2722] Fix | Delete
var isRoot = !this.isRootSeen;
[2723] Fix | Delete
this.isRootSeen = true;
[2724] Fix | Delete
[2725] Fix | Delete
var body = program.body;
[2726] Fix | Delete
for (var i = 0, l = body.length; i < l; i++) {
[2727] Fix | Delete
var current = body[i],
[2728] Fix | Delete
strip = this.accept(current);
[2729] Fix | Delete
[2730] Fix | Delete
if (!strip) {
[2731] Fix | Delete
continue;
[2732] Fix | Delete
}
[2733] Fix | Delete
[2734] Fix | Delete
var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
[2735] Fix | Delete
_isNextWhitespace = isNextWhitespace(body, i, isRoot),
[2736] Fix | Delete
openStandalone = strip.openStandalone && _isPrevWhitespace,
[2737] Fix | Delete
closeStandalone = strip.closeStandalone && _isNextWhitespace,
[2738] Fix | Delete
inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
[2739] Fix | Delete
[2740] Fix | Delete
if (strip.close) {
[2741] Fix | Delete
omitRight(body, i, true);
[2742] Fix | Delete
}
[2743] Fix | Delete
if (strip.open) {
[2744] Fix | Delete
omitLeft(body, i, true);
[2745] Fix | Delete
}
[2746] Fix | Delete
[2747] Fix | Delete
if (doStandalone && inlineStandalone) {
[2748] Fix | Delete
omitRight(body, i);
[2749] Fix | Delete
[2750] Fix | Delete
if (omitLeft(body, i)) {
[2751] Fix | Delete
// If we are on a standalone node, save the indent info for partials
[2752] Fix | Delete
if (current.type === 'PartialStatement') {
[2753] Fix | Delete
// Pull out the whitespace from the final line
[2754] Fix | Delete
current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1];
[2755] Fix | Delete
}
[2756] Fix | Delete
}
[2757] Fix | Delete
}
[2758] Fix | Delete
if (doStandalone && openStandalone) {
[2759] Fix | Delete
omitRight((current.program || current.inverse).body);
[2760] Fix | Delete
[2761] Fix | Delete
// Strip out the previous content node if it's whitespace only
[2762] Fix | Delete
omitLeft(body, i);
[2763] Fix | Delete
}
[2764] Fix | Delete
if (doStandalone && closeStandalone) {
[2765] Fix | Delete
// Always strip the next node
[2766] Fix | Delete
omitRight(body, i);
[2767] Fix | Delete
[2768] Fix | Delete
omitLeft((current.inverse || current.program).body);
[2769] Fix | Delete
}
[2770] Fix | Delete
}
[2771] Fix | Delete
[2772] Fix | Delete
return program;
[2773] Fix | Delete
};
[2774] Fix | Delete
[2775] Fix | Delete
WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) {
[2776] Fix | Delete
this.accept(block.program);
[2777] Fix | Delete
this.accept(block.inverse);
[2778] Fix | Delete
[2779] Fix | Delete
// Find the inverse program that is involed with whitespace stripping.
[2780] Fix | Delete
var program = block.program || block.inverse,
[2781] Fix | Delete
inverse = block.program && block.inverse,
[2782] Fix | Delete
firstInverse = inverse,
[2783] Fix | Delete
lastInverse = inverse;
[2784] Fix | Delete
[2785] Fix | Delete
if (inverse && inverse.chained) {
[2786] Fix | Delete
firstInverse = inverse.body[0].program;
[2787] Fix | Delete
[2788] Fix | Delete
// Walk the inverse chain to find the last inverse that is actually in the chain.
[2789] Fix | Delete
while (lastInverse.chained) {
[2790] Fix | Delete
lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
[2791] Fix | Delete
}
[2792] Fix | Delete
}
[2793] Fix | Delete
[2794] Fix | Delete
var strip = {
[2795] Fix | Delete
open: block.openStrip.open,
[2796] Fix | Delete
close: block.closeStrip.close,
[2797] Fix | Delete
[2798] Fix | Delete
// Determine the standalone candiacy. Basically flag our content as being possibly standalone
[2799] Fix | Delete
// so our parent can determine if we actually are standalone
[2800] Fix | Delete
openStandalone: isNextWhitespace(program.body),
[2801] Fix | Delete
closeStandalone: isPrevWhitespace((firstInverse || program).body)
[2802] Fix | Delete
};
[2803] Fix | Delete
[2804] Fix | Delete
if (block.openStrip.close) {
[2805] Fix | Delete
omitRight(program.body, null, true);
[2806] Fix | Delete
}
[2807] Fix | Delete
[2808] Fix | Delete
if (inverse) {
[2809] Fix | Delete
var inverseStrip = block.inverseStrip;
[2810] Fix | Delete
[2811] Fix | Delete
if (inverseStrip.open) {
[2812] Fix | Delete
omitLeft(program.body, null, true);
[2813] Fix | Delete
}
[2814] Fix | Delete
[2815] Fix | Delete
if (inverseStrip.close) {
[2816] Fix | Delete
omitRight(firstInverse.body, null, true);
[2817] Fix | Delete
}
[2818] Fix | Delete
if (block.closeStrip.open) {
[2819] Fix | Delete
omitLeft(lastInverse.body, null, true);
[2820] Fix | Delete
}
[2821] Fix | Delete
[2822] Fix | Delete
// Find standalone else statments
[2823] Fix | Delete
if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) {
[2824] Fix | Delete
omitLeft(program.body);
[2825] Fix | Delete
omitRight(firstInverse.body);
[2826] Fix | Delete
}
[2827] Fix | Delete
} else if (block.closeStrip.open) {
[2828] Fix | Delete
omitLeft(program.body, null, true);
[2829] Fix | Delete
}
[2830] Fix | Delete
[2831] Fix | Delete
return strip;
[2832] Fix | Delete
};
[2833] Fix | Delete
[2834] Fix | Delete
WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) {
[2835] Fix | Delete
return mustache.strip;
[2836] Fix | Delete
};
[2837] Fix | Delete
[2838] Fix | Delete
WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) {
[2839] Fix | Delete
/* istanbul ignore next */
[2840] Fix | Delete
var strip = node.strip || {};
[2841] Fix | Delete
return {
[2842] Fix | Delete
inlineStandalone: true,
[2843] Fix | Delete
open: strip.open,
[2844] Fix | Delete
close: strip.close
[2845] Fix | Delete
};
[2846] Fix | Delete
};
[2847] Fix | Delete
[2848] Fix | Delete
function isPrevWhitespace(body, i, isRoot) {
[2849] Fix | Delete
if (i === undefined) {
[2850] Fix | Delete
i = body.length;
[2851] Fix | Delete
}
[2852] Fix | Delete
[2853] Fix | Delete
// Nodes that end with newlines are considered whitespace (but are special
[2854] Fix | Delete
// cased for strip operations)
[2855] Fix | Delete
var prev = body[i - 1],
[2856] Fix | Delete
sibling = body[i - 2];
[2857] Fix | Delete
if (!prev) {
[2858] Fix | Delete
return isRoot;
[2859] Fix | Delete
}
[2860] Fix | Delete
[2861] Fix | Delete
if (prev.type === 'ContentStatement') {
[2862] Fix | Delete
return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original);
[2863] Fix | Delete
}
[2864] Fix | Delete
}
[2865] Fix | Delete
function isNextWhitespace(body, i, isRoot) {
[2866] Fix | Delete
if (i === undefined) {
[2867] Fix | Delete
i = -1;
[2868] Fix | Delete
}
[2869] Fix | Delete
[2870] Fix | Delete
var next = body[i + 1],
[2871] Fix | Delete
sibling = body[i + 2];
[2872] Fix | Delete
if (!next) {
[2873] Fix | Delete
return isRoot;
[2874] Fix | Delete
}
[2875] Fix | Delete
[2876] Fix | Delete
if (next.type === 'ContentStatement') {
[2877] Fix | Delete
return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original);
[2878] Fix | Delete
}
[2879] Fix | Delete
}
[2880] Fix | Delete
[2881] Fix | Delete
// Marks the node to the right of the position as omitted.
[2882] Fix | Delete
// I.e. {{foo}}' ' will mark the ' ' node as omitted.
[2883] Fix | Delete
//
[2884] Fix | Delete
// If i is undefined, then the first child will be marked as such.
[2885] Fix | Delete
//
[2886] Fix | Delete
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
[2887] Fix | Delete
// content is met.
[2888] Fix | Delete
function omitRight(body, i, multiple) {
[2889] Fix | Delete
var current = body[i == null ? 0 : i + 1];
[2890] Fix | Delete
if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) {
[2891] Fix | Delete
return;
[2892] Fix | Delete
}
[2893] Fix | Delete
[2894] Fix | Delete
var original = current.value;
[2895] Fix | Delete
current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, '');
[2896] Fix | Delete
current.rightStripped = current.value !== original;
[2897] Fix | Delete
}
[2898] Fix | Delete
[2899] Fix | Delete
// Marks the node to the left of the position as omitted.
[2900] Fix | Delete
// I.e. ' '{{foo}} will mark the ' ' node as omitted.
[2901] Fix | Delete
//
[2902] Fix | Delete
// If i is undefined then the last child will be marked as such.
[2903] Fix | Delete
//
[2904] Fix | Delete
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
[2905] Fix | Delete
// content is met.
[2906] Fix | Delete
function omitLeft(body, i, multiple) {
[2907] Fix | Delete
var current = body[i == null ? body.length - 1 : i - 1];
[2908] Fix | Delete
if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) {
[2909] Fix | Delete
return;
[2910] Fix | Delete
}
[2911] Fix | Delete
[2912] Fix | Delete
// We omit the last node if it's whitespace only and not preceded by a non-content node.
[2913] Fix | Delete
var original = current.value;
[2914] Fix | Delete
current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, '');
[2915] Fix | Delete
current.leftStripped = current.value !== original;
[2916] Fix | Delete
return current.leftStripped;
[2917] Fix | Delete
}
[2918] Fix | Delete
[2919] Fix | Delete
exports['default'] = WhitespaceControl;
[2920] Fix | Delete
module.exports = exports['default'];
[2921] Fix | Delete
[2922] Fix | Delete
/***/ }),
[2923] Fix | Delete
/* 49 */
[2924] Fix | Delete
/***/ (function(module, exports, __webpack_require__) {
[2925] Fix | Delete
[2926] Fix | Delete
'use strict';
[2927] Fix | Delete
[2928] Fix | Delete
var _interopRequireDefault = __webpack_require__(1)['default'];
[2929] Fix | Delete
[2930] Fix | Delete
exports.__esModule = true;
[2931] Fix | Delete
[2932] Fix | Delete
var _exception = __webpack_require__(6);
[2933] Fix | Delete
[2934] Fix | Delete
var _exception2 = _interopRequireDefault(_exception);
[2935] Fix | Delete
[2936] Fix | Delete
function Visitor() {
[2937] Fix | Delete
this.parents = [];
[2938] Fix | Delete
}
[2939] Fix | Delete
[2940] Fix | Delete
Visitor.prototype = {
[2941] Fix | Delete
constructor: Visitor,
[2942] Fix | Delete
mutating: false,
[2943] Fix | Delete
[2944] Fix | Delete
// Visits a given value. If mutating, will replace the value if necessary.
[2945] Fix | Delete
acceptKey: function acceptKey(node, name) {
[2946] Fix | Delete
var value = this.accept(node[name]);
[2947] Fix | Delete
if (this.mutating) {
[2948] Fix | Delete
// Hacky sanity check: This may have a few false positives for type for the helper
[2949] Fix | Delete
// methods but will generally do the right thing without a lot of overhead.
[2950] Fix | Delete
if (value && !Visitor.prototype[value.type]) {
[2951] Fix | Delete
throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
[2952] Fix | Delete
}
[2953] Fix | Delete
node[name] = value;
[2954] Fix | Delete
}
[2955] Fix | Delete
},
[2956] Fix | Delete
[2957] Fix | Delete
// Performs an accept operation with added sanity check to ensure
[2958] Fix | Delete
// required keys are not removed.
[2959] Fix | Delete
acceptRequired: function acceptRequired(node, name) {
[2960] Fix | Delete
this.acceptKey(node, name);
[2961] Fix | Delete
[2962] Fix | Delete
if (!node[name]) {
[2963] Fix | Delete
throw new _exception2['default'](node.type + ' requires ' + name);
[2964] Fix | Delete
}
[2965] Fix | Delete
},
[2966] Fix | Delete
[2967] Fix | Delete
// Traverses a given array. If mutating, empty respnses will be removed
[2968] Fix | Delete
// for child elements.
[2969] Fix | Delete
acceptArray: function acceptArray(array) {
[2970] Fix | Delete
for (var i = 0, l = array.length; i < l; i++) {
[2971] Fix | Delete
this.acceptKey(array, i);
[2972] Fix | Delete
[2973] Fix | Delete
if (!array[i]) {
[2974] Fix | Delete
array.splice(i, 1);
[2975] Fix | Delete
i--;
[2976] Fix | Delete
l--;
[2977] Fix | Delete
}
[2978] Fix | Delete
}
[2979] Fix | Delete
},
[2980] Fix | Delete
[2981] Fix | Delete
accept: function accept(object) {
[2982] Fix | Delete
if (!object) {
[2983] Fix | Delete
return;
[2984] Fix | Delete
}
[2985] Fix | Delete
[2986] Fix | Delete
/* istanbul ignore next: Sanity code */
[2987] Fix | Delete
if (!this[object.type]) {
[2988] Fix | Delete
throw new _exception2['default']('Unknown type: ' + object.type, object);
[2989] Fix | Delete
}
[2990] Fix | Delete
[2991] Fix | Delete
if (this.current) {
[2992] Fix | Delete
this.parents.unshift(this.current);
[2993] Fix | Delete
}
[2994] Fix | Delete
this.current = object;
[2995] Fix | Delete
[2996] Fix | Delete
var ret = this[object.type](object);
[2997] Fix | Delete
[2998] Fix | Delete
this.current = this.parents.shift();
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function