Commits

Christian Krebs  committed 038642e

And even more incorporated review feedback.

  • Participants
  • Parent commits 9aca5ca

Comments (0)

Files changed (1)

File templates/js/get_message_maps.js

 };
 
 window.cls.ScopeInterfaceGenerator._pretty_print_object = 
-function(name, obj, indent, print_list, circular_check_list)
+function(name, obj, level, print_list, circular_check_list)
 {
   circular_check_list = circular_check_list && circular_check_list.slice(0) || [];
   const
     2: "Response",
     3: "Event",
   };
-  print_list.push(this._get_indent_string(indent) + this._quote(name, ': ') + '{');
-  indent++;
+  print_list.push(this._get_indent_string(level) + this._quote(name, ': ') + '{');
+  level++;
   for (var key in obj)
   {
     if (typeof obj[key] == 'string' || typeof obj[key] == 'number')
     {
       if (key == 'type' && /^\d+$/.test(obj[key]))
-        print_list.push(this._get_indent_string(indent) + 
+        print_list.push(this._get_indent_string(level) + 
             this._quote(key) + ': "' + TYPE[obj[key]] + '", // ' + obj[key]);
       else
-        print_list.push(this._get_indent_string(indent) + 
+        print_list.push(this._get_indent_string(level) + 
             this._quote(key) + ': ' + this._quote(obj[key]) +',');
     }
   }
   for (key in obj)
   {
     if (Object.prototype.toString.call(obj[key]) == '[object Object]')
-      this._pretty_print_object(key, obj[key], indent, print_list, circular_check_list || []);
+      this._pretty_print_object(key, obj[key], level, print_list, circular_check_list || []);
   }
   for (key in obj)
   {
       {
         if (circular_check_list.indexOf(obj.message_name) != -1)
         {
-          print_list.push(this._get_indent_string(indent) + '"message": <circular reference>,');
+          print_list.push(this._get_indent_string(level) + '"message": <circular reference>,');
           continue;
         }
         else
           circular_check_list.push(obj.message_name);
       }
-      if (indent == 3)
-        print_list.push(this._get_indent_string(indent) + '// ' + MSG_TYPE[key]);
+      if (level == 3)
+        print_list.push(this._get_indent_string(level) + '// ' + MSG_TYPE[key]);
       if (obj[key].length)
       {
-        print_list.push(this._get_indent_string(indent) + this._quote(key) + ': [');
+        print_list.push(this._get_indent_string(level) + this._quote(key) + ': [');
         for (var i = 0; i < obj[key].length; i++)
-          this._pretty_print_object('', obj[key][i], indent + 1, print_list, circular_check_list);
-        print_list.push(this._get_indent_string(indent) + '],');
+          this._pretty_print_object('', obj[key][i], level + 1, print_list, circular_check_list);
+        print_list.push(this._get_indent_string(level) + '],');
       }
       else
-        print_list.push(this._get_indent_string(indent) + this._quote(key) + ': [],');
+        print_list.push(this._get_indent_string(level) + this._quote(key) + ': [],');
     }
   }
-  indent--;
-  print_list.push(this._get_indent_string(indent) + '},');
+  level--;
+  print_list.push(this._get_indent_string(level) + '},');
   return print_list;
 };