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; }
public string Hash(DMASTObjectVarDefinition vardef) { return($"OVD-{vardef.ObjectPath}-{vardef.Name}"); }
public void VisitObjectVarDefinition(DMASTObjectVarDefinition objectVarDefinition) { SimplifyExpression(ref objectVarDefinition.Value); }
public void Travel(DMASTObjectVarDefinition vardef) { VisitDefine(vardef); }