/// <summary> /// Defines a variable with name and type. /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <returns></returns> public IVariableDeclaration DefineVariable(string name, Type value) { var normalizedName = ScopeExtensions.NormalizeVariableName(name); var variable = variables[normalizedName] = new VariableDeclaration(name, value); if (normalizedName == ScopeExtensions.NormalizeVariableName(ScopeExtensions.ThisName)) { thisMembers.Clear(); var cqlType = TypeSystem.GetTypeByNative(GetValueType(variable.Value)); foreach (var property in cqlType.Members) { thisMembers.Add(ScopeExtensions.NormalizeVariableName(property.Name), new VariableDeclaration(property.Name, GetPropertyValue(value, property))); } } return(variable); }