/// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 private void OnDragStart(DragEventArgs e)
 {
     TreeComponent.DragItem = SelfNode;
     SelfNode.Expand(false);
     if (TreeComponent.OnDragStart.HasDelegate)
     {
         TreeComponent.OnDragStart.InvokeAsync(new TreeEventArgs <TItem>(TreeComponent, SelfNode));
     }
 }
 /// <summary>
 /// Leaving releases the target
 /// </summary>
 /// <param name="e"></param>
 private void OnDragLeave(DragEventArgs e)
 {
     SelfNode.DragTarget = false;
     SelfNode.SetParentTargetContainer();
     if (TreeComponent.OnDragLeave.HasDelegate)
     {
         TreeComponent.OnDragLeave.InvokeAsync(new TreeEventArgs <TItem>(TreeComponent, SelfNode));
     }
 }
        public void CheckSemantic(SelfNode node, IScope scope = null)
        {
            while (!(scope is IType))
            {
                scope = scope?.ParentScope;
            }

            node.Symbol       = ((IType)scope).Self;
            node.ComputedType = node.Symbol.Type;
        }
Example #4
0
        public void AddRuleSetCommandAddsSelfNode()
        {
            AddRuleSetNodeCommand cmd = new AddRuleSetNodeCommand(ServiceProvider);

            cmd.Execute(ApplicationNode);

            SelfNode selNode = (SelfNode)Hierarchy.FindNodeByType(typeof(SelfNode));

            Assert.IsNotNull(selNode);
        }
Example #5
0
        public ExpressionNode BuildExpression(bool enableValidation)
        {
            ExpressionNode pathRoot = null;
            ExpressionNode path     = null;

            foreach (var element in _elements)
            {
                ExpressionNode node = null;
                switch (element)
                {
                case NotExpressionPathElement _:
                    node = new LogicalNotNode();
                    break;

                case PropertyElement prop:
                    node = new PropertyAccessorNode(prop.Property.Name, enableValidation, new PropertyInfoAccessorPlugin(prop.Property, prop.AccessorFactory));
                    break;

                case ArrayElementPathElement arr:
                    node = new PropertyAccessorNode(CommonPropertyNames.IndexerName, enableValidation, new ArrayElementPlugin(arr.Indices, arr.ElementType));
                    break;

                case VisualAncestorPathElement visualAncestor:
                    node = new FindVisualAncestorNode(visualAncestor.AncestorType, visualAncestor.Level);
                    break;

                case AncestorPathElement ancestor:
                    node = new FindAncestorNode(ancestor.AncestorType, ancestor.Level);
                    break;

                case SelfPathElement _:
                    node = new SelfNode();
                    break;

                case ElementNameElement name:
                    node = new ElementNameNode(name.NameScope, name.Name);
                    break;

                case IStronglyTypedStreamElement stream:
                    node = new StreamNode(stream.CreatePlugin());
                    break;

                case ITypeCastElement typeCast:
                    node = new StrongTypeCastNode(typeCast.Type, typeCast.Cast);
                    break;

                default:
                    throw new InvalidOperationException($"Unknown binding path element type {element.GetType().FullName}");
                }

                path = pathRoot is null ? (pathRoot = node) : path.Next = node;
            }

            return(pathRoot ?? new EmptyExpressionNode());
        }
Example #6
0
        private TypeDescriptor Visit(SelfNode node, Context context)
        {
            if (context.Self == null || context.CurrentMethod == null || context.CurrentMethod.IsStatic)
            {
                Log("Self не может вызываться в данном контексте", node);

                return(TypeDescriptor.Undefined);
            }

            return(new TypeDescriptor(false, context.Self, true));
        }
        public void GenerateCode(SelfNode node, ICIL_CodeGenerator codeGenerator)
        {
            node.Holder = codeGenerator.DefineVariable();

            // add Local Variable
            codeGenerator.AddLocalVariable(
                new CIL_LocalVariable((Variable)node.Holder));

            codeGenerator.AddInstruction(
                new Assign((Variable)node.Holder, node.Symbol.Holder));
        }
 private async Task OnClick(MouseEventArgs args)
 {
     SelfNode.SetSelected(!SelfNode.IsSelected);
     if (TreeComponent.OnClick.HasDelegate && args.Button == 0)
     {
         await TreeComponent.OnClick.InvokeAsync(new TreeEventArgs <TItem>(TreeComponent, SelfNode, args));
     }
     else if (TreeComponent.OnContextMenu.HasDelegate && args.Button == 2)
     {
         await TreeComponent.OnContextMenu.InvokeAsync(new TreeEventArgs <TItem>(TreeComponent, SelfNode, args));
     }
 }
 /// <summary>
 /// Can be treated as a child if the target is moved to the right beyond the OffsetX distance
 /// </summary>
 /// <param name="e"></param>
 private void OnDragOver(DragEventArgs e)
 {
     if (TreeComponent.DragItem == SelfNode)
     {
         return;
     }
     if (e.ClientX - _dragTargetClientX > OffSETX)
     {
         SelfNode.SetTargetBottom();
         SelfNode.SetParentTargetContainer();
         SelfNode.Expand(true);
     }
     else
     {
         SelfNode.SetTargetBottom(true);
         SelfNode.SetParentTargetContainer(true);
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        private void OnDrop(DragEventArgs e)
        {
            SelfNode.DragTarget = false;
            SelfNode.SetParentTargetContainer();
            if (SelfNode.DragTargetBottom)
            {
                TreeComponent.DragItem.DragMoveDown(SelfNode);
            }
            else
            {
                TreeComponent.DragItem.DragMoveInto(SelfNode);
            }

            if (TreeComponent.OnDrop.HasDelegate)
            {
                TreeComponent.OnDrop.InvokeAsync(new TreeEventArgs <TItem>(TreeComponent, TreeComponent.DragItem)
                {
                    TargetNode = SelfNode
                });
            }
        }
Example #11
0
        public override LazyList <string> Visit(SelfNode node, Context context)
        {
            Contracts.AssertValue(node);

            return(LazyList <string> .Of(TexlLexer.KeywordSelf));
        }
Example #12
0
 public override LazyList <string> Visit(SelfNode node, Precedence parentPrecedence)
 {
     Contracts.AssertValue(node);
     return(LazyList <string> .Of(TexlLexer.KeywordSelf));
 }
Example #13
0
 public SelfInfo(SelfNode node, DPath path, IExternalControl data)
     : base(node, path, data)
 {
 }
Example #14
0
        public void SelfNodeDoesntSortChildNodes()
        {
            SelfNode selfNode = new SelfNode();

            Assert.AreEqual(false, selfNode.SortChildren);
        }
Example #15
0
        private TypeInfo Visit(SelfNode node, MethodBuilder builder, CodegenContext context)
        {
            builder.LoadThis();

            return(context.CurrentClass);
        }
Example #16
0
 public override void Visit(SelfNode node)
 {
     Contracts.AssertValue(node);
     _keywords.Add(node.Kind);
 }
 public abstract Result Visit(SelfNode node, Context context);
Example #18
0
        public void SelfNodeHasProperName()
        {
            SelfNode selfNode = new SelfNode();

            Assert.AreEqual("Self", selfNode.Name);
        }
Example #19
0
 public abstract void Visit(SelfNode node);
Example #20
0
 public void Visit(SelfNode node)
 {
     node.StaticType = scope.Type;
 }
 public void Visit(SelfNode node)
 {
     Code.Add(new AssignVarToVarCodeLine(VariableManager.PeekVariableCounter(), 0));
 }
Example #22
0
 public void Visit(SelfNode node)
 {
     throw new NotImplementedException();
 }
Example #23
0
 public override Result Visit(SelfNode node, Context context)
 {
     return(Default);
 }
Example #24
0
        public (ExpressionNode?Node, SourceMode Mode) Parse(ref CharacterReader r)
        {
            ExpressionNode?rootNode = null;
            ExpressionNode?node     = null;

            var(astNodes, mode) = BindingExpressionGrammar.Parse(ref r);

            foreach (var astNode in astNodes)
            {
                ExpressionNode?nextNode = null;
                switch (astNode)
                {
                case BindingExpressionGrammar.EmptyExpressionNode _:
                    nextNode = new EmptyExpressionNode();
                    break;

                case BindingExpressionGrammar.NotNode _:
                    nextNode = new LogicalNotNode();
                    break;

                case BindingExpressionGrammar.StreamNode _:
                    nextNode = new StreamNode();
                    break;

                case BindingExpressionGrammar.PropertyNameNode propName:
                    nextNode = new PropertyAccessorNode(propName.PropertyName, _enableValidation);
                    break;

                case BindingExpressionGrammar.IndexerNode indexer:
                    nextNode = new StringIndexerNode(indexer.Arguments);
                    break;

                case BindingExpressionGrammar.AttachedPropertyNameNode attachedProp:
                    nextNode = ParseAttachedProperty(attachedProp);
                    break;

                case BindingExpressionGrammar.SelfNode _:
                    nextNode = new SelfNode();
                    break;

                case BindingExpressionGrammar.AncestorNode ancestor:
                    nextNode = ParseFindAncestor(ancestor);
                    break;

                case BindingExpressionGrammar.NameNode elementName:
                    nextNode = new ElementNameNode(_nameScope ?? throw new NotSupportedException("Invalid element name binding with null name scope!"), elementName.Name);
                    break;

                case BindingExpressionGrammar.TypeCastNode typeCast:
                    nextNode = ParseTypeCastNode(typeCast);
                    break;
                }
                if (node is null)
                {
                    rootNode = node = nextNode;
                }
                else
                {
                    node.Next = nextNode;
                    node      = nextNode;
                }
            }

            return(rootNode, mode);
        }
Example #25
0
 public void Visit(SelfNode node)
 {
     IC.Add(new AssignmentVariableToVariable(VariableManager.PeekVariableCounter(), 0));
 }
Example #26
0
 public override void Visit(SelfNode node)
 {
 }
Example #27
0
 public override void Visit(SelfNode node)
 {
     SetCurrentNodeAsResult(node);
 }