private object MinusEqual(IScriptContext context) { object rez = context.Result; nameExpr.Evaluate(context); object rezName = context.Result; HandleOperatorArgs handling = OnHandleOperator(this, context, "-=", rezName, rez); if (handling.Cancel) { rez = handling.Result; } else { rez = minus.Evaluate(rezName, rez); } //if (!(rezName is EventInfo)) //{ // rez = RuntimeHost.GetBinaryOperator("-").Evaluate(rezName, rez); //} //else //{ // rez = new RemoveDelegate((IInvokable)rez); //} nameExpr.Assign(rez, context); return(rez); }
public override void Evaluate(IScriptContext context) { name.Evaluate(context); context.CreateScope(RuntimeHost.ScopeFactory.Create(ScopeTypes.Using, context.Scope, context.Result)); statement.Evaluate(context); context.RemoveLocalScope(); }
private void EvaluateNamePart(IScriptContext context) { NamePart.Evaluate(context); object obj = context.Result; if (Modifiers == null) { context.Result = GetMemberValue(obj, Identifier); return; } Type[] genericArguments = null; foreach (ScriptAst node in Modifiers) { //NOTE: Generic modifier should be the first among other modifiers in the list ScriptGenericsPostfix generic = node as ScriptGenericsPostfix; if (generic != null) { if (genericArguments != null) { throw new ScriptException("Wrong modifiers sequence"); } generic.Execute(context); genericArguments = (Type[])context.Result; continue; } ScriptFunctionCall functionCall = node as ScriptFunctionCall; if (functionCall != null) { CallClassMethod(obj, Identifier, functionCall, genericArguments, context); continue; } ScriptArrayResolution arrayResolution = node as ScriptArrayResolution; if (arrayResolution != null) { GetArrayValue(GetMemberValue(obj, Identifier), arrayResolution, context); continue; } } }