<commit_before>"use strict";

var Base = require('./index.js')
var define = Object.defineProperty
var proto = Base.prototype

define( proto, '$setKeyInternal', {
  value:function( key, value, field ) {
    if(field) {
      if(field._$parent !== this) {
        this[key] = new field.$Constructor( value, this )
      } else {
        field.$set( value )
      }
    } else {
      this[key] = new this.$children.$Constructor( value, this )
      this[key]._$key = key 

      //adds 3% extra slowness (purely for the check)
      //try to remove constructor when instance is created and check if a normal if(!) is faster
      if(this.hasOwnProperty( '_$Constructor' )) {
        //this can be optimized
        this.$createContextGetter.call(this, key)
      }

    }
  }
})

define( proto, '$setKey', {
  value:function( key, value ) {
    var privateField = '_'+key
    var field = this[ privateField ]
    if(field) {
      this.$setKeyInternal( privateField, value, field )
    } else {
      this.$setKeyInternal( key, value, this[key] ) 
      // when is this[key] defined but not this[privateField] ?
    } 
  }
})

define( proto, '$createContextGetter', {
  value:function( key$ ) {
    var field = this['_'+key$] = this[key$]

    for( var key$$ in field ) {
      if(key$$[0]!=='_' && !field['_'+key$$]) {
        field.$createContextGetter( key$$ )
      }
    }

    define( this, key$, {
      get:function() {
        var privateKey = '_'+key$
        var field = this[privateKey]<commit_msg>privateKey<commit_after>"use strict";

var Base = require('./index.js')
var define = Object.defineProperty
var proto = Base.prototype

define( proto, '$setKeyInternal', {
  value:function( key, value, field ) {
    if(field) {
      if(field._$parent !== this) {
        this[key] = new field.$Constructor( value, this )
      } else {
        field.$set( value )
      }
    } else {
      this[key] = new this.$children.$Constructor( value, this )
      this[key]._$key = key 

      //adds 3% extra slowness (purely for the check)
      //try to remove constructor when instance is created and check if a normal if(!) is faster
      if(this.hasOwnProperty( '_$Constructor' )) {
        //this can be optimized
        this.$createContextGetter.call(this, key)
      }

    }
  }
})

define( proto, '$setKey', {
  value:function( key, value ) {
    var privateKey = '_'+key
    var field = this[ privateKey ]
    if(field) {
      this.$setKeyInternal( privateKey, value, field )
    } else {
      this.$setKeyInternal( key, value, this[key] ) 
      // when is this[key] defined but not this[privateKey] ?
    } 
  }
})

window.callcnt1 = 0
window.callcnt2 = 0

define( proto, '$createContextGetter', {
  value:function( key$ ) {
    window.callcnt1++
    var field = this['_'+key$] = this[key$]

    for( var key$$ in field ) {
      if(key$$[0]!=='_' && !field['_'+key$$]) {
        field.$createContextGetter( key$$ )
      }
    }

    define( this, key$, {
      get:function() {
        window.callcnt2++
        var privateKey = '_'+key$
        var field = this[privateKey]
{'fraction_non_alphanumeric': 0.15190691661279895, 'fraction_numerical': 0.003232062055591467, 'mean_word_length': 2.5411899313501145, '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': '1734245', 'n_tokens_mistral': 998, 'n_tokens_neox': 983, 'n_words': 259}