Esempio n. 1
0
        public Scope(Frame frame, Scope previous)
        {
            _identifiers = new Dictionary<string, FrameResource>();

            Frame = frame;
            Previous = previous;
        }
Esempio n. 2
0
        public RegisterFrameResource(Frame frame, TypeBase type, Register register)
            : base(frame, type)
        {
            Register = register;

            if (type is PointerType)
            {
                _type = OperandValueType.Dword;
            }
            else
            {
                var typePrim = type as PrimitiveType;
                if (typePrim == null)
                    throw new ArgumentException("Type must be a primitive.", nameof(type));

                switch (typePrim.Type)
                {
                    case Primitive.Int:
                        _type = OperandValueType.Dword;
                        break;
                    case Primitive.Short:
                        _type = OperandValueType.Word;
                        break;
                    case Primitive.Char:
                        _type = OperandValueType.Byte;
                        break;
                    default:
                        throw new NotSupportedException();
                }
            }
        }
Esempio n. 3
0
 protected FrameResource(Frame frame, TypeBase type)
 {
     Frame = frame;
     Type = type;
     Disposed = false;
 }
Esempio n. 4
0
        public StackFrameResource(Frame frame, TypeBase type, int offset, int size)
            : base(frame, type)
        {
            Offset = offset;
            Size = size;

            if (type is PointerType)
            {
                _type = OperandValueType.Dword;
            }
            else
            {
                var typePrim = type as PrimitiveType;
                if (typePrim == null)
                    return;

                switch (typePrim.Type)
                {
                    case Primitive.Int:
                        _type = OperandValueType.Dword;
                        break;
                    case Primitive.Short:
                        _type = OperandValueType.Word;
                        break;
                    case Primitive.Char:
                        _type = OperandValueType.Byte;
                        break;
                    default:
                        throw new NotSupportedException();
                }
            }
        }