public ProgramRegister(string name, string typeName, IEnumerable <ProgramRegister> childRegisters = null, bool isArray = false, int arrayDimension = 0, string arrayType = null, GeneroLanguageVersion minimumBdlVersion = GeneroLanguageVersion.None, GeneroLanguageVersion maximumBdlVersion = GeneroLanguageVersion.Latest) { _parentRegister = null; _name = name; _typeName = typeName; _minBdlVersion = minimumBdlVersion; _maxBdlVersion = maximumBdlVersion; _isArray = isArray; _arrayDimension = arrayDimension; if (arrayType != null) { _arrayType = new VariableTypeResult { Typename = arrayType }; } _childRegisters = new Dictionary <string, ProgramRegister>(StringComparer.OrdinalIgnoreCase); if (childRegisters != null) { foreach (var reg in childRegisters) { reg._parentRegister = this; _childRegisters.Add(reg._name, reg); } } }
public virtual ITypeResult GetGeneroType() { var varType = new VariableTypeResult { IsArray = this.IsArray, IsRecord = this.IsRecord, Typename = this.Name, ArrayDimension = this.ArrayDimension }; if (Children.Count == 1 && Children[Children.Keys[0]] is ArrayTypeReference) { varType.ArrayType = (Children[Children.Keys[0]] as ArrayTypeReference).GetGeneroType(); } else if (Children.Count == 1 && Children[Children.Keys[0]] is RecordDefinitionNode) { varType.RecordMemberTypes = (Children[Children.Keys[0]] as RecordDefinitionNode).GetMemberTypes(); } else if (ResolvedType != null && ResolvedType is IVariableResult) { varType.UnderlyingType = (ResolvedType as IVariableResult).GetGeneroType(); } return(varType); }