本文整理汇总了C#中Conversion.ProjectAsIExpression方法的典型用法代码示例。如果您正苦于以下问题:C# Conversion.ProjectAsIExpression方法的具体用法?C# Conversion.ProjectAsIExpression怎么用?C# Conversion.ProjectAsIExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conversion
的用法示例。
在下文中一共展示了Conversion.ProjectAsIExpression方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProjectedExpression
private IExpression GetProjectedExpression()
{
VccCompilationHelper helper = (VccCompilationHelper)this.Helper;
string/*?*/ str = this.Value as string;
if (str == null) return CodeDummy.Expression;
GlobalVariableDeclaration/*?*/ globalVar;
if (!helper.StringTable.TryGetValue(str, out globalVar)) {
NameDeclaration dummyName = new NameDeclaration(this.NameTable.GetNameFor("?mappedLiteral"+this.GetHashCode()), this.SourceLocation);
VccArrayTypeExpression arrayType = new VccArrayTypeExpression(TypeExpression.For(this.PlatformType.SystemUInt8.ResolvedType), new CompileTimeConstant(str.Length+1, SourceDummy.SourceLocation), SourceDummy.SourceLocation);
globalVar = new GlobalVariableDeclaration(FieldDeclaration.Flags.ReadOnly, TypeMemberVisibility.Assembly, arrayType, dummyName, this, this.SourceLocation);
if (this.ContainingBlock.ContainingTypeDeclaration != null) {
this.ContainingBlock.ContainingTypeDeclaration.AddHelperMember(globalVar);
globalVar.SetContainingTypeDeclaration(this.ContainingBlock.ContainingTypeDeclaration, true);
helper.StringTable.Add(str, globalVar);
} else {
return CodeDummy.Expression;
//TODO: error
}
}
//^ assume globalVar != null;
AddressableExpression fieldRef = new AddressableExpression(new BoundExpression(this, globalVar.FieldDefinition));
VccAddressOf addressOf = new VccAddressOf(fieldRef, this.SourceLocation);
addressOf.SetContainingExpression(this);
Conversion conversion = new Conversion(addressOf, this.Type, this.SourceLocation);
return conversion.ProjectAsIExpression();
}