Exemplo n.º 1
0
            void UpdateType(Expression expression, mdr.ValueTypes type)
            {
                var oldType = GetType(expression);
                var newType = TypeCalculator.ResolveType(oldType, type);

                if (oldType != newType)
                {
                    m.Util.Diagnose.Debug.WriteLine("---->> Type of the expression {0} changed to {1}", expression.ToString(), newType.ToString());
                    SetType(expression, newType);
                    if (type == mdr.ValueTypes.Unknown)
                    {
                        Enqueue(expression);
                    }
                    else
                    {
                        VisitUser(expression);
                    }
                }
            }
Exemplo n.º 2
0
            void UpdateType(JSSymbol symbol, mdr.ValueTypes type)
            {
                if (type == mdr.ValueTypes.Unknown)
                {
                    return;
                }

                var oldType = GetType(symbol);
                var newType = TypeCalculator.ResolveType(oldType, type);

                switch (newType)
                {
                case mdr.ValueTypes.Undefined:
                case mdr.ValueTypes.Null:
                case mdr.ValueTypes.Unknown:
                    newType = mdr.ValueTypes.DValueRef; //All of these cases are handled by a DValue
                    break;

                case mdr.ValueTypes.DValue:
                    if (symbol.IsParameter)
                    {
                        //We already have a DValue as argument, so just need to point to that and use its storage
                        newType = mdr.ValueTypes.DValueRef;
                    }
                    break;
                }

                if (oldType != newType)
                {
                    m.Util.Diagnose.Debug.WriteLine("---->> Type of the symbol {0} changed to {1}", symbol.Name.ToString(), newType.ToString());
                    SetType(symbol, newType);
                    //symbol.Types.Add(type);
                    foreach (var r in symbol.Readers)
                    {
                        Enqueue(r);
                    }
                }
            }