コード例 #1
0
        protected override void VisitCompoundAssignment(CompoundAssignmentNode node)
        {
            Visit(node.LeftSideNode);
            switch (node.LeftSideNode.BuiltinType)
            {
            case SymbolType.Float:
                node.Annotations.Add(new FloatDoesntSupportCompoundAssignments(node.OperatorLocation));
                return;

            case SymbolType.Class:
            case SymbolType.Prototype:
            case SymbolType.Instance:
            case SymbolType.Func:
                node.Annotations.Add(new UnsupportedOperationError(node.OperatorLocation));
                return;

            case SymbolType.String:
                if (node.Operator != CompoundAssignmentOperator.Add || !_symbolTable.ContainsKey("CONCATSTRINGS"))
                {
                    node.Annotations.Add(new UnsupportedOperationError(node.OperatorLocation));
                    return;
                }
                break;
            }

            Visit(node.RightSideNode);

            /*
             * InvalidOperandsToBinaryExpressionError
             * TODO check assignment types compability
             */
        }
 protected override void VisitCompoundAssignment(CompoundAssignmentNode node)
 {
     if (node.LeftSideNode.Symbol?.Node is ConstDefinitionNode)
     {
         node.Annotations.Add(new ConstValueChangedWarning(node.LeftSideNode.Name));
     }
     base.VisitCompoundAssignment(node);
 }
コード例 #3
0
 protected virtual T VisitCompoundAssignment(CompoundAssignmentNode node)
 {
     Visit(node.LeftSideNode);
     Visit(node.RightSideNode);
     return(DefaultResult);
 }
 protected virtual void VisitCompoundAssignment(CompoundAssignmentNode node)
 {
     Visit(node.LeftSideNode);
     Visit(node.RightSideNode);
 }