public override CompiledFragment Compile(CompiledMethod method) { CompiledFragment cfrag = MethodName.Compile(method); if (!Types.IsTypeOf(cfrag.ActiveValue(), typeof(ISettable))) { Error("Unable to compile a method call - didn't recognise an invokable object."); } CompiledFragment[] parameters = CompilationServices.CompileParameters(Brackets, method); return(new MethodOperation(method, cfrag, parameters)); }
public SwitchOperation(CompiledMethod method, BracketFragment switching, BracketFragment body) : base(method) { Body = body; if (switching.ChildCount() != 1) { switching.Error("Too many entries inside this switches brackets. Should be e.g. switch(name){ .. }"); } // Compile the switching frag: CompiledFragment variableFrag = switching.FirstChild.Compile(method); // Get the active value - this should be a variable object: object activeValue = variableFrag.ActiveValue(); // Try and apply it: Switching = activeValue as Variable; if (Switching == null) { switching.Error("Can only switch variables."); } }