コード例 #1
0
ファイル: EventNode.cs プロジェクト: taekun/lens
 public EventNode(EventWrapper evt, SetMemberNode node, bool isSubscription)
 {
     _Event          = evt;
     _IsSubscription = isSubscription;
     _Node           = node;
     _Callback       = Expr.CastTransparent(node.Value, _Event.EventHandlerType);
 }
コード例 #2
0
ファイル: LensParser.cs プロジェクト: menozz/lens
        /// <summary>
        /// set_stmbr_stmt                              = type "::" identifier assignment_op expr
        /// </summary>
        private NodeBase parseSetStmbrStmt()
        {
            var type = attempt(parseType);
            if (type == null)
                return null;

            if (!check(LexemType.DoubleСolon))
                return null;

            var node = new SetMemberNode();
            node.StaticType = type;
            node.MemberName = ensure(LexemType.Identifier, ParserMessages.MemberNameExpected).Value;

            if (check(LexemType.Assign))
            {
                node.Value = ensure(parseExpr, ParserMessages.ExpressionExpected);
                return node;
            }

            if (peekAny(_BinaryOperators) && peek(1, LexemType.Assign))
            {
                var opType = _Lexems[_LexemId].Type;
                skip(2);
                node.Value = ensure(parseExpr, ParserMessages.ExpressionExpected);
                return new ShortAssignmentNode(opType, node);
            }

            return null;
        }