Esempio n. 1
0
		public CastExpression(ExpressionNode expression, Type targetType)
		{			
			_expression = expression;
			_typeReference = new TypeReference();
			_typeReference.TypeName = targetType.AssemblyQualifiedName;
			_typeReference.ResolvedType = targetType;
		}
Esempio n. 2
0
		public override AstElement Clone(Dictionary<AstElement, AstElement> alreadyClonedElements)
		{
			TypeReference result = new TypeReference();
			result.TypeName = _typeName;
			result.TypeNameSourceRange = _typeNameSourceRange;
			result.CaseSensitve = _caseSensitve;
			result.ResolvedType = _resolvedType;

			return result;
		}
Esempio n. 3
0
        private TypeReference ParseTypeReference()
        {
            TypeReference typeReference = new TypeReference();

            if (_token.Id == TokenId.String)
            {
                _rangeRecorder.Begin();
                typeReference.TypeName = ParseString();
                typeReference.TypeNameSourceRange = _rangeRecorder.End();
                typeReference.CaseSensitve = true;
            }
            else
            {
                _rangeRecorder.Begin();

                StringBuilder sb = new StringBuilder();
                bool wasVerbatim = false;
                while (_token.Id != TokenId.Eof)
                {
                    Identifier identifier = ParseIdentifier();

                    if (!identifier.Verbatim && !identifier.Parenthesized)
                    {
                        sb.Append(identifier.Text);
                    }
                    else
                    {
                        wasVerbatim = true;

                        // Include quotes and brackets for better error reporting.
                        sb.Append(identifier.ToString());
                    }

                    if (_token.Id != TokenId.Dot)
                        break;

                    sb.Append(".");
                    NextToken();
                }

                string typeName = sb.ToString();
                SourceRange typeNameSourceRange = _rangeRecorder.End();

                if (wasVerbatim)
                    _errorReporter.InvalidTypeReference(typeNameSourceRange, typeName);

                typeReference.TypeName = typeName;
                typeReference.TypeNameSourceRange = typeNameSourceRange;
                typeReference.CaseSensitve = false;
            }

            return typeReference;
        }
Esempio n. 4
0
		public CastExpression(ExpressionNode expression, TypeReference typeReference)
		{
			_expression = expression;
			_typeReference = typeReference;
		}