function DescribeChangeTree(old_code_tree) {

    function ProcessOldNode(node) {
      var child_infos = [];
      for (var i = 0; i < node.children.length; i++) {
        var child = node.children[i];
        if (child.status != FunctionStatus.UNCHANGED) {
          child_infos.push(ProcessOldNode(child));
        }
      }
      var new_child_infos = [];
      if (node.textually_unmatched_new_nodes) {
        for (var i = 0; i < node.textually_unmatched_new_nodes.length; i++) {
          var child = node.textually_unmatched_new_nodes[i];
          new_child_infos.push(ProcessNewNode(child));
        }
      }
      var res = {
        name: node.info.function_name,
        positions: DescribePositions(node),
        status: node.status,
        children: child_infos,
        new_children: new_child_infos
      };
      if (node.status_explanation) {
        res.status_explanation = node.status_explanation;
      }
      if (node.textual_corresponding_node) {
        res.new_positions = DescribePositions(node.textual_corresponding_node);
      }
      return res;
    }

    function ProcessNewNode(node) {
      var child_infos = [];
      // Do not list ancestors.
      if (false) {
        for (var i = 0; i < node.children.length; i++) {
          child_infos.push(ProcessNewNode(node.children[i]));
        }
      }
      var res = {
        name: node.info.function_name,
        positions: DescribePositions(node),
        children: child_infos,
      };
      return res;
    }

    function DescribePositions(node) {
      return {
        start_position: node.info.start_position,
        end_position: node.info.end_position
      };
    }

    return ProcessOldNode(old_code_tree);
  }
function DescribeChangeTree(old_code_tree) {

    function ProcessOldNode(node) {
      var child_infos = [];
      for (var i = 0; i < node.children.length; i++) {
        var child = node.children[i];
        if (child.status != FunctionStatus.UNCHANGED) {
          child_infos.push(ProcessOldNode(child));
        }
      }
      var new_child_infos = [];
      if (node.textually_unmatched_new_nodes) {
        for (var i = 0; i < node.textually_unmatched_new_nodes.length; i++) {
          var child = node.textually_unmatched_new_nodes[i];
          new_child_infos.push(ProcessNewNode(child));
        }
      }
      var res = {
        name: node.info.function_name,
        positions: DescribePositions(node),
        status: node.status,
        children: child_infos,
        new_children: new_child_infos
      };
      if (node.status_explanation) {
        res.status_explanation = node.status_explanation;
      }
      if (node.textual_corresponding_node) {
        res.new_positions = DescribePositions(node.textual_corresponding_node);
      }
      return res;
    }

    function ProcessNewNode(node) {
      var child_infos = [];
      
      if (false) {
        for (var i = 0; i < node.children.length; i++) {
          child_infos.push(ProcessNewNode(node.children[i]));
        }
      }
      var res = {
        name: node.info.function_name,
        positions: DescribePositions(node),
        children: child_infos,
      };
      return res;
    }

    function DescribePositions(node) {
      return {
        start_position: node.info.start_position,
        end_position: node.info.end_position
      };
    }

    return ProcessOldNode(old_code_tree);
  }
function DescribeChangeTree ( old_code_tree ) { function ProcessOldNode ( node ) { var child_infos = [ ] ; for ( var i = 0 ; i < node . children . length ; i ++ ) { var child = node . children [ i ] ; if ( child . status != FunctionStatus . UNCHANGED ) { child_infos . push ( ProcessOldNode ( child ) ) ; } } var new_child_infos = [ ] ; if ( node . textually_unmatched_new_nodes ) { for ( var i = 0 ; i < node . textually_unmatched_new_nodes . length ; i ++ ) { var child = node . textually_unmatched_new_nodes [ i ] ; new_child_infos . push ( ProcessNewNode ( child ) ) ; } } var res = { name : node . info . function_name , positions : DescribePositions ( node ) , status : node . status , children : child_infos , new_children : new_child_infos } ; if ( node . status_explanation ) { res . status_explanation = node . status_explanation ; } if ( node . textual_corresponding_node ) { res . new_positions = DescribePositions ( node . textual_corresponding_node ) ; } return res ; } function ProcessNewNode ( node ) { var child_infos = [ ] ; // Do not list ancestors. if ( false ) { for ( var i = 0 ; i < node . children . length ; i ++ ) { child_infos . push ( ProcessNewNode ( node . children [ i ] ) ) ; } } var res = { name : node . info . function_name , positions : DescribePositions ( node ) , children : child_infos , } ; return res ; } function DescribePositions ( node ) { return { start_position : node . info . start_position , end_position : node . info . end_position } ; } return ProcessOldNode ( old_code_tree ) ; }
Creates JSON description for a change tree.
Creates JSON description for a change tree .