本文整理汇总了C#中BoundParameter类的典型用法代码示例。如果您正苦于以下问题:C# BoundParameter类的具体用法?C# BoundParameter怎么用?C# BoundParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BoundParameter类属于命名空间,在下文中一共展示了BoundParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OAuthContext
public OAuthContext()
{
_consumerKey = new BoundParameter(Parameters.OAuth_Consumer_Key, this);
_nonce = new BoundParameter(Parameters.OAuth_Nonce, this);
_signature = new BoundParameter(Parameters.OAuth_Signature, this);
_signatureMethod = new BoundParameter(Parameters.OAuth_Signature_Method, this);
_timestamp = new BoundParameter(Parameters.OAuth_Timestamp, this);
_token = new BoundParameter(Parameters.OAuth_Token, this);
_tokenSecret = new BoundParameter(Parameters.OAuth_Token_Secret, this);
_version = new BoundParameter(Parameters.OAuth_Version, this);
_verifier = new BoundParameter(Parameters.OAuth_Verifier, this);
_callback = new BoundParameter(Parameters.OAuth_Callback, this);
FormEncodedParameters = new NameValueCollection();
Cookies = new NameValueCollection();
Headers = new NameValueCollection();
AuthorizationHeaderParameters = new NameValueCollection();
UseAuthorizationHeader = true;
}
示例2: EmitParameterStore
private void EmitParameterStore(BoundParameter parameter)
{
int slot = ParameterSlot(parameter);
if (parameter.ParameterSymbol.RefKind == RefKind.None)
{
_builder.EmitStoreArgumentOpcode(slot);
}
else
{
//NOTE: we should have the actual parameter already loaded,
//now need to do a store to where it points to
EmitIndirectStore(parameter.ParameterSymbol.Type, parameter.Syntax);
}
}
示例3: EmitParameterLoad
private void EmitParameterLoad(BoundParameter parameter)
{
int slot = ParameterSlot(parameter);
_builder.EmitLoadArgumentOpcode(slot);
if (parameter.ParameterSymbol.RefKind != RefKind.None)
{
var parameterType = parameter.ParameterSymbol.Type;
EmitLoadIndirect(parameterType, parameter.Syntax);
}
}
示例4: ParameterSlot
private static int ParameterSlot(BoundParameter parameter)
{
var sym = parameter.ParameterSymbol;
int slot = sym.Ordinal;
if (!sym.ContainingSymbol.IsStatic)
{
slot++; // skip "this"
}
return slot;
}
示例5: VisitUnhoistedParameter
protected virtual BoundNode VisitUnhoistedParameter(BoundParameter node)
{
return base.VisitParameter(node);
}
示例6: VisitParameter
public sealed override BoundNode VisitParameter(BoundParameter node)
{
BoundNode replacement;
if (TryReplaceWithProxy(node.ParameterSymbol, node.Syntax, out replacement))
{
return replacement;
}
// Non-captured and expression tree lambda parameters don't have a proxy.
return VisitUnhoistedParameter(node);
}
示例7: EmitParameterAddress
private void EmitParameterAddress(BoundParameter parameter)
{
int slot = ParameterSlot(parameter);
if (parameter.ParameterSymbol.RefKind == RefKind.None)
{
builder.EmitLoadArgumentAddrOpcode(slot);
}
else
{
builder.EmitLoadArgumentOpcode(slot);
}
}
示例8: GetParameterMethod
private EEMethodSymbol GetParameterMethod(EENamedTypeSymbol container, string methodName, string parameterName, int parameterIndex)
{
var syntax = SyntaxFactory.IdentifierName(parameterName);
return this.CreateMethod(container, methodName, syntax, (method, diagnostics) =>
{
var parameter = method.Parameters[parameterIndex];
var expression = new BoundParameter(syntax, parameter);
return new BoundReturnStatement(syntax, expression) { WasCompilerGenerated = true };
});
}
示例9: VisitParameter
public override BoundNode VisitParameter(BoundParameter node)
{
return RewriteParameter(node.Syntax, node.ParameterSymbol, node);
}
示例10: CreateBody
// private static T <Factory>(object[] submissionArray)
// {
// var submission = new Submission#N(submissionArray);
// return submission.<Initialize>();
// }
internal override BoundBlock CreateBody()
{
var syntax = this.GetSyntax();
var ctor = _containingType.GetScriptConstructor();
Debug.Assert(ctor.ParameterCount == 1);
var initializer = _containingType.GetScriptInitializer();
Debug.Assert(initializer.ParameterCount == 0);
var submissionArrayParameter = new BoundParameter(syntax, _parameters[0]) { WasCompilerGenerated = true };
var submissionLocal = new BoundLocal(
syntax,
new SynthesizedLocal(this, _containingType, SynthesizedLocalKind.LoweringTemp),
null,
_containingType)
{ WasCompilerGenerated = true };
// var submission = new Submission#N(submissionArray);
var submissionAssignment = new BoundExpressionStatement(
syntax,
new BoundAssignmentOperator(
syntax,
submissionLocal,
new BoundObjectCreationExpression(
syntax,
ctor,
ImmutableArray.Create<BoundExpression>(submissionArrayParameter),
default(ImmutableArray<string>),
default(ImmutableArray<RefKind>),
false,
default(ImmutableArray<int>),
null,
null,
_containingType)
{ WasCompilerGenerated = true },
_containingType)
{ WasCompilerGenerated = true })
{ WasCompilerGenerated = true };
// return submission.<Initialize>();
var initializeResult = CreateParameterlessCall(
syntax,
submissionLocal,
initializer);
Debug.Assert(initializeResult.Type == _returnType);
var returnStatement = new BoundReturnStatement(
syntax,
RefKind.None,
initializeResult)
{ WasCompilerGenerated = true };
return new BoundBlock(syntax,
ImmutableArray.Create<LocalSymbol>(submissionLocal.LocalSymbol),
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create<BoundStatement>(submissionAssignment, returnStatement))
{ WasCompilerGenerated = true };
}
示例11: VisitParameter
public override BoundNode VisitParameter(BoundParameter node)
{
CapturedSymbolReplacement proxy;
if (proxies.TryGetValue(node.ParameterSymbol, out proxy))
{
return proxy.Replacement(node.Syntax, frameType => FramePointer(node.Syntax, frameType));
}
ParameterSymbol replacementParameter;
if (this.parameterMap.TryGetValue(node.ParameterSymbol, out replacementParameter))
{
return new BoundParameter(node.Syntax, replacementParameter, replacementParameter.Type, node.HasErrors);
}
return base.VisitParameter(node);
}
示例12: CreateBody
// private static T <Factory>(object[] submissionArray)
// {
// var submission = new Submission#N(submissionArray);
// return submission.<Initialize>();
// }
internal override BoundBlock CreateBody()
{
var syntax = this.GetSyntax();
var ctor = _containingType.GetScriptConstructor();
Debug.Assert(ctor.ParameterCount == 1);
var initializer = _containingType.GetScriptInitializer();
Debug.Assert(initializer.ParameterCount == 0);
var submissionArrayParameter = new BoundParameter(syntax, _parameters[0]) { WasCompilerGenerated = true };
var submissionLocal = new BoundLocal(
syntax,
new SynthesizedLocal(this, _containingType, SynthesizedLocalKind.LoweringTemp),
null,
_containingType)
{ WasCompilerGenerated = true };
// var submission = new Submission#N(submissionArray);
var submissionAssignment = new BoundExpressionStatement(
syntax,
new BoundAssignmentOperator(
syntax,
submissionLocal,
new BoundObjectCreationExpression(
syntax,
ctor,
ImmutableArray.Create<BoundExpression>(submissionArrayParameter),
default(ImmutableArray<string>),
default(ImmutableArray<RefKind>),
false,
default(ImmutableArray<int>),
null,
null,
_containingType)
{ WasCompilerGenerated = true },
_containingType)
{ WasCompilerGenerated = true })
{ WasCompilerGenerated = true };
// return submission.<Initialize>();
BoundExpression initializeResult = new BoundCall(
syntax,
submissionLocal,
initializer,
ImmutableArray<BoundExpression>.Empty,
default(ImmutableArray<string>),
default(ImmutableArray<RefKind>),
isDelegateCall: false,
expanded: false,
invokedAsExtensionMethod: false,
argsToParamsOpt: default(ImmutableArray<int>),
resultKind: LookupResultKind.Viable,
type: initializer.ReturnType)
{ WasCompilerGenerated = true };
if (initializeResult.Type.IsStructType() && (_returnType.SpecialType == SpecialType.System_Object))
{
initializeResult = new BoundConversion(syntax, initializeResult, Conversion.Boxing, false, true, ConstantValue.NotAvailable, _returnType)
{ WasCompilerGenerated = true };
}
var returnStatement = new BoundReturnStatement(
syntax,
initializeResult)
{ WasCompilerGenerated = true };
return new BoundBlock(syntax,
ImmutableArray.Create<LocalSymbol>(submissionLocal.LocalSymbol),
ImmutableArray.Create<BoundStatement>(submissionAssignment, returnStatement))
{ WasCompilerGenerated = true };
}
示例13: CreateSubmissionFactoryBody
// Generates:
//
// private static T {Factory}(InteractiveSession session)
// {
// T submissionResult;
// new {ThisScriptClass}(session, out submissionResult);
// return submissionResult;
// }
private BoundBlock CreateSubmissionFactoryBody()
{
Debug.Assert(containingType.TypeKind == TypeKind.Submission);
SyntaxTree syntaxTree = CSharpSyntaxTree.Dummy;
CSharpSyntaxNode syntax = (CSharpSyntaxNode)syntaxTree.GetRoot();
var interactiveSessionParam = new BoundParameter(syntax, parameters[0]) { WasCompilerGenerated = true };
var ctor = containingType.InstanceConstructors.Single();
Debug.Assert(ctor is SynthesizedInstanceConstructor);
Debug.Assert(ctor.ParameterCount == 2);
var submissionResultType = ctor.Parameters[1].Type;
var submissionResult = new BoundLocal(syntax, new SynthesizedLocal(ctor, submissionResultType), null, submissionResultType) { WasCompilerGenerated = true };
return new BoundBlock(syntax,
// T submissionResult;
ImmutableArray.Create<LocalSymbol>(submissionResult.LocalSymbol),
ImmutableArray.Create<BoundStatement>(
// new Submission(interactiveSession, out submissionResult);
new BoundExpressionStatement(syntax,
new BoundObjectCreationExpression(
syntax,
ctor,
ImmutableArray.Create<BoundExpression>(interactiveSessionParam, submissionResult),
ImmutableArray<string>.Empty,
ImmutableArray.Create<RefKind>(RefKind.None, RefKind.Ref),
false,
default(ImmutableArray<int>),
null,
null,
containingType
)
{ WasCompilerGenerated = true })
{ WasCompilerGenerated = true },
// return submissionResult;
new BoundReturnStatement(syntax, submissionResult) { WasCompilerGenerated = true }))
{ WasCompilerGenerated = true };
}
示例14: GetParameterMethod
private EEMethodSymbol GetParameterMethod(EENamedTypeSymbol container, string methodName, string parameterName, int parameterIndex)
{
var syntax = SyntaxFactory.IdentifierName(parameterName);
return this.CreateMethod(container, methodName, syntax, (EEMethodSymbol method, DiagnosticBag diagnostics, out ImmutableArray<LocalSymbol> declaredLocals) =>
{
declaredLocals = ImmutableArray<LocalSymbol>.Empty;
var parameter = method.Parameters[parameterIndex];
var expression = new BoundParameter(syntax, parameter);
return new BoundReturnStatement(syntax, RefKind.None, expression) { WasCompilerGenerated = true };
});
}
示例15: CreateSubmissionFactoryBody
// Generates:
//
// private static T {Factory}(InteractiveSession session)
// {
// T submissionResult;
// new {ThisScriptClass}(session, out submissionResult);
// return submissionResult;
// }
private BoundBlock CreateSubmissionFactoryBody()
{
Debug.Assert(_containingType.TypeKind == TypeKind.Submission);
SyntaxTree syntaxTree = CSharpSyntaxTree.Dummy;
CSharpSyntaxNode syntax = (CSharpSyntaxNode)syntaxTree.GetRoot();
var interactiveSessionParam = new BoundParameter(syntax, _parameters[0]) { WasCompilerGenerated = true };
var ctor = _containingType.InstanceConstructors.Single();
Debug.Assert(ctor is SynthesizedInstanceConstructor);
Debug.Assert(ctor.ParameterCount == 2);
var submissionResultType = ctor.Parameters[1].Type;
var resultLocal = new SynthesizedLocal(ctor, submissionResultType, SynthesizedLocalKind.LoweringTemp);
var localReference = new BoundLocal(syntax, resultLocal, null, submissionResultType) { WasCompilerGenerated = true };
BoundExpression submissionResult = localReference;
if (submissionResultType.IsStructType() && _returnType.SpecialType == SpecialType.System_Object)
{
submissionResult = new BoundConversion(syntax, submissionResult, Conversion.Boxing, false, true, ConstantValue.NotAvailable, _returnType)
{ WasCompilerGenerated = true };
}
return new BoundBlock(syntax,
// T submissionResult;
ImmutableArray.Create<LocalSymbol>(resultLocal),
ImmutableArray.Create<BoundStatement>(
// new Submission(interactiveSession, out submissionResult);
new BoundExpressionStatement(syntax,
new BoundObjectCreationExpression(
syntax,
ctor,
ImmutableArray.Create<BoundExpression>(interactiveSessionParam, localReference),
ImmutableArray<string>.Empty,
ImmutableArray.Create<RefKind>(RefKind.None, RefKind.Ref),
false,
default(ImmutableArray<int>),
null,
null,
_containingType
)
{ WasCompilerGenerated = true })
{ WasCompilerGenerated = true },
// return submissionResult;
new BoundReturnStatement(syntax, submissionResult) { WasCompilerGenerated = true }))
{ WasCompilerGenerated = true };
}