public override void CollectDataFromChildren() { VariablesNames = new List <string>(); ConstOnly = true; var numberNode = FindFirstChildNodeByType <NumberNode>(); var stringLiteralNode = FindFirstChildNodeByType <StringLiteralNode>(); var idNod = FindFirstChildNodeByType <IdNode>(); _childOperator = FindFirstChildNodeByType <OperatorNode>(); if (numberNode != null) { switch (numberNode.NumberType) { case NumberType.Double: Value = numberNode.NumberDouble; break; case NumberType.Int: Value = numberNode.NumberInt; break; } ; IsCompressed = true; } if (stringLiteralNode != null) { Value = stringLiteralNode.StringLiteral; IsCompressed = true; } if (idNod != null) { _variableName = idNod.Id.ToString(); VariablesNames.Add(_variableName.ToString()); ConstOnly = false; IsCompressed = true; AddVariableBorder(_variableName, new VariableBorder()); } if (_childOperator != null) { IsCompressed = _childOperator.IsCompressed; if (IsCompressed) { foreach (var variableBorder in _childOperator.VariablesBorder) { AddVariableBorder(variableBorder.Key, (VariableBorder)variableBorder.Value.Clone()); } } ConstOnly = _childOperator.ConstOnly; GetAllValuesNamesFromNode(_childOperator); } }
protected void GetAllValuesNamesFromNode(OperatorNode expNode) { var names = new HashSet <string>(); foreach (var variable in expNode.VariablesNames) { if (!names.TryGetValue(variable, out _)) { VariablesNames.Add(variable); names.Add(variable); } } }