本文整理汇总了C#中System.CodeDom.CodeArgumentReferenceExpression类的典型用法代码示例。如果您正苦于以下问题:C# CodeArgumentReferenceExpression类的具体用法?C# CodeArgumentReferenceExpression怎么用?C# CodeArgumentReferenceExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeArgumentReferenceExpression类属于System.CodeDom命名空间,在下文中一共展示了CodeArgumentReferenceExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: EmitArgumentReference
void EmitArgumentReference(CodeArgumentReferenceExpression Argument)
{
Depth++;
Debug("Emitting argument reference");
Generator.Emit(OpCodes.Ldarg, 0); // for now only used to refer to the sole object[] parameter
Depth--;
}
开发者ID:pschuegr,项目名称:IronAHK,代码行数:7,代码来源:EmitVars.cs
示例2: DefaultConstructor
public void DefaultConstructor ()
{
CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression ();
Assert.AreEqual (string.Empty, care.ParameterName, "#1");
care.ParameterName = "mono";
Assert.AreEqual ("mono", care.ParameterName, "#2");
}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CodeArgumentReferenceExpressionTest.cs
示例3: BindingElementExtensionSectionGenerator
internal BindingElementExtensionSectionGenerator(Type bindingElementType, Assembly userAssembly, CodeDomProvider provider)
{
this.bindingElementType = bindingElementType;
this.userAssembly = userAssembly;
this.provider = provider;
string typePrefix = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement));
this.generatedClassName = typePrefix + Constants.ElementSuffix;
this.constantsClassName = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement)) + Constants.ConfigurationStrings;
this.defaultValuesClassName = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement)) + Constants.Defaults;
this.customBEVarInstance = Helpers.TurnFirstCharLower(bindingElementType.Name);
customBEArgRef = new CodeArgumentReferenceExpression(customBEVarInstance);
this.customBETypeRef = new CodeTypeReference(bindingElementType.Name);
this.customBETypeOfRef = new CodeTypeOfExpression(customBETypeRef);
this.customBENewVarAssignRef = new CodeVariableDeclarationStatement(
customBETypeRef,
customBEVarInstance,
new CodeObjectCreateExpression(customBETypeRef));
this.bindingElementMethodParamRef = new CodeParameterDeclarationExpression(
CodeDomHelperObjects.bindingElementTypeRef,
Constants.bindingElementParamName);
}
开发者ID:ssickles,项目名称:archive,代码行数:25,代码来源:BindingElementExtensionSectionGenerator.cs
示例4: NullParameter
public void NullParameter ()
{
CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression ((string) null);
Assert.AreEqual (string.Empty, care.ParameterName, "#1");
care.ParameterName = null;
Assert.AreEqual (string.Empty, care.ParameterName, "#2");
}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CodeArgumentReferenceExpressionTest.cs
示例5: TypescriptArgumentReferenceExpression
public TypescriptArgumentReferenceExpression(
CodeArgumentReferenceExpression codeExpression,
CodeGeneratorOptions options)
{
_codeExpression = codeExpression;
_options = options;
System.Diagnostics.Debug.WriteLine("TypescriptArgumentReferenceExpression Created");
}
开发者ID:s2quake,项目名称:TypescriptCodeDom,代码行数:8,代码来源:TypescriptArgumentReferenceExpression.cs
示例6: GenerateRenderMemberMethod
// Generate the CodeDom for our render method
internal CodeMemberMethod GenerateRenderMemberMethod(string virtualPath)
{
Control container = Parent;
string physicalPath = HostingEnvironment.MapPath(virtualPath);
CodeMemberMethod renderMethod = new CodeMemberMethod();
renderMethod.Name = RenderMethodName;
renderMethod.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "__srh"));
// REVIEW: we need support for CodeArgumentReferenceExpression, as using a snippet is
// not guanranteed to be language agnostic
CodeExpression snippetRenderHelper = new CodeArgumentReferenceExpression("__srh");
// Go through all the children to build the CodeDOM tree
for (int controlIndex = 0; controlIndex < container.Controls.Count; controlIndex++) {
Control c = container.Controls[controlIndex];
if (!(c is SnippetControl || c is ExpressionSnippetControl)) {
// If it's a regular control, generate a call to render it based on its index
CodeExpression method = new CodeMethodInvokeExpression(snippetRenderHelper, "RenderControl",
new CodePrimitiveExpression(controlIndex));
renderMethod.Statements.Add(new CodeExpressionStatement(method));
continue;
}
BaseCodeControl codeControl = (BaseCodeControl)c;
string code = codeControl.Code;
CodeStatement stmt;
if (codeControl is SnippetControl) {
// If it's a <% code %> block, just append the code as is
stmt = new CodeSnippetStatement(code);
} else {
// If it's a <%= expr %> block, generate a call to render it
CodeExpression method = new CodeMethodInvokeExpression(snippetRenderHelper, "Render",
new CodeSnippetExpression(code));
stmt = new CodeExpressionStatement(method);
}
stmt.LinePragma = new CodeLinePragma(physicalPath, codeControl.Line);
renderMethod.Statements.Add(stmt);
}
return renderMethod;
}
开发者ID:TerabyteX,项目名称:main,代码行数:55,代码来源:SnippetControl.cs
示例7: EmitApply
public override void EmitApply (CodeMemberMethod apply, CodeArgumentReferenceExpression proj,
CodeArgumentReferenceExpression declloc,
CodeArgumentReferenceExpression log,
CodeVariableReferenceExpression pb,
CodeVariableReferenceExpression tb)
{
apply.Statements.Add (new CodeCommentStatement ("Create provider for param " +
basisparam));
CodeMethodInvokeExpression mie = new CodeMethodInvokeExpression ();
mie.Method = new CodeMethodReferenceExpression (proj, "EnsureProvider");
mie.Parameters.Add (new CodeFieldReferenceExpression (CDH.This, basisparam));
mie.Parameters.Add (declloc);
apply.Statements.Add (new CodeAssignStatement (pb, mie));
// Tell the PB about our Structure arguments so it can
// use them to instantiate the objects we reference.
// FIXME: catch if the provider references a rule or template
// that requires a structure we don't have.
//if (Structure != null) {
mie = new CodeMethodInvokeExpression ();
mie.Method = new CodeMethodReferenceExpression (pb, "AddContextStructure");
mie.Parameters.Add (CDH.This);
apply.Statements.Add (mie);
foreach (string param in Structure.Parameters) {
if (Structure[param] != StructureParameterKind.Structure)
continue;
mie = new CodeMethodInvokeExpression ();
mie.Method = new CodeMethodReferenceExpression (pb, "AddContextStructure");
mie.Parameters.Add (new CodeFieldReferenceExpression (CDH.This, param));
apply.Statements.Add (mie);
}
//}
foreach (BGTargetBuilder iter in targs)
iter.EmitApply (apply, pb, tb, log);
foreach (string key in lits.Keys) {
CodeExpression val = CDH.ResultExpression (lits[key]);
CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression ();
cmie.Method = new CodeMethodReferenceExpression (pb, "DefineConstantTarget");
cmie.Parameters.Add (new CodePrimitiveExpression (key));
cmie.Parameters.Add (val);
cmie.Parameters.Add (log);
apply.Statements.Add (CDH.IfTrueReturnTrue (cmie));
}
}
开发者ID:emtees,项目名称:old-code,代码行数:53,代码来源:BGProviderBuilder.cs
示例8: GenerateCode
public CodeNamespace GenerateCode(XmlReader reader)
{
CodeTypeDeclaration templateType = new CodeTypeDeclaration(defaultTypeName);
templateType.Attributes = MemberAttributes.Family;
templateType.IsPartial = true;
CodeNamespace templateNamespace = new CodeNamespace(defaultTargetNamespace);
templateNamespace.Types.Add(templateType);
AddCommonImports(templateNamespace);
CodeMemberMethod renderMethod = new CodeMemberMethod();
renderMethod.Name = "Render";
renderMethod.Attributes = MemberAttributes.Public | MemberAttributes.Final;
renderMethod.Parameters.Add(new CodeParameterDeclarationExpression(
typeof(XmlWriter), "writer"));
CodeArgumentReferenceExpression writerExpression = new CodeArgumentReferenceExpression("writer");
templateType.Members.Add(renderMethod);
templateType.Members.Add(BuildConverter());
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.ProcessingInstruction)
{
ThrowIfUnknownInstruction(reader);
if (typeInstructions.ContainsKey(reader.LocalName))
{
ITypeInstruction ti = typeInstructions[reader.LocalName];
ti.Process(reader.Value, templateNamespace, templateType, renderMethod);
}
if (inlineInstructions.ContainsKey(reader.LocalName))
{
IInlineInstruction ii = inlineInstructions[reader.LocalName];
CodeStatementCollection col = ii.Process(reader.Value);
renderMethod.Statements.AddRange(col);
}
}
else
{
renderMethod.Statements.AddRange(
generationFunctions[reader.NodeType](reader, writerExpression));
}
}
return templateNamespace;
}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:47,代码来源:XmlCodeGenerator.cs
示例9: GenerateConstructor
public static void GenerateConstructor(CodeTypeDeclaration classDecl)
{
CodeConstructor constructorMember = new CodeConstructor() ;
constructorMember.Attributes = MemberAttributes.Public;
CodeParameterDeclarationExpression parameter = new CodeParameterDeclarationExpression(new CodeTypeReference("IContext"), "context");
constructorMember.Parameters.Add(parameter);
CodeThisReferenceExpression thisExp = new CodeThisReferenceExpression();
CodeFieldReferenceExpression ctxFieldExp = new CodeFieldReferenceExpression(thisExp, "context");
CodeArgumentReferenceExpression argExp = new CodeArgumentReferenceExpression("context");
CodeAssignStatement assignStatement = new CodeAssignStatement(ctxFieldExp, argExp);
constructorMember.Statements.Add(assignStatement);
classDecl.Members.Add(constructorMember);
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:18,代码来源:CodeDomGenerator.cs
示例10: GetKeywordFromCodeDom
public void GetKeywordFromCodeDom()
{
CodeStatement st = new CodeExpressionStatement(new CodeArgumentReferenceExpression("foo"));
CodeExpression exp = new CodeArgumentReferenceExpression("foo");
CodeIterationStatement it = new CodeIterationStatement(st, exp, st);
CodeConditionStatement cond = new CodeConditionStatement(exp);
new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromStatement(
it, Console.Out, new System.CodeDom.Compiler.CodeGeneratorOptions());
new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromStatement(
cond, Console.Out, new System.CodeDom.Compiler.CodeGeneratorOptions());
new Microsoft.VisualBasic.VBCodeProvider().GenerateCodeFromStatement(
it, Console.Out, new System.CodeDom.Compiler.CodeGeneratorOptions());
new Microsoft.VisualBasic.VBCodeProvider().GenerateCodeFromStatement(
cond, Console.Out, new System.CodeDom.Compiler.CodeGeneratorOptions());
}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:18,代码来源:RegexTests.cs
示例11: GenerateExecuteQueryBody
public CodeStatement GenerateExecuteQueryBody(CodeMemberMethod method)
{
var dataAccessReference = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataAccessVariableName);
var methodArgumentReferences = new CodeArgumentReferenceExpression[method.Parameters.Count];
for (int i = 0; i < method.Parameters.Count; i++)
{
methodArgumentReferences[i] = new CodeArgumentReferenceExpression(method.Parameters[i].Name);
}
var invocationExpression = new CodeMethodInvokeExpression(dataAccessReference, ExecuteSqlQueryMethodName, methodArgumentReferences);
if (method.ReturnType.BaseType != "System.Void")
{
return new CodeMethodReturnStatement(invocationExpression);
}
else
{
return new CodeExpressionStatement(invocationExpression);
}
}
开发者ID:swoog,项目名称:EaiConverter,代码行数:21,代码来源:DataAccessServiceBuilder.cs
示例12: addDispose
static CodeMemberMethod addDispose(CodeTypeDeclaration ctd, CodeMemberMethod m, CodeMemberField fContainer)
{
CodeArgumentReferenceExpression ar0;
CodeConditionStatement ccs, ccs1;
CodeFieldReferenceExpression fr;
ar0 = new CodeArgumentReferenceExpression("disposing");
ctd.Members.Add(m = new CodeMemberMethod());
m.Name = "Dispose";
m.Attributes = MemberAttributes.Override | MemberAttributes.Family;
m.Parameters.Add(new CodeParameterDeclarationExpression(typeof(bool), ar0.ParameterName));
fr = new CodeFieldReferenceExpression(null, fContainer.Name);
ccs = new CodeConditionStatement(ar0, ccs1 = new CodeConditionStatement());
ccs1.Condition = new CodeBinaryOperatorExpression(
fr,
CodeBinaryOperatorType.IdentityInequality,
new CodePrimitiveExpression());
ccs1.TrueStatements.Add(
new CodeExpressionStatement(
new CodeMethodInvokeExpression(fr, "Dispose")));
m.Statements.AddRange(
new CodeStatement[] {
ccs,
new CodeExpressionStatement(
new CodeMethodInvokeExpression(
new CodeBaseReferenceExpression(),
"Dispose",ar0))
});
m.Comments.AddRange(
new CodeCommentStatement[]{
new CodeCommentStatement("<summary>\n Clean up any resources being used.\n </summary>",true)
}
);
return m;
}
开发者ID:surak8,项目名称:ProjectGen,代码行数:37,代码来源:CSGenerator.cs
示例13: GenerateArgumentReferenceExpression
protected override void GenerateArgumentReferenceExpression(CodeArgumentReferenceExpression e)
{
this.OutputIdentifier(e.ParameterName);
}
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:4,代码来源:VBCodeGenerator.cs
示例14: AddStatementsToInitMethod
protected override void AddStatementsToInitMethod (CodeMemberMethod method)
{
#if NET_2_0
AddStatementsFromDirective (method);
ILocation directiveLocation = pageParser.DirectiveLocation;
CodeArgumentReferenceExpression ctrlVar = new CodeArgumentReferenceExpression("__ctrl");
if (pageParser.Title != null)
method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "Title", pageParser.Title), directiveLocation));
if (pageParser.MasterPageFile != null)
method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "MasterPageFile", pageParser.MasterPageFile), directiveLocation));
if (pageParser.Theme != null)
method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "Theme", pageParser.Theme), directiveLocation));
if (pageParser.StyleSheetTheme != null)
method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "StyleSheetTheme", pageParser.StyleSheetTheme), directiveLocation));
if (pageParser.Async != false)
method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "AsyncMode", pageParser.Async), directiveLocation));
if (pageParser.AsyncTimeout != -1)
method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "AsyncTimeout",
TimeSpan.FromSeconds (pageParser.AsyncTimeout)), directiveLocation));
CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression (thisRef, "InitializeCulture");
method.Statements.Add (AddLinePragma (new CodeExpressionStatement (expr), directiveLocation));
#endif
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:30,代码来源:PageCompiler.cs
示例15: ExportMessages
private CodeExpression[] ExportMessages (MessageDescriptionCollection messages, CodeMemberMethod method, bool return_args)
{
CodeExpression [] args = null;
foreach (MessageDescription md in messages) {
if (md.Direction == MessageDirection.Output) {
if (md.Body.ReturnValue != null) {
ExportDataContract (md.Body.ReturnValue);
method.ReturnType = md.Body.ReturnValue.CodeTypeReference;
}
continue;
}
if (return_args)
args = new CodeExpression [md.Body.Parts.Count];
MessagePartDescriptionCollection parts = md.Body.Parts;
for (int i = 0; i < parts.Count; i++) {
ExportDataContract (parts [i]);
method.Parameters.Add (
new CodeParameterDeclarationExpression (
parts [i].CodeTypeReference,
parts [i].Name));
if (return_args)
args [i] = new CodeArgumentReferenceExpression (parts [i].Name);
}
}
return args;
}
开发者ID:anand-bhola,项目名称:mono,代码行数:31,代码来源:ServiceContractGenerator.cs
示例16: SetupMembers
//implement the code generation methods
private void SetupMembers(string name)
{
shaderTypeRef = new CodeTypeReference(name);
gdIndexRef = new CodeFieldReferenceExpression(ShaderClassEx, "gd");
shaderSystemDecl = new CodeParameterDeclarationExpression(typeof(ShaderSystemBase), "state");
shaderSystemRef = new CodeArgumentReferenceExpression("state");
graphicsIDInit = new CodeMethodReferenceExpression(new CodeThisReferenceExpression(), "gdInit");
validateDeviceId = new CodeConditionStatement(new CodeBinaryOperatorExpression(GraphicsDeviceUID, CodeBinaryOperatorType.IdentityInequality, new CodePropertyReferenceExpression(ShaderSystemRef, "DeviceUniqueIndex")),
new CodeExpressionStatement(new CodeMethodInvokeExpression(graphicsIDInit, shaderSystemRef)));
validateDeviceIdAndWarmShader = new CodeConditionStatement(new CodeBinaryOperatorExpression(GraphicsDeviceUID, CodeBinaryOperatorType.IdentityInequality, new CodePropertyReferenceExpression(ShaderSystemRef, "DeviceUniqueIndex")),
new CodeExpressionStatement(new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), "WarmShader", shaderSystemRef)));
bindInstanceChange = new CodeVariableReferenceExpression("ic");
//bindTypeChange = new CodeVariableReferenceExpression("tc");
extensionModeChange = new CodeVariableReferenceExpression("ec");
shaderExtensionMode = new CodeVariableReferenceExpression("ext");
shaderExtensionIsBlending = new CodeBinaryOperatorExpression(shaderExtensionMode, CodeBinaryOperatorType.IdentityEquality, new CodePropertyReferenceExpression(new CodeTypeReferenceExpression(typeof(ShaderExtension)), "Blending"));
shaderExtensionIsInstancing = new CodeBinaryOperatorExpression(shaderExtensionMode, CodeBinaryOperatorType.IdentityEquality, new CodePropertyReferenceExpression(new CodeTypeReferenceExpression(typeof(ShaderExtension)), "Instancing"));
effectRef = new CodeFieldReferenceExpression(ShaderClassEx, "fx");
effectBytesRef = new CodeFieldReferenceExpression(ShaderClassEx, "fxb");
vsRegRef = new CodeFieldReferenceExpression(Instance, "vreg");
psRegRef = new CodeFieldReferenceExpression(Instance, "preg");
vsRegChangeRef = new CodeFieldReferenceExpression(Instance, "vreg_change");
psRegChangeRef = new CodeFieldReferenceExpression(Instance, "preg_change");
vsBlendRegRef = new CodeFieldReferenceExpression(Instance, "vbreg");
vsInstancingRegRef = new CodeFieldReferenceExpression(Instance, "vireg");
vsBlendRegChangeRef = new CodeFieldReferenceExpression(Instance, "vbreg_change");
vsInstancingRegChangeRef = new CodeFieldReferenceExpression(Instance, "vireg_change");
vsBooleanRegRef = new CodeFieldReferenceExpression(Instance, "vreg_bool");
psBooleanRegRef = new CodeFieldReferenceExpression(Instance, "preg_bool");
vsBooleanRegChangeRef = new CodeFieldReferenceExpression(Instance, "vreg_bool_change");
psBooleanRegChangeRef = new CodeFieldReferenceExpression(Instance, "preg_bool_change");
setAttribIdRef = new CodeArgumentReferenceExpression("id");
setAttribValueRef = new CodeArgumentReferenceExpression("value");
}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:50,代码来源:ShaderDom.cs
示例17: GenerateArgumentReferenceExpression
protected override void GenerateArgumentReferenceExpression (CodeArgumentReferenceExpression e)
{
}
开发者ID:Profit0004,项目名称:mono,代码行数:3,代码来源:CodeGeneratorCas.cs
示例18: CreateVertexInputMethods
private void CreateVertexInputMethods()
{
AsmListing asmVS = this.source.GetAsmTechnique(this.techniqueName, this.platform).VertexShader;
//create the GetVertexInputCount() and GetVertexInput() methods
CodeMemberMethod count = new CodeMemberMethod();
count.Name = "GetVertexInputCountImpl";
count.Attributes = MemberAttributes.Family | MemberAttributes.Override;
count.ReturnType = new CodeTypeReference(typeof(int));
Comment(count, "Returns the number of vertex inputs used by this shader");
count.Statements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(asmVS.InputCount)));
classDom.Members.Add(count);
//inputs are stored in a static array
//create it...
int[] arrayValues = new int[asmVS.InputCount * 2];
for (int i = 0; i < asmVS.InputCount; i++)
{
arrayValues[i] = (int)asmVS.GetInput(i).Usage;
arrayValues[i + asmVS.InputCount] = (int)asmVS.GetInput(i).Index;
}
this.vsInputField = new CodeMemberField(typeof(int[]), "vin");
this.vsInputField.Attributes = MemberAttributes.Private | MemberAttributes.Static | MemberAttributes.Final;
this.vsInputField.InitExpression = ShaderBytes.ToArray(arrayValues, this.directives);
CodeFieldReferenceExpression vsInputRef = new CodeFieldReferenceExpression(ShaderClassEx, vsInputField.Name);
//protected internal abstract void GetVertexInput(int index, out VertexElementUsage elementUsage, out int elementIndex);
CodeMemberMethod getInput = new CodeMemberMethod();
getInput.Name = "GetVertexInputImpl";
getInput.Attributes = MemberAttributes.Family | MemberAttributes.Override;
CodeParameterDeclarationExpression indexParam = new CodeParameterDeclarationExpression(typeof(int),"i");
getInput.Parameters.Add(indexParam);
CodeParameterDeclarationExpression param = new CodeParameterDeclarationExpression(typeof(VertexElementUsage), "usage");
param.Direction = FieldDirection.Out;
getInput.Parameters.Add(param);
param = new CodeParameterDeclarationExpression(typeof(int), "index");
param.Direction = FieldDirection.Out;
getInput.Parameters.Add(param);
CodeArgumentReferenceExpression indexRef = new CodeArgumentReferenceExpression(indexParam.Name);
//the element index is stored at 'i + asmVS.InputCount'
CodeExpression indexArray = new CodeArrayIndexerExpression(vsInputRef,
new CodeBinaryOperatorExpression(indexRef, CodeBinaryOperatorType.Add, new CodePrimitiveExpression(asmVS.InputCount)));
//and the usage must be cast
CodeExpression usageCast = new CodeCastExpression(typeof(VertexElementUsage), new CodeArrayIndexerExpression(vsInputRef,indexRef));
getInput.Statements.Add(new CodeAssignStatement(new CodeArgumentReferenceExpression("usage"), usageCast));
getInput.Statements.Add(new CodeAssignStatement(new CodeArgumentReferenceExpression("index"), indexArray));
Comment(getInput, "Returns a vertex input used by this shader");
classDom.Members.Add(getInput);
}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:65,代码来源:ShaderDom.cs
示例19: ConnectNameAndEvents
internal void ConnectNameAndEvents(string elementName, ArrayList events, int connectionId)
{
CodeContext cc = (CodeContext)_codeContexts.Peek();
bool isAllowedNameScope = cc.IsAllowedNameScope;
if (_codeContexts.Count > 1 && KnownTypes.Types[(int)KnownElements.INameScope].IsAssignableFrom(cc.ElementType))
{
cc.IsAllowedNameScope = false;
}
if ((elementName == null || !isAllowedNameScope) && (events == null || events.Count == 0))
{
_typeArgsList = null;
return;
}
EnsureHookupFn();
CodeConditionStatement ccsConnector = null;
if (SwitchStatementSupported())
{
// case 1:
//
CodeSnippetStatement cssCase = new CodeSnippetStatement(CASE_STATEMENT + connectionId + COLON);
_ccRoot.HookupFn.Statements.Add(cssCase);
}
else
{
// if (connectionId == 1)
//
ccsConnector = new CodeConditionStatement();
ccsConnector.Condition = new CodeBinaryOperatorExpression(new CodeArgumentReferenceExpression(CONNECTIONID),
CodeBinaryOperatorType.ValueEquality,
new CodePrimitiveExpression(connectionId));
}
// (System.Windows.Controls.Footype)target;
CodeArgumentReferenceExpression careTarget = new CodeArgumentReferenceExpression(TARGET);
CodeCastExpression cceTarget = new CodeCastExpression(cc.ElementTypeReference, careTarget);
CodeExpression ceEvent = cceTarget;
// Names in nested Name scopes not be hooked up via ICC.Connect() as no fields are generated in this case.
if (elementName != null && isAllowedNameScope)
{
// this.fooId = (System.Windows.Controls.Footype)target;
//
ceEvent = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), elementName);
CodeAssignStatement casName = new CodeAssignStatement(ceEvent, cceTarget);
if (SwitchStatementSupported())
{
_ccRoot.HookupFn.Statements.Add(casName);
}
else
{
ccsConnector.TrueStatements.Add(casName);
}
}
if (events != null)
{
foreach (MarkupEventInfo mei in events)
{
CodeStatement csEvent = AddCLREvent(cc, ceEvent, mei);
if (SwitchStatementSupported())
{
_ccRoot.HookupFn.Statements.Add(csEvent);
}
else
{
ccsConnector.TrueStatements.Add(csEvent);
}
}
}
// return;
//
if (SwitchStatementSupported())
{
_ccRoot.HookupFn.Statements.Add(new CodeMethodReturnStatement());
}
else
{
ccsConnector.TrueStatements.Add(new CodeMethodReturnStatement());
_ccRoot.HookupFn.Statements.Add(ccsConnector);
}
_typeArgsList = null;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:91,代码来源:MarkupCompiler.cs
示例20: AddConstructorWithCopiedParameters
private static void AddConstructorWithCopiedParameters(CodeTypeDeclaration codeType, Type implementationType, CodeFieldReferenceExpression omObjectFieldReference, ConstructorInfo constructorInfo)
{
CodeConstructor constructor = new CodeConstructor();
constructor.Attributes = MemberAttributes.Public;
ParameterInfo[] parameters = constructorInfo.GetParameters();
CodeExpression[] codeArgumentReferences = new CodeExpression[parameters.Length];
for (int i = 0; i < parameters.Length; i++)
{
bool isOmTypeArg = false;
string paramType = parameters[i].ParameterType.FullName;
if (OMtoPSClassMappings.ContainsKey(paramType))
{
paramType = OMtoPSClassMappings[paramType];
isOmTypeArg = true;
}
string paramName = parameters[i].Name;
string passedInArg;
// Create the proper parameter for optional
if (parameters[i].IsOptional)
{
paramName = paramType.Contains("System")
? string.Format("{0} = null", parameters[i].Name)
: string.Format("{0} = default({1})", parameters[i].Name, paramType);
}
// Need to do a null check for calling an omObject from a PS wrapper class
if (isOmTypeArg && parameters[i].IsOptional)
{
CodeVariableDeclarationStatement omObjectDeclaration = new CodeVariableDeclarationStatement(
parameters[i].ParameterType,
string.Format("{0}{1}", parameters[i].Name, "OmObject"),
new CodePrimitiveExpression(null));
constructor.Statements.Add(omObjectDeclaration);
CodeArgumentReferenceExpression omObjectArgumentReference = new CodeArgumentReferenceExpression(parameters[i].Name);
CodeAssignStatement omObjectAssignStatement = new CodeAssignStatement(new CodeVariableReferenceExpression(string.Format("{0}{1}", parameters[i].Name, "OmObject")), new CodeVariableReferenceExpression(string.Format("{0}.{1}", parameters[i].Name, OmObject)));
CodeBinaryOperatorExpression nullCheck = new CodeBinaryOperatorExpression(omObjectArgumentReference, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression(null));
// if the parameter is not null, use the omObject of the PS Wrapper class
constructor.Statements.Add(new CodeConditionStatement(nullCheck, omObjectAssignStatement));
passedInArg = string.Format("{0}{1}", parameters[i].Name, "OmObject");
}
else if (isOmTypeArg)
{
passedInArg = string.Format("{0}.{1}", parameters[i].Name, OmObject);
}
else
{
passedInArg = parameters[i].Name;
}
codeArgumentReferences[i] = new CodeArgumentReferenceExpression(passedInArg);
constructor.Parameters.Add(new CodeParameterDeclarationExpression(paramType, paramName));
}
CodeObjectCreateExpression createExpression = new CodeObjectCreateExpression(implementationType, codeArgumentReferences);
constructor.Statements.Add(new CodeAssignStatement(omObjectFieldReference, createExpression));
codeType.Members.Add(constructor);
}
开发者ID:Azure,项目名称:azure-powershell,代码行数:65,代码来源:Program.cs
注:本文中的System.CodeDom.CodeArgumentReferenceExpression类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论