Exemplo n.º 1
0
        internal override void Scan(bool scanNext)
        {
            for (var i = 0; i < _items.Count; ++i)
            {
                SemanticFind find = _errors[i];
                if (find.Operator == this)
                {
                    _errors.Remove(find);
                    --i;
                }
            }

            _initializedNames.Push(new List <string>());
            ISemanticType rightType = Expression.GetSemanticType();
            ISemanticType leftType  = SimpleType.Boolean;

            if (!rightType.CanCastTo(leftType, false))
            {
                GenerateFind(new InCorrectExpressionType(Operator, Expression.Words, leftType.FullType, rightType.FullType));
            }

            if (Child != null)
            {
                Child.Scan(true);
            }

            var ifNames = new HashSet <string>();

            ifNames.UnionWith(_initializedNames.Pop());

            foreach (var elseIf in ElseIfList)
            {
                _initializedNames.Push(new List <string>());
                elseIf.Scan(true);
                ifNames.IntersectWith(_initializedNames.Pop());
            }

            if (Else != null)
            {
                _initializedNames.Push(new List <string>());
                Else.Scan(true);
                ifNames.IntersectWith(_initializedNames.Pop());
            }
            else
            {
                ifNames.Clear();
            }

            if (_initializedNames.Count > 0)
            {
                _initializedNames.First().AddRange(ifNames);
            }

            if (Next != null && scanNext)
            {
                Next.Scan(true);
            }
        }
Exemplo n.º 2
0
        internal override void Scan(bool scanNext)
        {
            for (var i = 0; i < _errors.Count; ++i)
            {
                SemanticFind find = _errors[i];
                if (find.Operator == this)
                {
                    _errors.Remove(find);
                    --i;
                }
            }

            base.Scan(scanNext);
        }
Exemplo n.º 3
0
        internal override void Scan(bool scanNext)
        {
            for (var i = 0; i < _errors.Count; ++i)
            {
                SemanticFind find = _errors[i];
                if (find.Operator == this)
                {
                    _errors.Remove(find);
                    --i;
                }
            }

            if (Child != null)
            {
                Child.Scan(true);
            }
        }
Exemplo n.º 4
0
        internal override void Scan(bool scanNext)
        {
            for (var i = 0; i < _errors.Count; ++i)
            {
                SemanticFind find = _errors[i];
                if (find.Operator == this)
                {
                    _errors.Remove(find);
                    --i;
                }
            }

            ISemanticType rightType = Expression.GetSemanticType();
            ISemanticType leftType  = SimpleType.Boolean;

            if (rightType.CanCastTo(leftType, false))
            {
                GenerateFind(new InCorrectExpressionType(Operator, Expression.Words, leftType.FullType, rightType.FullType));
            }

            Child?.Scan(true);
        }
Exemplo n.º 5
0
 protected static void GenerateFind(SemanticFind find) => SemanticItem.GenerateFind(find);