示例#1
0
 public override void Visit(RppArray node)
 {
     node.Initializers.ForEach(arg => arg.Accept(this));
 }
示例#2
0
        public override void Visit(RppArray node)
        {
            var arrayType = node.Type.Value.NativeType;
            Type elementType = arrayType.GetElementType();
            LocalBuilder arrVar = _body.DeclareLocal(arrayType);
            ClrCodegenUtils.LoadInt(node.Size, _body);
            _body.Emit(OpCodes.Newarr, elementType);

            ClrCodegenUtils.StoreLocal(arrVar, _body);

            int index = 0;
            foreach (var initializer in node.Initializers)
            {
                ClrCodegenUtils.LoadLocal(arrVar, _body);
                ClrCodegenUtils.LoadInt(index, _body);
                initializer.Accept(this);
                _body.Emit(OpCodes.Stelem, elementType);
                index++;
            }

            ClrCodegenUtils.LoadLocal(arrVar, _body);
        }
示例#3
0
 public virtual void Visit(RppArray node)
 {
 }