本文整理汇总了C#中PHP.Compiler.Expression类的典型用法代码示例。如果您正苦于以下问题:C# Expression类的具体用法?C# Expression怎么用?C# Expression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Expression类属于PHP.Compiler命名空间,在下文中一共展示了Expression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RETURN
public RETURN(Expression expr, int line, int column)
: base(line, column)
{
Expr = expr;
}
示例2: IS_NOT_IDENTICAL
public IS_NOT_IDENTICAL(Expression expr1, Expression expr2, int line, int column)
: base(expr1, expr2, line, column)
{
}
示例3: StoreToObjectOperator
public void StoreToObjectOperator(OBJECT_OPERATOR oo, Expression value) {
// warn if left part is a function call
if (oo.Expr1 is FUNCTION_CALL) {
FUNCTION_CALL fc = (FUNCTION_CALL)oo.Expr1;
Report.Warn(404, fc.FunctionName, fc.Line, fc.Column);
if (ObjectOperatorInProgress) {
IlGen.Emit(OpCodes.Pop);
ObjectOperatorInProgress = false;
}
return;
}
// process left part
ObjectOperatorInProgress = true;
// local variable
if (oo.Expr1 is VARIABLE) {
VARIABLE var = (VARIABLE)oo.Expr1;
// handle $this->
if (var.Name == "$this") {
ProcessingObjectThisWhenStoring = true;
// if this is a static context, load object from which this static context was called
if (FD.Modifiers.Contains(Modifiers.STATIC)) {
Report.Warn(502, var.Line, var.Column);
IlGen.Emit(OpCodes.Ldsfld, PHPRuntimeCore.GetField("ThisForStaticContext"));
}
// otherwise load current object
else
IlGen.Emit(OpCodes.Ldarg_0);
if (var.Offset != null)
Report.Warn(401, CD.Name, var.Offset.Line, var.Offset.Column);
}
// some variable
else if (var.Name.StartsWith("$")) {
ProcessingObjectThisWhenStoring = false;
Visit(var);
}
// class member
else {
// if processing a class member of $this (of a non-static context), load directly
if (ProcessingObjectThisWhenStoring && !FD.Modifiers.Contains(Modifiers.STATIC))
LoadFromClassMemberOfThis(var.Name, var.Line, var.Column);
// else load at runtime by reflection
else
LoadFromClassMemberOfAnotherObject(var.Name);
ProcessingObjectThisWhenStoring = false;
// process offset, if available
if (var.Offset != null) {
// this is an array
if (var.Offset.Kind == OFFSET.SQUARE) {
if (var.Offset.Value == null)
IlGen.Emit(OpCodes.Ldnull);
else
Visit(var.Offset);
IlGen.Emit(OpCodes.Ldc_I4, OFFSET.SQUARE);
IlGen.Emit(OpCodes.Call, PHPRuntimeCore.GetMethod("Offset", new Type[] { typeof(object), typeof(object), typeof(int) }));
}
}
}
}
// paamayim nekudotayim
else if (oo.Expr1 is PAAMAYIM_NEKUDOTAYIM) {
PAAMAYIM_NEKUDOTAYIM pn = (PAAMAYIM_NEKUDOTAYIM)oo.Expr1;
LoadFromPaamayimNekudotayim(pn);
}
// process right part
if (oo.Expr2 is OBJECT_OPERATOR)
StoreToObjectOperator((OBJECT_OPERATOR)oo.Expr2, value);
else if (oo.Expr2 is VARIABLE) {
VARIABLE var2 = (VARIABLE)oo.Expr2;
// no offset available, so store to class member
if (var2.Offset == null) {
Visit(value);
// if processing a class member of $this, store directly
if (ProcessingObjectThisWhenStoring)
StoreToClassMemberOfThis(var2.Name, var2.Line, var2.Column);
// else store at runtime by reflection
else
StoreToClassMemberOfAnotherObject(var2.Name);
}
// array offset available, so store to specified place
else if (var2.Offset.Kind == OFFSET.SQUARE) {
IlGen.Emit(OpCodes.Dup);
IlGen.Emit(OpCodes.Dup);
// if processing a class member of $this, load directly
if (ProcessingObjectThisWhenStoring)
LoadFromClassMemberOfThis(var2.Name, var2.Line, var2.Column);
// else load at runtime by reflection
else
LoadFromClassMemberOfAnotherObject(var2.Name);
// if array loaded is null, create a new one and store
Label skip = IlGen.DefineLabel();
Label join = IlGen.DefineLabel();
IlGen.Emit(OpCodes.Brtrue, skip);
IlGen.Emit(OpCodes.Newobj, PHPArray.GetConstructor(Type.EmptyTypes));
// if processing a class member of $this, store directly
if (ProcessingObjectThisWhenStoring)
StoreToClassMemberOfThis(var2.Name, var2.Line, var2.Column);
// else store at runtime by reflection
else
StoreToClassMemberOfAnotherObject(var2.Name);
IlGen.Emit(OpCodes.Br, join);
//.........这里部分代码省略.........
示例4: INC
public INC(Expression expr, int kind, int line, int column)
: base(expr, line, column)
{
Kind = kind;
}
示例5: INT_CAST
public INT_CAST(Expression expr, int line, int column)
: base(expr, line, column)
{
}
示例6: ARRAY_PAIR
public ARRAY_PAIR(Expression key, Expression value, int line, int column)
: base(line, column)
{
Key = key;
Value = value;
}
示例7: IF
public IF(Expression expr, Statement stmt, ArrayList elseifList, Statement elseStmt, int line, int column)
: base(line, column)
{
Expr = expr;
Stmt = stmt;
ElseifList = elseifList;
ElseStmt = elseStmt;
}
示例8: BOOLEAN_OR
public BOOLEAN_OR(Expression expr1, Expression expr2, int line, int column)
: base(expr1, expr2, line, column)
{
}
示例9: BREAK
public BREAK(Expression expr, int line, int column)
: base(line, column)
{
Expr = expr;
}
示例10: UnaryExpression
public UnaryExpression(Expression expr, int line, int column)
: base(line, column)
{
Expr = expr;
}
示例11: BOOLEAN_NOT
public BOOLEAN_NOT(Expression expr, int line, int column)
: base(expr, line, column)
{
}
示例12: THROW
public THROW(Expression expr, int line, int column)
: base(line, column)
{
Expr = expr;
}
示例13: TernaryExpression
public TernaryExpression(Expression expr1, Expression expr2, Expression expr3, int line, int column)
: base(line, column)
{
Expr1 = expr1;
Expr2 = expr2;
Expr3 = expr3;
}
示例14: SWITCH
public SWITCH(Expression expr, ArrayList switchCaseList, int line, int column)
: base(line, column)
{
Expr = expr;
SwitchCaseList = switchCaseList;
}
示例15: EXPRESSION_AS_STATEMENT
public EXPRESSION_AS_STATEMENT(Expression expr, int line, int column)
: base(line, column)
{
Expr = expr;
}