/// <summary> /// Initialize <see cref="VariableInfo" /> object from variable declaration. /// </summary> /// <param name="declaration">The declaration.</param> /// <param name="declaredType">Type of the declared.</param> /// <param name="info">The information.</param> /// <exception cref="System.NotSupportedException">Cannot create non implicit declaration without type</exception> internal VariableInfo(INodeAST declaration, TypeDescriptor declaredType, CompilationInfo info) { _info = info; Declaration = declaration; Name = declaration.Arguments[1].Value; //TODO chained type names, namespace resolvings,.. IsImplicitlyTyped = declaration.Arguments[0].Value == CSharpSyntax.ImplicitVariableType; Type = declaredType; if (!IsImplicitlyTyped && Type == null) { throw new NotSupportedException("Cannot create non implicit declaration without type"); } }
/// <summary> /// Initialize <see cref="VariableInfo" /> object from name of method argument. /// <remarks>Declaration node is not available for method arguments</remarks>. /// </summary> /// <param name="argumentName">Name of argument defining current variable.</param> /// <param name="info">Compilation context where created variable is defined.</param> internal VariableInfo(string argumentName, CompilationInfo info) { _info = info; Name = argumentName; }