<commit_before>(function (TankJS, undefined)
{

TankJS.GameObject = function(id)
{
  // Name of the game object
  this.name = "GameObject " + id;

  // ID of the game object
  this.id = id;

  // Map of components by component name
  this._components = {};

  // Map of components by component tag
  this._taggedComponents = {};
}

TankJS.GameObject.prototype.remove = function()
{
  TankJS.removeObject(this.id);
}

TankJS.GameObject.prototype.addComponent = function(componentName)
{
  // Check if we have this component already
  if (this.getComponent(componentName))
    return;

  // Get the component definition object
  var componentDef = TankJS._components[componentName];

  // Temporarily add a fake component just to mark this one as added
  // for the upcoming recursive calls
  this._components[componentName] = "Placeholder";

  // Add all the included components
  for (var i in componentDef._includes)
  {
    this.addComponent(componentDef._includes[i]);
  }

  // Clone the component into our list of components
  var c = componentDef.clone();
  this._components[componentName] = c;

  // Track this component by its tags
  for (var i in componentDef._tags)
  {
    // Get the list of components with this tag
    var componentList = TankJS._taggedComponents[componentDef._tags[i]];
    var componentListLocal = this._taggedComponents[componentDef._tags[i]];
    if (!componentList)<commit_msg>Added some error checking<commit_after>(function (TankJS, undefined)
{

TankJS.GameObject = function(id)
{
  // Name of the game object
  this.name = "GameObject " + id;

  // ID of the game object
  this.id = id;

  // Map of components by component name
  this._components = {};

  // Map of components by component tag
  this._taggedComponents = {};
}

TankJS.GameObject.prototype.remove = function()
{
  TankJS.removeObject(this.id);
}

TankJS.GameObject.prototype.addComponent = function(componentName)
{
  // Check if we have this component already
  if (this.getComponent(componentName))
    return this;

  // Get the component definition object
  var componentDef = TankJS._components[componentName];
  if (!componentDef)
  {
    console.log("GameObject.addComponent: No component registered with name " + componentName);
    return this;
  }

  // Temporarily add a fake component just to mark this one as added
  // for the upcoming recursive calls
  this._components[componentName] = "Placeholder";

  // Add all the included components
  for (var i in componentDef._includes)
  {
    this.addComponent(componentDef._includes[i]);
  }

  // Clone the component into our list of components
  var c = componentDef.clone();
  this._components[componentName] = c;

  // Track this component by its tags
  for (var i in componentDef._tags)
  {
    // Get the list of components with this tag
    var componentList = TankJS._taggedComponents[componentDef._tags[i]];
    var componentListLocal = this._taggedComponents[componentDef._tags[i]];
    if (!componentList)
{'fraction_non_alphanumeric': 0.09889373114314448, 'fraction_numerical': 0.0, 'mean_word_length': 3.677115987460815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '60657', 'n_tokens_mistral': 875, 'n_tokens_neox': 841, 'n_words': 268}