Example #1
0
        public void ProcessVarDefinition(DMASTObjectVarDefinition varDefinition)
        {
            DMObject   oldObject = _currentObject;
            DMVariable variable;

            _currentObject = DMObjectTree.GetDMObject(varDefinition.ObjectPath);

            if (varDefinition.IsGlobal)
            {
                variable = _currentObject.CreateGlobalVariable(varDefinition.Type, varDefinition.Name, varDefinition.IsConst);
            }
            else
            {
                variable = new DMVariable(varDefinition.Type, varDefinition.Name, false, varDefinition.IsConst);
                _currentObject.Variables[variable.Name] = variable;
            }

            try {
                SetVariableValue(variable, varDefinition.Value, varDefinition.ValType);
            } catch (CompileErrorException e) {
                DMCompiler.Error(e.Error);
            }

            _currentObject = oldObject;
        }
Example #2
0
 public string Hash(DMASTObjectVarDefinition vardef)
 {
     return($"OVD-{vardef.ObjectPath}-{vardef.Name}");
 }
Example #3
0
 public void VisitObjectVarDefinition(DMASTObjectVarDefinition objectVarDefinition)
 {
     SimplifyExpression(ref objectVarDefinition.Value);
 }
Example #4
0
 public void Travel(DMASTObjectVarDefinition vardef)
 {
     VisitDefine(vardef);
 }