本文整理汇总了C#中System.Reflection.Emit.CodeGenerator.EmitLoadScriptContext方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenerator.EmitLoadScriptContext方法的具体用法?C# CodeGenerator.EmitLoadScriptContext怎么用?C# CodeGenerator.EmitLoadScriptContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Emit.CodeGenerator
的用法示例。
在下文中一共展示了CodeGenerator.EmitLoadScriptContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitDynamicInclusion
/// <summary>
/// Emits dynamic inclusion.
/// </summary>
private PhpTypeCode EmitDynamicInclusion(CodeGenerator/*!*/ codeGenerator)
{
// do not generate dynamic auto inclusions:
if (InclusionTypesEnum.IsAutoInclusion(inclusionType))
return PhpTypeCode.Void;
ILEmitter il = codeGenerator.IL;
// CALL context.DynamicInclude(<file name>,<relative includer source path>,variables,self,includer);
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitConversion(fileNameEx, PhpTypeCode.String);
il.Emit(OpCodes.Ldstr, codeGenerator.SourceUnit.SourceFile.RelativePath.ToString());
codeGenerator.EmitLoadRTVariablesTable();
codeGenerator.EmitLoadSelf();
codeGenerator.EmitLoadClassContext();
il.LoadLiteral(inclusionType);
il.Emit(OpCodes.Call, Methods.ScriptContext.DynamicInclude);
return PhpTypeCode.Object;
}
示例2: EmitReadField
/// <summary>
/// Emits IL instructions that read the value of an instance field.
/// </summary>
/// <param name="codeGenerator">The current <see cref="CodeGenerator"/>.</param>
/// <param name="wantRef">If <B>false</B> the field value should be left on the evaluation stack,
/// if <B>true</B> the <see cref="PhpReference"/> should be left on the evaluation stack.</param>
/// <returns>
/// Nothing is expected on the evaluation stack. A <see cref="PhpReference"/> (if <paramref name="wantRef"/>
/// is <B>true</B>) or the field value itself (if <paramref name="wantRef"/> is <B>false</B>) is left on the
/// evaluation stack.
/// </returns>
internal virtual PhpTypeCode EmitReadField(CodeGenerator codeGenerator, bool wantRef)
{
ILEmitter il = codeGenerator.IL;
DirectVarUse direct_instance = isMemberOf as DirectVarUse;
if (direct_instance != null && direct_instance.IsMemberOf == null && direct_instance.VarName.IsThisVariableName)
{
return EmitReadFieldOfThis(codeGenerator, wantRef);
}
if (!wantRef)
{
//codeGenerator.ChainBuilder.Lengthen();
//PhpTypeCode type_code = isMemberOf.Emit(codeGenerator);
//Debug.Assert(type_code == PhpTypeCode.Object || type_code == PhpTypeCode.DObject);
//// CALL Operators.GetProperty(STACK,<field name>,<type desc>,<quiet>);
//EmitName(codeGenerator);
//codeGenerator.EmitLoadClassContext();
//il.LoadBool(codeGenerator.ChainBuilder.QuietRead);
//il.Emit(OpCodes.Call, Methods.Operators.GetProperty);
//return PhpTypeCode.Object;
string fieldName = (this is DirectVarUse) ? ((DirectVarUse)this).VarName.Value : null;
Expression fieldNameExpr = (this is IndirectVarUse) ? ((IndirectVarUse)this).VarNameEx : null;
bool quietRead = wantRef ? false : codeGenerator.ChainBuilder.QuietRead;
return codeGenerator.CallSitesBuilder.EmitGetProperty(
codeGenerator, wantRef,
isMemberOf, null, null,
null,
fieldName, fieldNameExpr,
quietRead);
}
// call GetProperty/GetObjectPropertyRef
codeGenerator.ChainBuilder.Lengthen();
// loads the variable which field is gotten:
PhpTypeCode var_type_code = isMemberOf.Emit(codeGenerator);
if (codeGenerator.ChainBuilder.Exists)
{
Debug.Assert(var_type_code == PhpTypeCode.DObject);
// CALL Operators.GetObjectPropertyRef(STACK,<field name>,<type desc>);
EmitName(codeGenerator);
codeGenerator.EmitLoadClassContext();
il.Emit(OpCodes.Call, Methods.Operators.GetObjectPropertyRef);
}
else
{
Debug.Assert(var_type_code == PhpTypeCode.ObjectAddress);
// CALL Operators.GetPropertyRef(ref STACK,<field name>,<type desc>,<script context>);
EmitName(codeGenerator);
codeGenerator.EmitLoadClassContext();
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Call, Methods.Operators.GetPropertyRef);
// stores the value of variable back:
SimpleVarUse simple_var = isMemberOf as SimpleVarUse;
if (simple_var != null)
simple_var.EmitLoadAddress_StoreBack(codeGenerator);
}
return PhpTypeCode.PhpReference;
}
示例3: StoreTabledVariableBack
/// <summary>
/// Stores the value represented by <see cref="TabledLocalAddressStorage"/> to the runtime variables table and
/// returns the <see cref="TabledLocalAddressStorage"/> back to <see cref="ILEmitter.temporaryLocals"/>.
/// Duplicates the value if requested.
/// </summary>
/// <param name="codeGenerator">Currently used <see cref="CodeGenerator"/>.</param>
/// <param name="duplicate_value">If <c>true</c>, the value of specified local is left on the evaluation stack.
/// </param>
internal virtual void StoreTabledVariableBack(CodeGenerator codeGenerator, bool duplicate_value)
{
ILEmitter il = codeGenerator.IL;
// CALL Operators.SetVariable(<local variables table>,<name>,<TabledLocalAddressStorage>);
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
EmitName(codeGenerator);
il.Ldloc(TabledLocalAddressStorage);
il.Emit(OpCodes.Call, Methods.Operators.SetVariable);
// If requested, load the changed value on the evaluation stack
if (duplicate_value)
il.Ldloc(this.TabledLocalAddressStorage);
// Release temporary local
il.ReturnTemporaryLocal(this.TabledLocalAddressStorage);
}
示例4: EmitStaticInclusion
/// <summary>
/// Emits a static inclusion.
/// </summary>
private PhpTypeCode EmitStaticInclusion(CodeGenerator/*!*/ codeGenerator)
{
ILEmitter il = codeGenerator.IL;
Label endif_label = il.DefineLabel();
Label else_label = il.DefineLabel();
MethodInfo method;
// if the expression should be emitted:
if (characteristic == Characteristic.StaticArgEvaluated)
{
if (!(fileNameEx is StringLiteral || fileNameEx is BinaryStringLiteral))
{
// emits expression evaluation and ignores the result:
fileNameEx.Emit(codeGenerator);
il.Emit(OpCodes.Pop);
}
}
if (characteristic == Characteristic.StaticAutoInclusion)
{
// calls the Main routine only if this script is the main one:
il.Ldarg(ScriptBuilder.ArgIsMain);
}
else
{
RelativePath relativePath = new RelativePath(inclusion.Includee.RelativeSourcePath); // normalize the relative path
// CALL context.StaticInclude(<relative included script source path>,<this script type>,<inclusion type>);
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Ldc_I4, (int)relativePath.Level);
il.Emit(OpCodes.Ldstr, relativePath.Path);
il.Emit(OpCodes.Ldtoken, inclusion.Includee.ScriptClassType);
il.LoadLiteral(inclusionType);
il.Emit(OpCodes.Call, Methods.ScriptContext.StaticInclude);
}
// IF (STACK)
il.Emit(OpCodes.Brfalse, else_label);
if (true)
{
// emits a call to the main helper of the included script:
method = inclusion.Includee.MainHelper;
// CALL <Main>(context, variables, self, includer, false):
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
codeGenerator.EmitLoadSelf();
codeGenerator.EmitLoadClassContext();
il.Emit(OpCodes.Ldc_I4_0);
il.Emit(OpCodes.Call, method);
il.Emit(OpCodes.Br, endif_label);
}
// ELSE
il.MarkLabel(else_label);
if (true)
{
// LOAD <PhpScript.SkippedIncludeReturnValue>;
il.LoadLiteral(ScriptModule.SkippedIncludeReturnValue);
il.Emit(OpCodes.Box, ScriptModule.SkippedIncludeReturnValue.GetType());
}
il.MarkLabel(endif_label);
// END IF
return PhpTypeCode.Object;
}
示例5: UnsetLocal
///// <summary>
///// Prepares local variable for a store operation.
///// </summary>
//internal void StoreLocalPrepare(CodeGenerator codeGenerator, VariablesTable.Entry variable, LocalBuilder variableName)
//{
// Debug.Assert(variable == null ^ variableName == null);
//}
/// <summary>
/// Unsets a specified variable.
/// </summary>
internal void UnsetLocal(CodeGenerator codeGenerator, VariablesTable.Entry variable, LocalBuilder variableName)
{
ILEmitter il = codeGenerator.IL;
Debug.Assert(variable == null ^ variableName == null);
if (variable != null)
{
if (variable.IsPhpReference)
{
// <variable> = new PhpReference();
il.Emit(OpCodes.Newobj, Constructors.PhpReference_Void);
variable.Variable.EmitStore(il);
}
else
{
il.Emit(OpCodes.Ldnull);
variable.Variable.EmitStore(il);
}
}
else
{
// CALL Operators.SetVariable(<local variables table>,<name>,null);
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
il.Ldloc(variableName);
il.Emit(OpCodes.Ldnull);
il.Emit(OpCodes.Call, Methods.Operators.SetVariable);
}
}
示例6: LoadLocal
/// <summary>
/// Loads a value of a specified variable. If the variable is of type <see cref="PhpReference"/>, it is dereferenced.
/// </summary>
internal void LoadLocal(CodeGenerator codeGenerator, VariablesTable.Entry variable, LocalBuilder variableName)
{
ILEmitter il = codeGenerator.IL;
Debug.Assert(variable == null ^ variableName == null);
if (variable != null)
{
// LOAD DEREF <variable>;
variable.Variable.EmitLoad(il);
if (variable.IsPhpReference)
il.Emit(OpCodes.Ldfld, Fields.PhpReference_Value);
}
else
{
// LOAD Operators.GetVariable[Unchecked](<script context>, <local variables table>, <variable name>);
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
il.Ldloc(variableName);
if (codeGenerator.ChainBuilder.QuietRead)
il.Emit(OpCodes.Call, Methods.Operators.GetVariableUnchecked);
else
il.Emit(OpCodes.Call, Methods.Operators.GetVariable);
}
}
示例7: EmitLoadRef
internal override void EmitLoadRef(CodeGenerator codeGenerator)
{
ILEmitter il = codeGenerator.IL;
if (codeGenerator.OptimizedLocals)
{
// For IndirectVarUse emit switch over all variables.
EmitSwitch(codeGenerator, new SwitchMethod(LoadLocalRef));
}
else
{
// Template:
// PhpReference Operators.GetVariableRef(IDictionary table, string name) //returns variable value; variable is of type PhpReference
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
EmitName(codeGenerator);
il.Emit(OpCodes.Call, Methods.Operators.GetVariableRef);
}
}
示例8: EmitUnset
internal override void EmitUnset(CodeGenerator codeGenerator)
{
//Template: "unset($$x)" $$x = null;
//Template: "unset(x)" x = null
Debug.Assert(access == AccessType.Read);
// Cases 1, 4, 5, 6, 9 never reached
Debug.Assert(codeGenerator.ChainBuilder.IsMember == false);
// Case 3 never reached
Debug.Assert(codeGenerator.ChainBuilder.IsArrayItem == false);
codeGenerator.ChainBuilder.QuietRead = true;
// 2, 7, 8
if (this.isMemberOf != null)
{
// 2: $b->$a
// 8: b[]->$a
codeGenerator.ChainBuilder.Create();
codeGenerator.ChainBuilder.Begin();
EmitUnsetField(codeGenerator);
codeGenerator.ChainBuilder.End();
return;
}
// 7: $a
// Unset this variable
//codeGenerator.EmitVariableUnset(this);
ILEmitter il = codeGenerator.IL;
if (codeGenerator.OptimizedLocals)
{
// /*copypaste bug*/EmitSwitch(codeGenerator, new SwitchMethod(StoreLocalPrepare));
EmitSwitch(codeGenerator, new SwitchMethod(UnsetLocal));
}
else
{
// CALL Operators.UnsetVariable(<script context>, <local variable table>, <variable name>);
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
EmitName(codeGenerator);
il.Emit(OpCodes.Call, Methods.Operators.UnsetVariable);
}
}
示例9: EmitStorePrepare
internal override void EmitStorePrepare(CodeGenerator codeGenerator)
{
ILEmitter il = codeGenerator.IL;
if (varName.IsThisVariableName)
{
// Error throwing code will be emitted in EmitVariableStoreAssign
}
else if (codeGenerator.VariableIsAutoGlobal(varName))
{
// Check if the variable is auto-global
codeGenerator.EmitAutoGlobalStorePrepare(varName);
}
else if (codeGenerator.OptimizedLocals)
{
// Template:
// "WRITE($x,value);"
// **** // if specified variable is of type PhpReference
// ldloc local
// **** // Otherwise do nothing
VariablesTable.Entry entry = codeGenerator.CurrentVariablesTable[varName];
if (entry.IsPhpReference)
{
entry.Variable.EmitLoad(il);
}
// Otherwise do nothing
// Now load the value, then call EmitVariableStoreAssignOptimized() to store the value ...
}
else
{
// Template:
// void Operators.SetVariable(table, "x", PhpVariable.Copy(Operators.getValue(table, "x"), CopyReason.Assigned));
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
EmitName(codeGenerator);
// Now load the value, then call SetVariable() to store the value ...
}
}
示例10: Emit
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Emit"]/*'/>
internal override PhpTypeCode Emit(CodeGenerator/*!*/ codeGenerator)
{
Debug.Assert(access == AccessType.None || access == AccessType.Read);
Statistics.AST.AddNode("ExitEx");
codeGenerator.EmitLoadScriptContext();
if (resultExpr == null)
{
codeGenerator.IL.Emit(OpCodes.Ldnull);
}
else
{
codeGenerator.EmitBoxing(resultExpr.Emit(codeGenerator));
}
codeGenerator.IL.Emit(OpCodes.Call, Methods.ScriptContext.Die);
if (access == AccessType.Read)
{
codeGenerator.IL.Emit(OpCodes.Ldnull);
return PhpTypeCode.Object;
}
else return PhpTypeCode.Void;
}
示例11: EmitDefinition
internal void EmitDefinition(CodeGenerator/*!*/ codeGenerator)
{
if (type.IsComplete)
{
Debug.Assert(type.IsComplete, "Incomplete types should be converted to evals.");
Debug.Assert(type.RealTypeBuilder != null, "A class declared during compilation should have a type builder.");
attributes.Emit(codeGenerator, this);
typeSignature.Emit(codeGenerator);
codeGenerator.EnterTypeDeclaration(type);
foreach (TypeMemberDecl member_decl in members)
{
member_decl.EnterCodegenerator(codeGenerator);
member_decl.Emit(codeGenerator);
member_decl.LeaveCodegenerator(codeGenerator);
}
// emit stubs for implemented methods & properties that were not declared by this type:
codeGenerator.EmitGhostStubs(type);
codeGenerator.LeaveTypeDeclaration();
}
else
{
Debug.Assert(this.typeDefinitionCode != null);
// LOAD DynamicCode.Eval(<code>, context, definedVariables, self, includer, source, line, column, evalId)
// wrap Eval into static method
MethodBuilder method = codeGenerator.IL.TypeBuilder.DefineMethod(
string.Format("{0}{1}", ScriptModule.DeclareHelperNane, type.FullName),
MethodAttributes.Private | MethodAttributes.Static | MethodAttributes.SpecialName,
Types.Void, Types.ScriptContext);
var il = new ILEmitter(method);
codeGenerator.EnterLambdaDeclaration(il, false, LiteralPlace.Null, new IndexedPlace(PlaceHolder.Argument, 0), LiteralPlace.Null, LiteralPlace.Null);
if (true)
{
codeGenerator.EmitEval(
EvalKinds.SyntheticEval,
new StringLiteral(position, this.typeDefinitionCode, AccessType.Read),
position,
(this.Namespace != null) ? this.Namespace.QualifiedName : (QualifiedName?)null, this.validAliases);
il.Emit(OpCodes.Pop);
il.Emit(OpCodes.Ret);
}
codeGenerator.LeaveFunctionDeclaration();
//
il = codeGenerator.IL;
type.IncompleteClassDeclareMethodInfo = method;
type.IncompleteClassDeclarationId = String.Format("{0}${1}:{2}:{3}", type.FullName, unchecked((uint)codeGenerator.SourceUnit.SourceFile.ToString().GetHashCode()), position.FirstLine, position.FirstColumn);
// sequence point here
codeGenerator.MarkSequencePoint(position.FirstLine, position.FirstColumn, position.LastLine, position.LastColumn + 2);
if (type.Declaration.IsConditional)
{
// CALL <Declare>.<FullName>(<context>)
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Call, method);
}
else
{
// if (!<context>.IncompleteTypeDeclared(<id>))
// CALL <Declare>.<FullName>(<context>)
var end_if = il.DefineLabel();
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Ldstr, type.IncompleteClassDeclarationId);
il.Emit(OpCodes.Call, Methods.ScriptContext.IncompleteTypeDeclared);
il.Emit(OpCodes.Brtrue, end_if);
if (true)
{
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Call, type.IncompleteClassDeclareMethodInfo);
}
il.MarkLabel(end_if);
il.ForgetLabel(end_if);
}
}
}
示例12: Emit
internal override void Emit(CodeGenerator/*!*/ codeGenerator)
{
codeGenerator.MarkSequencePoint(
position.FirstLine,
position.FirstColumn,
position.LastLine,
position.LastColumn + 1
);
// CALL Operators.Throw(<context>, <expression>);
codeGenerator.EmitLoadScriptContext();
expression.Emit(codeGenerator);
codeGenerator.IL.Emit(OpCodes.Call, Methods.Operators.Throw);
}
示例13: LoadTabledVariableAddress
/// <summary>
/// Loads the value represented by this object from the runtime variables table,
/// stores it to a local variable and loads the address of this local.
/// </summary>
/// <remarks>This method is used only in non-optimized user functions and global code.
/// Specified local variable is obtained from current <see cref="ILEmitter"/> by
/// <see cref="ILEmitter.GetTemporaryLocal"/> and stored to <see cref="TabledLocalAddressStorage"/>
/// for later use. Once the local become useless, <see cref="ILEmitter.ReturnTemporaryLocal"/>
/// should be called.
/// </remarks>
/// <param name="codeGenerator">Currently used <see cref="CodeGenerator"/>.</param>
internal virtual void LoadTabledVariableAddress(CodeGenerator codeGenerator)
{
// This function should be call only once on every SimpleVarUse object
// TODO: ASSERTION FAILS (e.g. PhpMyAdmin, common.lib.php)
// Debug.Assert(this.TabledLocalAddressStorage == null);
ILEmitter il = codeGenerator.IL;
// Load the value represented by this node from the runtime variables table
// LOAD Operators.GetVariableUnchecked(<script context>, <local variables table>, <variable name>);
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
EmitName(codeGenerator);
codeGenerator.IL.Emit(OpCodes.Call, Methods.Operators.GetVariableUnchecked);
// Get local from ILEmitter
this.TabledLocalAddressStorage = il.GetTemporaryLocal(Types.Object[0]);
// Store the value
il.Stloc(this.TabledLocalAddressStorage);
// Load the address
il.Ldloca(this.TabledLocalAddressStorage);
}
示例14: EmitStoreRefPrepare
internal override void EmitStoreRefPrepare(CodeGenerator codeGenerator)
{
ILEmitter il = codeGenerator.IL;
if (varName.IsThisVariableName)
{
// error throwing code will be emitted in EmitVariableStoreRefAssign
}
else if (codeGenerator.VariableIsAutoGlobal(varName))
{
// Check if the variable is auto-global
codeGenerator.EmitAutoGlobalStoreRefPrepare(varName);
}
else if (codeGenerator.OptimizedLocals)
{
// Template:
// WRITE ref ($x,value);
// DO NOTHING !!!!
// now load the value then store to local variable
}
else
{
// Template:
// WRITE ref ($x,value); // by Martin
//
// ldarg.1
// ldstr "name"
// LOAD value
// call instance IDictionary.set_Item(object)
codeGenerator.EmitLoadScriptContext();
codeGenerator.EmitLoadRTVariablesTable();
EmitName(codeGenerator);
// now load value, then call EmitVariableStoreRefAssignGlobalContext() to emit stfld ...
}
}
示例15: Emit
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Emit"]/*'/>
internal override PhpTypeCode Emit(CodeGenerator/*!*/ codeGenerator)
{
Debug.Assert(access == AccessType.Read || access == AccessType.None);
Statistics.AST.AddNode("UnaryEx");
ILEmitter il = codeGenerator.IL;
PhpTypeCode returned_typecode, o_typecode;
switch (operation)
{
case Operations.AtSign: // special arrangement
// Template:
// context.DisableErrorReporting();
// s;
// context.EnableErrorReporting();
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Call, Methods.ScriptContext.DisableErrorReporting);
returned_typecode = expr.Emit(codeGenerator);
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Call, Methods.ScriptContext.EnableErrorReporting);
break;
case Operations.BitNegation:
//Template: "~x" Operators.BitNot(x)
codeGenerator.EmitBoxing(expr.Emit(codeGenerator));
il.Emit(OpCodes.Call, Methods.Operators.BitNot);
returned_typecode = PhpTypeCode.Object;
break;
case Operations.Clone:
// Template: clone x Operators.Clone(x,DTypeDesc,ScriptContext)
codeGenerator.EmitBoxing(expr.Emit(codeGenerator));
codeGenerator.EmitLoadClassContext();
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Call, Methods.Operators.Clone);
returned_typecode = PhpTypeCode.Object;
break;
case Operations.LogicNegation:
//Template: "!x" !Convert.ObjectToBoolean(x);
if (((returned_typecode = expr.Emit(codeGenerator)) != PhpTypeCode.Boolean))
{
codeGenerator.EmitBoxing(returned_typecode);
il.Emit(OpCodes.Call, Methods.Convert.ObjectToBoolean);
}
il.Emit(OpCodes.Ldc_I4_0);
il.Emit(OpCodes.Ceq);
returned_typecode = PhpTypeCode.Boolean;
break;
case Operations.Minus:
//Template: "-x" Operators.Minus(x)
switch (o_typecode = expr.Emit(codeGenerator))
{
case PhpTypeCode.Double:
il.Emit(OpCodes.Neg);
returned_typecode = PhpTypeCode.Double;
break;
default:
codeGenerator.EmitBoxing(o_typecode);
returned_typecode = codeGenerator.EmitMethodCall(Methods.Operators.Minus);
break;
}
break;
case Operations.ObjectCast:
//Template: "(object)x" Convert.ObjectToDObject(x,ScriptContext)
codeGenerator.EmitBoxing(expr.Emit(codeGenerator));
codeGenerator.EmitLoadScriptContext();
il.Emit(OpCodes.Call, Methods.Convert.ObjectToDObject);
returned_typecode = PhpTypeCode.Object;
break;
case Operations.Plus:
//Template: "+x" Operators.Plus(x)
codeGenerator.EmitBoxing(expr.Emit(codeGenerator));
il.Emit(OpCodes.Call, Methods.Operators.Plus);
returned_typecode = PhpTypeCode.Object;
break;
case Operations.Print:
codeGenerator.EmitEcho(this.expr);
// Always returns 1
il.Emit(OpCodes.Ldc_I4_1);
returned_typecode = PhpTypeCode.Integer;
break;
case Operations.BoolCast:
//Template: "(bool)x" Convert.ObjectToBoolean(x)
if (((returned_typecode = expr.Emit(codeGenerator)) != PhpTypeCode.Boolean))
{
codeGenerator.EmitBoxing(returned_typecode);
il.Emit(OpCodes.Call, Methods.Convert.ObjectToBoolean);
returned_typecode = PhpTypeCode.Boolean;
}
break;
case Operations.Int8Cast:
//.........这里部分代码省略.........