反向调用表达式返回值

时间:2019-03-01 09:10:40

标签: node.js estraverse

我正在Node中与Estraverse合作。
我有这个对象:

Node {
  type: 'MemberExpression',
  start: 9934,
  end: 9968,
  loc:
   SourceLocation {
     start: Position { line: 240, column: 24 },
     end: Position { line: 240, column: 58 } },
  range: [ 9934, 9968 ],
  object:
   Node {
     type: 'Identifier',
     start: 9934,
     end: 9943,
     loc: SourceLocation { start: [Position], end: [Position] },
     range: [ 9934, 9943 ],
     name: '_0x2a8e20' },
  property:
   Node {
     type: 'CallExpression',
     start: 9944,
     end: 9967,
     loc: SourceLocation { start: [Position], end: [Position] },
     range: [ 9944, 9967 ],
     callee:
      Node {
        type: 'Identifier',
        start: 9944,
        end: 9951,
        loc: [SourceLocation],
        range: [Array],
        name: '_0x1707' },
     arguments: [ [Node], [Node] ] },
  computed: true }

obj.property.arguments 是:

[ Node {
    type: 'Literal',
    start: 9952,
    end: 9958,
    loc: SourceLocation { start: [Position], end: [Position] },
    range: [ 9952, 9958 ],
    value: '0x15',
    raw: "'0x15'" },
  Node {
    type: 'Literal',
    start: 9960,
    end: 9966,
    loc: SourceLocation { start: [Position], end: [Position] },
    range: [ 9960, 9966 ],
    value: 'hjrs',
    raw: "'hjrs'" } ]

那么我该如何使用参数“执行” CallExpression,然后将其替换为以Literal返回的值?我在代码变量中有目标代码。

0 个答案:

没有答案