1
// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team
3
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4
// software and associated documentation files (the "Software"), to deal in the Software
5
// without restriction, including without limitation the rights to use, copy, modify, merge,
6
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7
// to whom the Software is furnished to do so, subject to the following conditions:
9
// The above copyright notice and this permission notice shall be included in all copies or
10
// substantial portions of the Software.
12
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17
// DEALINGS IN THE SOFTWARE.
20
using System.Collections.Generic;
21
using System.Collections.ObjectModel;
22
using System.Globalization;
24
using ICSharpCode.NRefactory.TypeSystem;
26
namespace ICSharpCode.NRefactory.Semantics
29
/// Represents an unknown member.
31
public class UnknownMemberResolveResult : ResolveResult
33
readonly IType targetType;
34
readonly string memberName;
35
readonly ReadOnlyCollection<IType> typeArguments;
37
public UnknownMemberResolveResult(IType targetType, string memberName, IEnumerable<IType> typeArguments)
38
: base(SpecialType.UnknownType)
40
if (targetType == null)
41
throw new ArgumentNullException("targetType");
42
this.targetType = targetType;
43
this.memberName = memberName;
44
this.typeArguments = new ReadOnlyCollection<IType>(typeArguments.ToArray());
48
/// The type on which the method is being called.
50
public IType TargetType {
51
get { return targetType; }
54
public string MemberName {
55
get { return memberName; }
58
public ReadOnlyCollection<IType> TypeArguments {
59
get { return typeArguments; }
62
public override bool IsError {
66
public override string ToString()
68
return string.Format(CultureInfo.InvariantCulture, "[{0} {1}.{2}]", GetType().Name, targetType, memberName);
73
/// Represents an unknown method.
75
public class UnknownMethodResolveResult : UnknownMemberResolveResult
77
readonly ReadOnlyCollection<IParameter> parameters;
79
public UnknownMethodResolveResult(IType targetType, string methodName, IEnumerable<IType> typeArguments, IEnumerable<IParameter> parameters)
80
: base(targetType, methodName, typeArguments)
82
this.parameters = new ReadOnlyCollection<IParameter>(parameters.ToArray());
85
public ReadOnlyCollection<IParameter> Parameters {
86
get { return parameters; }
91
/// Represents an unknown identifier.
93
public class UnknownIdentifierResolveResult : ResolveResult
95
readonly string identifier;
96
readonly int typeArgumentCount;
98
public UnknownIdentifierResolveResult(string identifier, int typeArgumentCount = 0)
99
: base(SpecialType.UnknownType)
101
this.identifier = identifier;
102
this.typeArgumentCount = typeArgumentCount;
105
public string Identifier {
106
get { return identifier; }
109
public int TypeArgumentCount {
110
get { return typeArgumentCount; }
113
public override bool IsError {
117
public override string ToString()
119
return string.Format(CultureInfo.InvariantCulture, "[{0} {1}]", GetType().Name, identifier);