public ErroneousScriptLoaderException(Script script, AstNode entity, ElfExceptionType reason) : base(reason) { Script = script; Entity = entity; Script.ToString(); }
public ElfVmInstruction BindToAstNode(AstNode node) { // horrible, but works for now if (AstNode == null) AstNode = node; return this; }
protected ElfMethod(AstNode elfNode, ElfClass declaringType, string name, String[] args, bool varargs) : base(elfNode) { DeclaringType = declaringType; Name = name; Args = args; IsVarargs = varargs; }
public ElfClass(AstNode elfNode, String name, Type clrType) : base(elfNode) { Name = name; Ctors = new List<ClrMethod>(); Methods = new List<ElfMethod>(); ClrType = clrType; ScopeResolver = ClrType.GetScopeResolver(); InvocationResolver = ClrType.GetInvocationResolver(); }
protected ReflectionEntity(AstNode astNode) { AstNode = astNode; }
public static AstNode ReplaceMeWith(this AstNode old, AstNode @new) { return ReplaceMeWith(old, () => @new); }
public ElfClass(AstNode elfNode, String name, ElfClass rtimpl) : this(elfNode, name, rtimpl.ClrType) { Rtimpl = rtimpl; }
public NativeMethod(AstNode elfNode, ElfClass declaringType) : base(elfNode, declaringType, ((FuncDef)elfNode).Name, ((FuncDef)elfNode).Args.ToArray(), false) { FuncDef = (FuncDef)elfNode; }
private void ReplaceSubThenSelectItAndRedraw(AstNode old, AstNode @new) { ReplaceSubThenSelectItAndRedraw(old, () => @new); }
private void ReplaceSubThenSelectItAndRedraw(AstNode old, Func<AstNode> newf) { var subIsLine = _selectedSub == _selectedLine; var @new = (Expression)old.ReplaceMeWith(newf); SelectedSub = @new; if (subIsLine) SelectedLine = @new; SelectedTextBox.Text = SelectedLine.RenderPublicText(_rctx); RebuildTopPanelContent(); }
public UnexpectedCompilerException(FuncDef func, AstNode node, Exception innerException) : base(String.Empty, innerException) { Func = func; Node = node; }
private IEnumerable<ElfVmInstruction> Compile(AstNode node) { try { if (node == null) { return new ElfVmInstruction[0]; } else { IEnumerable<ElfVmInstruction> compiledImpl; switch (node.NodeType) { case AstNodeType.Block: compiledImpl = CompileBlock((Block)node); break; case AstNodeType.EmptyStatement: compiledImpl = new ElfVmInstruction[0]; break; case AstNodeType.ExpressionStatement: compiledImpl = CompileExpression((ExpressionStatement)node); break; case AstNodeType.VarStatement: compiledImpl = CompileVar((VarStatement)node); break; case AstNodeType.IfStatement: compiledImpl = CompileIf((IfStatement)node); break; case AstNodeType.ReturnStatement: compiledImpl = CompileReturn((ReturnStatement)node); break; case AstNodeType.LiteralExpression: compiledImpl = CompileLiteral((LiteralExpression)node); break; case AstNodeType.VariableExpression: compiledImpl = CompileVariable((VariableExpression)node); break; case AstNodeType.AssignmentExpression: compiledImpl = CompileAssignment((AssignmentExpression)node); break; case AstNodeType.InvocationExpression: compiledImpl = CompileInvocation((InvocationExpression)node); break; default: throw new NotSupportedException(node.ToString()); } var compiled = compiledImpl.ToArray(); compiled.ForEach(evi => evi.BindToAstNode(node)); return compiled; } } catch (Exception e) { if (e is UnexpectedCompilerException) throw; throw new UnexpectedCompilerException(Func, node, e); } }
public ClrMethod(AstNode elfNode, ElfClass declaringType, string name, MethodBase rtimpl) : base(elfNode, declaringType, name, rtimpl.GetParameters().Select(pi => pi.Name).ToArray(), rtimpl.IsVarargs()) { Rtimpl = rtimpl; }
private void SeekRootToLeafPathsRecursive(AstNode node, List<String> ln) { if (node.Children.Count() == 0) ln.Add(node.ShortTPath); node.Children.ForEach(child => SeekRootToLeafPathsRecursive(child, ln)); }
private List<String> GetAllRootToLeafPaths(AstNode root) { var ln = new List<String>(); SeekRootToLeafPathsRecursive(root, ln); return ln; }