-
Notifications
You must be signed in to change notification settings - Fork 0
/
variablescontainer.js
2 lines (2 loc) · 2.89 KB
/
variablescontainer.js
1
2
var gdjs;(function(t){const n=class{constructor(r){this._variablesArray=[];this._variables=new Hashtable,r!==void 0&&this.initFrom(r)}initFrom(r,e){e===void 0&&(e=!1),e||(n._deletedVars=n._deletedVars||[],this._variables.keys(n._deletedVars));const i=this;let a=0;for(let l=0;l<r.length;++l){const s=r[l];if(!s.name)continue;const u=i.get(s.name);if(u.reinitialize(s),!e){a<i._variablesArray.length?i._variablesArray[a]=u:i._variablesArray.push(u),++a;const d=n._deletedVars.indexOf(s.name);d!==-1&&(n._deletedVars[d]=void 0)}}if(!e){this._variablesArray.length=a;for(let l=0,s=n._deletedVars.length;l<s;++l){const u=n._deletedVars[l];u!==void 0&&this._variables.get(u).setUndefinedInContainer()}}}add(r,e){const i=this._variables.get(r);if(this._variables.put(r,e),i){const a=this._variablesArray.indexOf(i);a!==-1&&(this._variablesArray[a]=e)}}remove(r){const e=this._variables.get(r);e&&e.setUndefinedInContainer()}get(r){let e=this._variables.get(r);return e?e.isUndefinedInContainer()&&e.reinitialize():(e=new t.Variable,this._variables.put(r,e)),e}getFromIndex(r){if(r>=this._variablesArray.length){let e=new t.Variable;return this._variables.put("",e),e}else{let e=this._variablesArray[r];return e.isUndefinedInContainer()&&e.reinitialize(),e}}has(r){const e=this._variables.get(r);return e&&!e.isUndefinedInContainer()}};let o=n;o._deletedVars=[],o.badVariablesContainer={_variables:new Hashtable,_variablesArray:[],has:function(){return!1},getFromIndex:function(){return n.badVariable},get:function(){return n.badVariable},remove:function(){},add:function(){},initFrom:function(){}},o.badVariable={_type:"number",_bool:!1,_children:{},_childrenArray:[],_str:"",_undefinedInContainer:!0,_value:0,fromJSON:()=>t.VariablesContainer.badVariable,toJSObject:()=>0,fromJSObject:()=>t.VariablesContainer.badVariable,reinitialize:()=>{},addChild:()=>t.VariablesContainer.badVariable,castTo:()=>{},clearChildren:()=>{},clone:()=>t.VariablesContainer.badVariable,getChildrenCount:()=>0,replaceChildren:()=>{},replaceChildrenArray:()=>{},getType:function(){return"number"},isPrimitive:function(){return!0},setValue:()=>{},getValue:()=>0,getChild:()=>t.VariablesContainer.badVariable,getChildAt:()=>t.VariablesContainer.badVariable,hasChild:function(){return!1},isStructure:function(){return!1},isNumber:function(){return!0},removeChild:function(){},setNumber:function(){},setString:function(){},setBoolean:function(){},getAsString:function(){return"0"},getAsNumber:function(){return 0},getAsBoolean:function(){return!1},getAllChildren:function(){return{}},getAllChildrenArray:function(){return[]},pushVariableCopy:()=>{},pushValue:()=>{},removeAtIndex:function(){},add:function(){},sub:function(){},mul:function(){},div:function(){},concatenate:function(){},concatenateString:function(){},setUndefinedInContainer:function(){},isUndefinedInContainer:function(){return!0}},t.VariablesContainer=o})(gdjs||(gdjs={}));
//# sourceMappingURL=variablescontainer.js.map