structure.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // expressions
  2. module.exports = {
  3. scopes: {
  4. Program: ['body'],
  5. EmptyStatement: [],
  6. BlockStatement: ['body'],
  7. ExpressionStatement: ['expression'],
  8. IfStatement: ['test', 'consequent', 'alternate'],
  9. LabeledStatement: ['body'],
  10. BreakStatement: [],
  11. ContinueStatement: [],
  12. WithStatement: ['body'], // this is a really evil part of javascript....
  13. SwitchStatement: ['discriminant', 'cases'],
  14. ReturnStatement: ['argument'],
  15. ThrowStatement: ['argument'],
  16. TryStatement: ['block', 'handlers', 'finalizer'],
  17. WhileStatement: ['test', 'body'],
  18. DoWhileStatement: ['body', 'test'],
  19. ForStatement: ['init', 'test', 'update', 'body'],
  20. ForInStatement: ['left', 'right', 'body'],
  21. DebugggerStatement: [],
  22. FunctionDeclaration: [], // don't recurse into declarations
  23. VariableDeclaration: ['declarations'],
  24. VariableDeclarator: ['init'],
  25. ThisExpression: [],
  26. ArrayExpression: ['elements'],
  27. ObjectExpression: ['properties'],
  28. ObjectProperty: ['value'],
  29. FunctionExpression: [], // don't recurse into declarations
  30. SequenceExpression: ['expressions'],
  31. UnaryExpression: ['argument'],
  32. BinaryExpression: ['left', 'right'],
  33. AssignmentExpression: ['left', 'right'],
  34. UpdateExpression: ['argument'],
  35. LogicalExpression: ['left', 'right'],
  36. ConditionalExpression: ['test', 'consequent', 'alternate'],
  37. NewExpression: ['callee', 'arguments'],
  38. CallExpression: ['callee', 'arguments'],
  39. MemberExpression: ['object', 'property'],
  40. SwitchCase: ['test', 'consequent'],
  41. CatchClause: ['body'],
  42. Identifier: [],
  43. Literal: [],
  44. },
  45. all: {
  46. Program: ['body'],
  47. EmptyStatement: [],
  48. BlockStatement: ['body'],
  49. ExpressionStatement: ['expression'],
  50. IfStatement: ['test', 'consequent', 'alternate'],
  51. LabeledStatement: ['body'],
  52. BreakStatement: [],
  53. ContinueStatement: [],
  54. WithStatement: ['body'], // this is a really evil part of javascript....
  55. SwitchStatement: ['discriminant', 'cases'],
  56. ReturnStatement: ['argument'],
  57. ThrowStatement: ['argument'],
  58. TryStatement: ['block', 'handlers', 'finalizer'],
  59. WhileStatement: ['test', 'body'],
  60. DoWhileStatement: ['body', 'test'],
  61. ForStatement: ['init', 'test', 'update', 'body'],
  62. ForInStatement: ['left', 'right', 'body'],
  63. DebugggerStatement: [],
  64. FunctionDeclaration: ['body'],
  65. VariableDeclaration: ['declarations'],
  66. VariableDeclarator: ['init'],
  67. ThisExpression: [],
  68. ArrayExpression: ['elements'],
  69. ObjectExpression: ['properties'],
  70. ObjectProperty: ['value'],
  71. FunctionExpression: ['body'],
  72. SequenceExpression: ['expressions'],
  73. UnaryExpression: ['argument'],
  74. BinaryExpression: ['left', 'right'],
  75. AssignmentExpression: ['left', 'right'],
  76. UpdateExpression: ['argument'],
  77. LogicalExpression: ['left', 'right'],
  78. ConditionalExpression: ['test', 'consequent', 'alternate'],
  79. NewExpression: ['callee', 'arguments'],
  80. CallExpression: ['callee', 'arguments'],
  81. MemberExpression: ['object', 'property'],
  82. SwitchCase: ['test', 'consequent'],
  83. CatchClause: ['body'],
  84. Identifier: [],
  85. Literal: [],
  86. }
  87. };