本文整理汇总了C#中ResolveResult类的典型用法代码示例。如果您正苦于以下问题:C# ResolveResult类的具体用法?C# ResolveResult怎么用?C# ResolveResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResolveResult类属于命名空间,在下文中一共展示了ResolveResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveConstructor
public IMethod ResolveConstructor(ITypeResolveContext context)
{
CSharpResolver r = new CSharpResolver(context);
IType type = attributeType.Resolve(context);
int totalArgumentCount = 0;
if (positionalArguments != null)
totalArgumentCount += positionalArguments.Count;
if (namedCtorArguments != null)
totalArgumentCount += namedCtorArguments.Count;
ResolveResult[] arguments = new ResolveResult[totalArgumentCount];
string[] argumentNames = new string[totalArgumentCount];
int i = 0;
if (positionalArguments != null) {
while (i < positionalArguments.Count) {
IConstantValue cv = positionalArguments[i];
arguments[i] = cv.Resolve(context);
i++;
}
}
if (namedCtorArguments != null) {
foreach (var pair in namedCtorArguments) {
argumentNames[i] = pair.Key;
arguments[i] = pair.Value.Resolve(context);
i++;
}
}
MemberResolveResult mrr = r.ResolveObjectCreation(type, arguments, argumentNames) as MemberResolveResult;
return mrr != null ? mrr.Member as IMethod : null;
}
示例2: GetArgumentsForCall
public override IList<ResolveResult> GetArgumentsForCall()
{
ResolveResult[] results = new ResolveResult[Member.Parameters.Count];
List<ResolveResult> paramsArguments = IsExpandedForm ? new List<ResolveResult>() : null;
// map arguments to parameters:
for (int i = 0; i < Arguments.Count; i++) {
int mappedTo;
if (argumentToParameterMap != null)
mappedTo = argumentToParameterMap[i];
else
mappedTo = IsExpandedForm ? Math.Min(i, results.Length - 1) : i;
if (mappedTo >= 0 && mappedTo < results.Length) {
if (IsExpandedForm && mappedTo == results.Length - 1)
paramsArguments.Add(Arguments[i]);
else
results[mappedTo] = Arguments[i];
}
}
if (IsExpandedForm)
results[results.Length - 1] = new ArrayCreateResolveResult(Member.Parameters.Last().Type, null, paramsArguments.ToArray());
for (int i = 0; i < results.Length; i++) {
if (results[i] == null) {
if (Member.Parameters[i].IsOptional) {
results[i] = new ConstantResolveResult(Member.Parameters[i].Type, Member.Parameters[i].ConstantValue);
} else {
results[i] = ErrorResolveResult.UnknownError;
}
}
}
return results;
}
示例3: ToolTipData
public ToolTipData (ICSharpCode.NRefactory.CSharp.SyntaxTree unit, ICSharpCode.NRefactory.Semantics.ResolveResult result, ICSharpCode.NRefactory.CSharp.AstNode node, CSharpAstResolver file)
{
this.Unit = unit;
this.Result = result;
this.Node = node;
this.Resolver = file;
}
示例4: ConversionResolveResult
public ConversionResolveResult(IType targetType, ResolveResult input, Conversion conversion)
: base(targetType)
{
if (input == null)
throw new ArgumentNullException("input");
this.Input = input;
this.Conversion = conversion;
}
示例5: UnaryOperatorResolveResult
public UnaryOperatorResolveResult(IType resultType, UnaryOperatorType op, ResolveResult input)
: base(resultType)
{
if (input == null)
throw new ArgumentNullException("input");
this.Operator = op;
this.Input = input;
}
示例6: ProcessConversion
public void ProcessConversion(Expression expression, ResolveResult result, Conversion conversion, IType targetType)
{
if (!nodesWithConversions.Add(expression))
throw new InvalidOperationException("Duplicate ProcessConversion() call");
if (!conversion.IsValid && !allowErrors) {
Console.WriteLine("Compiler error at " + fileName + ":" + expression.StartLocation + ": Cannot convert from " + result + " to " + targetType);
}
}
示例7: TestCast
void TestCast(Type targetType, ResolveResult input, Conversion expectedConversion)
{
IType type = targetType.ToTypeReference().Resolve(context);
ResolveResult rr = resolver.ResolveCast(type, input);
AssertType(targetType, rr);
Assert.AreEqual(typeof(ConversionResolveResult), rr.GetType());
var crr = (ConversionResolveResult)rr;
Assert.AreEqual(expectedConversion, crr.Conversion, "ConversionResolveResult.Conversion");
Assert.AreSame(input, crr.Input, "ConversionResolveResult.Input");
}
示例8: TestCast
void TestCast(Type targetType, ResolveResult input, Conversion expectedConversion)
{
IType type = compilation.FindType(targetType);
ResolveResult rr = resolver.ResolveCast(type, input);
AssertType(targetType, rr);
Assert.AreEqual(typeof(ConversionResolveResult), rr.GetType());
var crr = (ConversionResolveResult)rr;
Assert.AreEqual(expectedConversion, crr.Conversion, "ConversionResolveResult.Conversion");
Assert.AreSame(input, crr.Input, "ConversionResolveResult.Input");
}
示例9: TestOperator
void TestOperator(ResolveResult condition, ResolveResult trueExpr, ResolveResult falseExpr,
Conversion conditionConv, Conversion trueConv, Conversion falseConv,
Type expectedResultType)
{
var corr = (ConditionalOperatorResolveResult)resolver.ResolveConditional(condition, trueExpr, falseExpr);
AssertType(expectedResultType, corr);
AssertConversion(corr.Condition, condition, conditionConv, "Condition Conversion");
AssertConversion(corr.True, trueExpr, trueConv, "True Conversion");
AssertConversion(corr.False, falseExpr, falseConv, "False Conversion");
}
示例10: Resolved
public void Resolved(AstNode node, ResolveResult resolveResult)
{
if (resolveResult.IsError)
{
foreach(var error in GetErrorStrings(resolveResult))
{
_errors.Add(new ResolveErrors(node.StartLocation, error));
}
}
}
示例11: GetMember
static IMember GetMember (ResolveResult result)
{
if (result is MemberResolveResult) {
return ((MemberResolveResult)result).Member;
} else if (result is MethodGroupResolveResult) {
return ((MethodGroupResolveResult)result).Methods.FirstOrDefault ();
}
return null;
}
示例12: ConversionFromDynamic
public void ConversionFromDynamic()
{
// Explicit dynamic conversion is for resolve results only;
// otherwise it's an explicit reference / unboxing conversion
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic), typeof(string)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(dynamic), typeof(int)));
var dynamicRR = new ResolveResult(SpecialType.Dynamic);
Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(string))));
Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(int))));
}
示例13: Resolved
public void Resolved(AstNode node, ResolveResult result)
{
if (!resolvedNodes.Add(node))
throw new InvalidOperationException("Duplicate Resolved() call");
if (CSharpAstResolver.IsUnresolvableNode(node))
throw new InvalidOperationException("Resolved unresolvable node");
if (result.IsError && !allowErrors) {
Console.WriteLine("Compiler error at " + fileName + ":" + node.StartLocation + ": " + result);
}
}
示例14: BinaryOperatorResolveResult
public BinaryOperatorResolveResult(IType resultType, ResolveResult lhs, BinaryOperatorType op, ResolveResult rhs)
: base(resultType)
{
if (lhs == null)
throw new ArgumentNullException("lhs");
if (rhs == null)
throw new ArgumentNullException("rhs");
this.Left = lhs;
this.Operator = op;
this.Right = rhs;
}
示例15: Resolve
public override ResolveResult Resolve(CSharpResolver resolver)
{
ResolveResult[] elements = new ResolveResult[arrayElements.Count];
for (int i = 0; i < elements.Length; i++) {
elements[i] = arrayElements[i].Resolve(resolver);
}
if (elementType != null) {
return resolver.ResolveArrayCreation(elementType.Resolve(resolver.CurrentTypeResolveContext), 1, null, elements);
} else {
return resolver.ResolveArrayCreation(null, 1, null, elements);
}
}