本文整理汇总了C#中Pchp.CodeAnalysis.CodeGen.CodeGenerator.Emit_PhpAlias_GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenerator.Emit_PhpAlias_GetValue方法的具体用法?C# CodeGenerator.Emit_PhpAlias_GetValue怎么用?C# CodeGenerator.Emit_PhpAlias_GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pchp.CodeAnalysis.CodeGen.CodeGenerator
的用法示例。
在下文中一共展示了CodeGenerator.Emit_PhpAlias_GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitLoad
//.........这里部分代码省略.........
if (cg.IsArrayOnly(_thint))
{
// uses typehint and accesses .Array directly if possible
// <place>.Array
_place.EmitLoadAddress(cg.Builder);
return cg.EmitCall(ILOpCode.Call, cg.CoreMethods.PhpValue.get_Array)
.Expect(cg.CoreTypes.PhpArray);
}
else
{
// <place>.EnsureArray()
_place.EmitLoadAddress(cg.Builder);
return cg.EmitCall(ILOpCode.Call, cg.CoreMethods.PhpValue.EnsureArray)
.Expect(cg.CoreTypes.IPhpArray);
}
}
else if (type.IsOfType(cg.CoreTypes.IPhpArray))
{
// Operators.EnsureArray(ref <place>)
_place.EmitLoadAddress(cg.Builder);
if (type == cg.CoreTypes.PhpArray)
{
return cg.EmitCall(ILOpCode.Call, cg.CoreMethods.Operators.EnsureArray_PhpArrayRef)
.Expect(cg.CoreTypes.PhpArray);
}
else
{
return cg.EmitCall(ILOpCode.Call, cg.CoreMethods.Operators.EnsureArray_IPhpArrayRef)
.Expect(cg.CoreTypes.IPhpArray);
}
}
throw new NotImplementedException("EnsureArray(" + type.Name + ")");
}
// Ensure Alias (&$x)
else if (_access.IsReadRef)
{
if (type == cg.CoreTypes.PhpAlias)
{
// TODO: <place>.AddRef()
return _place.EmitLoad(cg.Builder);
}
else if (type == cg.CoreTypes.PhpValue)
{
// return <place>.EnsureAlias()
_place.EmitLoadAddress(cg.Builder);
return cg.EmitCall(ILOpCode.Call, cg.CoreMethods.PhpValue.EnsureAlias)
.Expect(cg.CoreTypes.PhpAlias);
}
else if (type == cg.CoreTypes.PhpNumber)
{
throw new NotImplementedException();
}
else
{
Debug.Assert(false, "value cannot be aliased");
// new PhpAlias((PhpValue)<place>, 1)
cg.EmitConvertToPhpValue(_place.EmitLoad(cg.Builder), 0);
return cg.Emit_PhpValue_MakeAlias();
}
}
// Read Value & Dereference eventually
else
{
if (type == cg.CoreTypes.PhpAlias)
{
_place.EmitLoad(cg.Builder);
if (_access.TargetType == cg.CoreTypes.PhpArray)
{
// <place>.Value.ToArray()
cg.Builder.EmitOpCode(ILOpCode.Ldflda);
cg.EmitSymbolToken(cg.CoreMethods.PhpAlias.Value, null);
return cg.EmitCall(ILOpCode.Call, cg.CoreMethods.PhpValue.ToArray)
.Expect(cg.CoreTypes.PhpArray);
}
return cg.Emit_PhpAlias_GetValue();
}
else if (type == cg.CoreTypes.PhpValue)
{
if (_access.TargetType == cg.CoreTypes.PhpArray)
{
// <place>.ToArray()
_place.EmitLoadAddress(cg.Builder);
return cg.EmitCall(ILOpCode.Call, cg.CoreMethods.PhpValue.ToArray)
.Expect(cg.CoreTypes.PhpArray);
}
// TODO: dereference if applicable (=> PhpValue.Alias.Value)
return _place.EmitLoad(cg.Builder);
}
else
{
return _place.EmitLoad(cg.Builder);
}
}
}