DebugProtectionFunctionCallNode.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. "use strict";
  2. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
  3. var _createClass = function () {
  4. function defineProperties(target, props) {
  5. for (var i = 0; i < props.length; i++) {
  6. var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
  7. }
  8. }return function (Constructor, protoProps, staticProps) {
  9. if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
  10. };
  11. }();
  12. function _classCallCheck(instance, Constructor) {
  13. if (!(instance instanceof Constructor)) {
  14. throw new TypeError("Cannot call a class as a function");
  15. }
  16. }
  17. function _possibleConstructorReturn(self, call) {
  18. if (!self) {
  19. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  20. }return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
  21. }
  22. function _inherits(subClass, superClass) {
  23. if (typeof superClass !== "function" && superClass !== null) {
  24. throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass)));
  25. }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  26. }
  27. var NodeType_1 = require("../../enums/NodeType");
  28. var Node_1 = require('../Node');
  29. var NodeUtils_1 = require("../../NodeUtils");
  30. var DebugProtectionFunctionCallNode = function (_Node_1$Node) {
  31. _inherits(DebugProtectionFunctionCallNode, _Node_1$Node);
  32. function DebugProtectionFunctionCallNode(debugProtectionFunctionName) {
  33. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  34. _classCallCheck(this, DebugProtectionFunctionCallNode);
  35. var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionCallNode).call(this, options));
  36. _this.debugProtectionFunctionName = debugProtectionFunctionName;
  37. _this.node = _this.getNodeStructure();
  38. return _this;
  39. }
  40. _createClass(DebugProtectionFunctionCallNode, [{
  41. key: "appendNode",
  42. value: function appendNode(blockScopeNode) {
  43. NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
  44. }
  45. }, {
  46. key: "getNodeStructure",
  47. value: function getNodeStructure() {
  48. return {
  49. 'type': NodeType_1.NodeType.ExpressionStatement,
  50. 'expression': {
  51. 'type': NodeType_1.NodeType.CallExpression,
  52. 'callee': {
  53. 'type': NodeType_1.NodeType.Identifier,
  54. 'name': this.debugProtectionFunctionName
  55. },
  56. 'arguments': []
  57. }
  58. };
  59. }
  60. }]);
  61. return DebugProtectionFunctionCallNode;
  62. }(Node_1.Node);
  63. exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;