public IType GetValueType(ITypeResolveContext context) { CSharpResolver resolver = CreateResolver(context); IType type = expression.Resolve(resolver).Type; if (resolver.Context != context) { // Retrieve the equivalent type in the new resolve context. // E.g. if the constant is defined in a .NET 2.0 project, type might be Int32 from mscorlib 2.0. // However, the calling project might be a .NET 4.0 project, so we need to return Int32 from mscorlib 4.0. return(type.AcceptVisitor(new MapTypeIntoNewContext(context))); } return(type); }
public override ResolveResult Resolve(CSharpResolver resolver) { ResolveResult lhs = left.Resolve(resolver); ResolveResult rhs = right.Resolve(resolver); return(resolver.ResolveBinaryOperator(operatorType, lhs, rhs)); }
public ResolveResult Resolve(ITypeResolveContext context) { CacheManager cache = context.CacheManager; if (cache != null) { ResolveResult cachedResult = cache.GetShared(this) as ResolveResult; if (cachedResult != null) { return(cachedResult); } } CSharpResolver resolver = CreateResolver(context); ResolveResult rr = expression.Resolve(resolver); // Retrieve the equivalent type in the new resolve context. // E.g. if the constant is defined in a .NET 2.0 project, type might be Int32 from mscorlib 2.0. // However, the calling project might be a .NET 4.0 project, so we need to return Int32 from mscorlib 4.0. rr = MapToNewContext(rr, new MapTypeIntoNewContext(context)); if (cache != null) { cache.SetShared(this, rr); } return(rr); }
public override ResolveResult Resolve(CSharpResolver resolver) { return(resolver.ResolveConditional( condition.Resolve(resolver), trueExpr.Resolve(resolver), falseExpr.Resolve(resolver) )); }
public override ResolveResult Resolve(CSharpResolver resolver) { bool oldCheckForOverflow = resolver.CheckForOverflow; try { resolver.CheckForOverflow = this.checkForOverflow; return(expression.Resolve(resolver)); } finally { resolver.CheckForOverflow = oldCheckForOverflow; } }
public override ResolveResult Resolve(CSharpResolver resolver) { ResolveResult rr; if (targetType != null) { rr = new TypeResolveResult(targetType.Resolve(resolver.Context)); } else { rr = targetExpression.Resolve(resolver); } return(resolver.ResolveMemberAccess(rr, memberName, ConstantIdentifierReference.ResolveTypes(resolver, typeArguments))); }
public override ResolveResult Resolve(CSharpResolver resolver) { return(resolver.ResolveUnaryOperator(operatorType, expression.Resolve(resolver))); }
public override ResolveResult Resolve(CSharpResolver resolver) { return(resolver.ResolveCast(targetType.Resolve(resolver.Context), expression.Resolve(resolver))); }