示例#1
0
 internal VariableSymbol(string name, bool isReadOnly, TypeSymbol type, BoundConstant constant)
     : base(name)
 {
     IsReadOnly = isReadOnly;
     Type       = type;
     Constant   = isReadOnly ? constant : null;
 }
示例#2
0
 internal GlobalVariableSymbol(string name, bool isReadOnly, TypeSymbol type, BoundConstant constant)
     : base(name, isReadOnly, type, constant)
 {
 }
示例#3
0
 public virtual void VisitConstant(BoundConstant node)
 {
     DefaultVisit(node);
 }
            protected bool TryGetCacheSlot(BoundExpression expression, BoundConstant constant, out int index, out FieldInfo cacheSlot)
            {
                cacheSlot = null;
                index = 0;

                string name = constant.Value as string;

                if (name != null)
                    index = Generator._identifierManager.ResolveIdentifier(name);

                if (name == null && constant.ValueType == BoundValueType.Number)
                {
                    double number = (double)constant.Value;
                    index = (int)number;
                    if (index != number || index < 0)
                        return false;

                    name = index.ToString();
                }

                cacheSlot = Generator.ResolveCacheSlot(expression, name);

                return cacheSlot != null;
            }
示例#5
0
 private BoundValueType EmitConstant(BoundConstant node)
 {
     IL.EmitConstant(node.Value);
     return node.ValueType;
 }