BVB Source Codes

reactide Show expressions.js Source code

Return Download reactide: download expressions.js Source code - Download reactide Source code - Type:.js
  1. "use strict";
  2.  
  3. exports.__esModule = true;
  4. exports.LogicalExpression = exports.BinaryExpression = exports.AwaitExpression = exports.YieldExpression = undefined;
  5. exports.UnaryExpression = UnaryExpression;
  6. exports.DoExpression = DoExpression;
  7. exports.ParenthesizedExpression = ParenthesizedExpression;
  8. exports.UpdateExpression = UpdateExpression;
  9. exports.ConditionalExpression = ConditionalExpression;
  10. exports.NewExpression = NewExpression;
  11. exports.SequenceExpression = SequenceExpression;
  12. exports.ThisExpression = ThisExpression;
  13. exports.Super = Super;
  14. exports.Decorator = Decorator;
  15. exports.CallExpression = CallExpression;
  16. exports.Import = Import;
  17. exports.EmptyStatement = EmptyStatement;
  18. exports.ExpressionStatement = ExpressionStatement;
  19. exports.AssignmentPattern = AssignmentPattern;
  20. exports.AssignmentExpression = AssignmentExpression;
  21. exports.BindExpression = BindExpression;
  22. exports.MemberExpression = MemberExpression;
  23. exports.MetaProperty = MetaProperty;
  24.  
  25. var _babelTypes = require("babel-types");
  26.  
  27. var t = _interopRequireWildcard(_babelTypes);
  28.  
  29. var _node = require("../node");
  30.  
  31. var n = _interopRequireWildcard(_node);
  32.  
  33. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  34.  
  35. function UnaryExpression(node) {
  36.   if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof") {
  37.     this.word(node.operator);
  38.     this.space();
  39.   } else {
  40.     this.token(node.operator);
  41.   }
  42.  
  43.   this.print(node.argument, node);
  44. }
  45.  
  46. function DoExpression(node) {
  47.   this.word("do");
  48.   this.space();
  49.   this.print(node.body, node);
  50. }
  51.  
  52. function ParenthesizedExpression(node) {
  53.   this.token("(");
  54.   this.print(node.expression, node);
  55.   this.token(")");
  56. }
  57.  
  58. function UpdateExpression(node) {
  59.   if (node.prefix) {
  60.     this.token(node.operator);
  61.     this.print(node.argument, node);
  62.   } else {
  63.     this.print(node.argument, node);
  64.     this.token(node.operator);
  65.   }
  66. }
  67.  
  68. function ConditionalExpression(node) {
  69.   this.print(node.test, node);
  70.   this.space();
  71.   this.token("?");
  72.   this.space();
  73.   this.print(node.consequent, node);
  74.   this.space();
  75.   this.token(":");
  76.   this.space();
  77.   this.print(node.alternate, node);
  78. }
  79.  
  80. function NewExpression(node, parent) {
  81.   this.word("new");
  82.   this.space();
  83.   this.print(node.callee, node);
  84.   if (node.arguments.length === 0 && this.format.minified && !t.isCallExpression(parent, { callee: node }) && !t.isMemberExpression(parent) && !t.isNewExpression(parent)) return;
  85.  
  86.   this.token("(");
  87.   this.printList(node.arguments, node);
  88.   this.token(")");
  89. }
  90.  
  91. function SequenceExpression(node) {
  92.   this.printList(node.expressions, node);
  93. }
  94.  
  95. function ThisExpression() {
  96.   this.word("this");
  97. }
  98.  
  99. function Super() {
  100.   this.word("super");
  101. }
  102.  
  103. function Decorator(node) {
  104.   this.token("@");
  105.   this.print(node.expression, node);
  106.   this.newline();
  107. }
  108.  
  109. function commaSeparatorNewline() {
  110.   this.token(",");
  111.   this.newline();
  112.  
  113.   if (!this.endsWith("\n")) this.space();
  114. }
  115.  
  116. function CallExpression(node) {
  117.   this.print(node.callee, node);
  118.  
  119.   this.token("(");
  120.  
  121.   var isPrettyCall = node._prettyCall;
  122.  
  123.   var separator = void 0;
  124.   if (isPrettyCall) {
  125.     separator = commaSeparatorNewline;
  126.     this.newline();
  127.     this.indent();
  128.   }
  129.  
  130.   this.printList(node.arguments, node, { separator: separator });
  131.  
  132.   if (isPrettyCall) {
  133.     this.newline();
  134.     this.dedent();
  135.   }
  136.  
  137.   this.token(")");
  138. }
  139.  
  140. function Import() {
  141.   this.word("import");
  142. }
  143.  
  144. function buildYieldAwait(keyword) {
  145.   return function (node) {
  146.     this.word(keyword);
  147.  
  148.     if (node.delegate) {
  149.       this.token("*");
  150.     }
  151.  
  152.     if (node.argument) {
  153.       this.space();
  154.       var terminatorState = this.startTerminatorless();
  155.       this.print(node.argument, node);
  156.       this.endTerminatorless(terminatorState);
  157.     }
  158.   };
  159. }
  160.  
  161. var YieldExpression = exports.YieldExpression = buildYieldAwait("yield");
  162. var AwaitExpression = exports.AwaitExpression = buildYieldAwait("await");
  163.  
  164. function EmptyStatement() {
  165.   this.semicolon(true);
  166. }
  167.  
  168. function ExpressionStatement(node) {
  169.   this.print(node.expression, node);
  170.   this.semicolon();
  171. }
  172.  
  173. function AssignmentPattern(node) {
  174.   this.print(node.left, node);
  175.   if (node.left.optional) this.token("?");
  176.   this.print(node.left.typeAnnotation, node);
  177.   this.space();
  178.   this.token("=");
  179.   this.space();
  180.   this.print(node.right, node);
  181. }
  182.  
  183. function AssignmentExpression(node, parent) {
  184.   var parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent);
  185.  
  186.   if (parens) {
  187.     this.token("(");
  188.   }
  189.  
  190.   this.print(node.left, node);
  191.  
  192.   this.space();
  193.   if (node.operator === "in" || node.operator === "instanceof") {
  194.     this.word(node.operator);
  195.   } else {
  196.     this.token(node.operator);
  197.   }
  198.   this.space();
  199.  
  200.   this.print(node.right, node);
  201.  
  202.   if (parens) {
  203.     this.token(")");
  204.   }
  205. }
  206.  
  207. function BindExpression(node) {
  208.   this.print(node.object, node);
  209.   this.token("::");
  210.   this.print(node.callee, node);
  211. }
  212.  
  213. exports.BinaryExpression = AssignmentExpression;
  214. exports.LogicalExpression = AssignmentExpression;
  215. function MemberExpression(node) {
  216.   this.print(node.object, node);
  217.  
  218.   if (!node.computed && t.isMemberExpression(node.property)) {
  219.     throw new TypeError("Got a MemberExpression for MemberExpression property");
  220.   }
  221.  
  222.   var computed = node.computed;
  223.   if (t.isLiteral(node.property) && typeof node.property.value === "number") {
  224.     computed = true;
  225.   }
  226.  
  227.   if (computed) {
  228.     this.token("[");
  229.     this.print(node.property, node);
  230.     this.token("]");
  231.   } else {
  232.     this.token(".");
  233.     this.print(node.property, node);
  234.   }
  235. }
  236.  
  237. function MetaProperty(node) {
  238.   this.print(node.meta, node);
  239.   this.token(".");
  240.   this.print(node.property, node);
  241. }
downloadexpressions.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top