public override CompiledFragment Compile(CompiledMethod method) { if (FirstChild == null) { return(null); } // Apply the current line: method.CurrentLine = LineNumber; try{ // Compile operator chains: (d=a+b+c;) CompilationServices.CompileOperators(this, method); // Compile the now singular operator: CompiledFragment cFrag = FirstChild.Compile(method) as CompiledFragment; return(cFrag); }catch (CompilationException e) { if (e.LineNumber == -1) { // Setup line number: e.LineNumber = LineNumber; } // Rethrow: throw e; } }
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 IfOperation(CompiledMethod method, BracketFragment condition, BracketFragment ifTrue, BracketFragment ifFalse) : base(method) { IfTrue = ifTrue; IfFalse = ifFalse; Conditions = CompilationServices.CompileParameters(condition, method); if (Conditions == null || Conditions.Length == 0) { Error("An if was defined but with nothing to check (e.g. if(this is empty!){..} )"); } }
public ConstructOperation(TypeFragment type, BracketFragment brackets, CompiledMethod method) : base(method) { if (type == null) { Error("A constructor is missing the type to construct. E.g. new myClass();"); } ObjectType = type.FindType(method.Script); if (ObjectType == null) { Error("Couldn't find type '" + type + "'."); } // Compile the brackets - what types to they have? Parameters = CompilationServices.CompileParameters(brackets, method); SetConstructor(); }
public override CompiledFragment Compile(CompiledMethod parent) { return(new ArrayOperation(parent, ArrayType.FindType(parent.Script), null, CompilationServices.CompileParameters(Defaults, parent))); }
public override CompiledFragment Compile(CompiledMethod parentBlock) { return(new IndexOperation(parentBlock, Variable.Compile(parentBlock), CompilationServices.CompileParameters(Brackets, parentBlock))); }
/// <summary>Attempts to compile this bracket to IL, assuming it is the body of a method.</summary> /// <param name="method">The method that is being compiled.</param> /// <returns>True if the method returns something.</returns> public bool CompileBody(CompiledMethod method) { Compile(method); return(CompilationServices.CompileOperations(this, method)); }
public ForOperation(CompiledMethod method, BracketFragment rules, BracketFragment body) : base(method) { Body = body; Parameters = CompilationServices.CompileParameters(rules, method); }