public ErroneousScriptLoaderException(Script script, AstNode entity, ElfExceptionType reason)
     : base(reason)
 {
     Script = script;
     Entity = entity;
     Script.ToString();
 }
Example #2
0
 public ElfVmInstruction BindToAstNode(AstNode node)
 {
     // horrible, but works for now
     if (AstNode == null) 
         AstNode = node; 
     return this;
 }
Example #3
0
 protected ElfMethod(AstNode elfNode, ElfClass declaringType, string name, String[] args, bool varargs) 
     : base(elfNode)
 {
     DeclaringType = declaringType;
     Name = name;
     Args = args;
     IsVarargs = varargs;
 }
Example #4
0
        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();
        }
Example #5
0
 protected ReflectionEntity(AstNode astNode) 
 {
     AstNode = astNode;
 }
Example #6
0
 public static AstNode ReplaceMeWith(this AstNode old, AstNode @new)
 {
     return ReplaceMeWith(old, () => @new);
 }
Example #7
0
 public ElfClass(AstNode elfNode, String name, ElfClass rtimpl)
     : this(elfNode, name, rtimpl.ClrType)
 {
     Rtimpl = rtimpl;
 }
Example #8
0
 public NativeMethod(AstNode elfNode, ElfClass declaringType)
     : base(elfNode, declaringType, ((FuncDef)elfNode).Name, ((FuncDef)elfNode).Args.ToArray(), false) 
 {
     FuncDef = (FuncDef)elfNode;
 }
Example #9
0
 private void ReplaceSubThenSelectItAndRedraw(AstNode old, AstNode @new)
 {
     ReplaceSubThenSelectItAndRedraw(old, () => @new);
 }
Example #10
0
        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;
 }
Example #12
0
        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);
            }
        }
Example #13
0
 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;
 }
Example #14
0
 private void SeekRootToLeafPathsRecursive(AstNode node, List<String> ln)
 {
     if (node.Children.Count() == 0) ln.Add(node.ShortTPath);
     node.Children.ForEach(child => SeekRootToLeafPathsRecursive(child, ln));
 }
Example #15
0
 private List<String> GetAllRootToLeafPaths(AstNode root)
 {
     var ln = new List<String>();
     SeekRootToLeafPathsRecursive(root, ln);
     return ln;
 }