Exemple #1
0
 /// <summary>
 ///     Constructs a new
 ///     <see cref="TraceFieldVisitor" />
 ///     .
 /// </summary>
 /// <param name="fieldVisitor">
 ///     the field visitor to which to delegate calls. May be
 ///     <literal>null</literal>
 ///     .
 /// </param>
 /// <param name="printer">the printer to convert the visited field into text.</param>
 public TraceFieldVisitor(FieldVisitor fieldVisitor, Printer printer)
     : base(VisitorAsmApiVersion.Asm7, fieldVisitor)
 {
     // DontCheck(MemberName): can't be renamed (for backward binary compatibility).
     /* latest api = */
     p = printer;
 }
Exemple #2
0
        public Builder(IAppEntity app)
        {
            partitionResolver = app.PartitionResolver();

            fieldVisitor      = new FieldVisitor(this);
            fieldInputVisitor = new FieldInputVisitor(this);
        }
Exemple #3
0
 /// <summary>
 ///     Constructs a new
 ///     <see cref="FieldRemapper" />
 ///     .
 /// </summary>
 /// <param name="api">
 ///     the ASM API version supported by this remapper. Must be one of
 ///     <see cref="Org.Objectweb.Asm.Opcodes.Asm4" />
 ///     ,
 ///     <see cref="Org.Objectweb.Asm.Opcodes.Asm5" />
 ///     or
 ///     <see cref="Org.Objectweb.Asm.Opcodes.Asm6" />
 ///     .
 /// </param>
 /// <param name="fieldVisitor">the field visitor this remapper must deleted to.</param>
 /// <param name="remapper">
 ///     the remapper to use to remap the types in the visited field.
 /// </param>
 protected internal FieldRemapper(VisitorAsmApiVersion api, FieldVisitor fieldVisitor, Remapper remapper
                                  )
     : base(api, fieldVisitor)
 {
     /* latest api = */
     this.remapper = remapper;
 }
Exemple #4
0
        private void addNonStaticMethods(CompilerContext context, ClassVisitor cv)
        {
            MethodVisitor mv;

            // public int exec(int returnAddress, int alternativeReturnAddress, bool isJump) throws Exception;
            mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.ExecMethodName, context.ExecMethodDesc, null, exceptions);
            mv.visitCode();
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, ClassName, context.StaticExecMethodName, context.StaticExecMethodDesc);
            mv.visitInsn(Opcodes.IRETURN);
            mv.visitMaxs(1, 1);
            mv.visitEnd();

            // private static IExecutable e;
            FieldVisitor fv = cv.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC, context.ReplaceFieldName, executableDescriptor, null, null);

            fv.visitEnd();

            // public void setExecutable(IExecutable e);
            mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.ReplaceMethodName, context.ReplaceMethodDesc, null, exceptions);
            mv.visitCode();
            mv.visitVarInsn(Opcodes.ALOAD, 1);
            mv.visitFieldInsn(Opcodes.PUTSTATIC, ClassName, context.ReplaceFieldName, executableDescriptor);
            mv.visitInsn(Opcodes.RETURN);
            mv.visitMaxs(1, 2);
            mv.visitEnd();

            // public IExecutable getExecutable();
            mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.GetMethodName, context.GetMethodDesc, null, exceptions);
            mv.visitCode();
            mv.visitFieldInsn(Opcodes.GETSTATIC, ClassName, context.ReplaceFieldName, executableDescriptor);
            mv.visitInsn(Opcodes.ARETURN);
            mv.visitMaxs(1, 1);
            mv.visitEnd();
        }
 public void MonsterAttack(Game game, Player player, Player enemy, Monster monster, int monsterindex1, int monsterindex2)
 {
     monster.OnAttack(game, player, enemy);
     FieldVisitor.removeCardFromField(monsterindex1, game, player, enemy, game.field1.monsterfield, ref game.field1.monsterfieldCount);
     FieldVisitor.removeCardFromField(monsterindex2, game, enemy, player, game.field2.monsterfield, ref game.field2.monsterfieldCount);
     //game.field1.removeCardFromMonsterField(monsterindex1, game, player, enemy);
     //game.field2.removeCardFromMonsterField(monsterindex2, game, player, enemy);
 }
Exemple #6
0
 private SqlLam <T> ResolveFieldExpression <TKey>(SqlPartType type, params Expression <Func <T, TKey> >[] expressions)
 {
     foreach (var item in expressions)
     {
         FieldVisitor.ResolveField <T, TKey>(type, item);
     }
     return(this);
 }
Exemple #7
0
        public Builder(IAppEntity app, SharedTypes sharedTypes)
        {
            this.sharedTypes = sharedTypes;

            partitionResolver = app.PartitionResolver();

            fieldVisitor      = new FieldVisitor(this);
            fieldInputVisitor = new FieldInputVisitor(this);
        }
        public void PlayCardFromHand(string playerId, int index)
        {
            if (player1.id.ToString() == playerId)
            {
                //Card c = field1.removeCardFromHandField(index);
                Card c = FieldVisitor.removeCardFromField(index, null, null, null, field1.handfield, ref field1.handfieldCount);
                if (c.type == Enums.CardTypes.Monster)
                {
                    Monster   monster = (Monster)c;
                    Monster[] cs      = { monster };
                    //field1.insertCardsIntoMonsterField(cs, this, player1, player2);
                    FieldVisitor.insertCardsIntoField(cs, this, player1, player2, field1.monsterfield, ref field1.monsterfieldCount);
                }

                else if (c.type == Enums.CardTypes.Spell)
                {
                    Spell   spell = (Spell)c;
                    Spell[] cs    = { spell };
                    //field1.insertCardsIntoSpellField(cs);
                    FieldVisitor.insertCardsIntoField(cs, null, null, null, field1.trapfield, ref field1.trapfieldCount);
                }
                else if (c.type == Enums.CardTypes.Trap)
                {
                    Trap   trap = (Trap)c;
                    Trap[] cs   = { trap };
                    //field1.insertCardsIntoSpellField(cs);
                    FieldVisitor.insertCardsIntoField(cs, null, null, null, field1.trapfield, ref field1.trapfieldCount);
                }
            }
            if (player2.id.ToString() == playerId)
            {
                //Card c = field2.removeCardFromHandField(index);
                Card c = FieldVisitor.removeCardFromField(index, null, null, null, field2.handfield, ref field2.handfieldCount);
                if (c.type == Enums.CardTypes.Monster)
                {
                    Monster   monster = (Monster)c;
                    Monster[] cs      = { monster };
                    //field2.insertCardsIntoMonsterField(cs, this, player2, player1);
                    FieldVisitor.insertCardsIntoField(cs, this, player2, player1, field2.monsterfield, ref field2.monsterfieldCount);
                }

                else if (c.type == Enums.CardTypes.Spell)
                {
                    Spell   spell = (Spell)c;
                    Spell[] cs    = { spell };
                    //field2.insertCardsIntoSpellField(cs);
                    FieldVisitor.insertCardsIntoField(cs, null, null, null, field2.trapfield, ref field2.trapfieldCount);
                }
                else if (c.type == Enums.CardTypes.Trap)
                {
                    Trap   trap = (Trap)c;
                    Trap[] cs   = { trap };
                    //field2.insertCardsIntoSpellField(cs);
                    FieldVisitor.insertCardsIntoField(cs, null, null, null, field2.trapfield, ref field2.trapfieldCount);
                }
            }
        }
Exemple #9
0
 /// <summary>
 ///     Constructs a new
 ///     <see cref="CheckFieldAdapter" />
 ///     . <i>Subclasses must not use this constructor</i>.
 ///     Instead, they must use the
 ///     <see cref="CheckFieldAdapter(int, Org.Objectweb.Asm.FieldVisitor)" />
 ///     version.
 /// </summary>
 /// <param name="fieldVisitor">
 ///     the field visitor to which this adapter must delegate calls.
 /// </param>
 /// <exception cref="System.InvalidOperationException">
 ///     If a subclass calls this constructor.
 /// </exception>
 public CheckFieldAdapter(FieldVisitor fieldVisitor)
     : this(VisitorAsmApiVersion.Asm7, fieldVisitor)
 {
     /* latest api = */
     if (GetType() != typeof(CheckFieldAdapter))
     {
         throw new InvalidOperationException();
     }
 }
        public override void Field(FieldReference field, Expression value)
        {
            //keep track of all static field->value, and initiate in <clinit> in done
            if (Modifier.isStatic(field.Modifiers()) && value != null)
            {
                _staticFields[field] = value;
            }
            FieldVisitor fieldVisitor = _classVisitor.visitField(field.Modifiers(), field.Name(), typeName(field.Type()), signature(field.Type()), null);

            fieldVisitor.visitEnd();
        }
Exemple #11
0
 public void DestroyMonster(Game game, Guid playerId, Guid enemyid, int index)
 {
     if (player1.id == playerId)
     {
         //field1.removeCardFromMonsterField(index, game, player1, player2);
         FieldVisitor.removeCardFromField(index, game, player1, player2, field1.monsterfield, ref field1.monsterfieldCount);
     }
     if (player2.id == playerId)
     {
         //field2.removeCardFromMonsterField(index, game, player2, player1);
         FieldVisitor.removeCardFromField(index, game, player2, player1, field2.monsterfield, ref field2.monsterfieldCount);
     }
 }
Exemple #12
0
 public void PlayerDrawCardsIntoHand(Guid playerId, int amount)
 {
     if (playerId == player1.id)
     {
         Card[] cards = player1.drawCardsFromDeck(amount);
         //field1.insertCardsIntoHandField(cards);
         FieldVisitor.insertCardsIntoField(cards, null, null, null, field1.handfield, ref field1.handfieldCount);
     }
     else if (playerId == player2.id)
     {
         Card[] cards = player2.drawCardsFromDeck(amount);
         //field2.insertCardsIntoHandField(cards);
         FieldVisitor.insertCardsIntoField(cards, null, null, null, field2.handfield, ref field2.handfieldCount);
     }
 }
Exemple #13
0
 public IExecute <T> InsertWithQuery <TResult>(IQuery <TResult> sql, bool ignoreKey = true)
 {
     FieldVisitor.ResolveInsertField <T, TResult>(sql, ignoreKey);
     return(this);
 }
Exemple #14
0
 /// <summary>
 ///     Constructs a new
 ///     <see cref="FieldRemapper" />
 ///     . <i>Subclasses must not use this constructor</i>.
 ///     Instead, they must use the
 ///     <see cref="FieldRemapper(int,ObjectWeb.Asm.FieldVisitor,ObjectWeb.Asm.Commons.Remapper)" />
 ///     version.
 /// </summary>
 /// <param name="fieldVisitor">the field visitor this remapper must deleted to.</param>
 /// <param name="remapper">
 ///     the remapper to use to remap the types in the visited field.
 /// </param>
 public FieldRemapper(FieldVisitor fieldVisitor, Remapper remapper)
     : this(VisitorAsmApiVersion.Asm7, fieldVisitor, remapper)
 {
 }
 internal static extern uint clang_Type_visitFields(CXType T, FieldVisitor visitor, CXClientData client_data);
Exemple #16
0
 public IWhere <T> Or <TKey>(Expression <Func <T, TKey> > expression)
 {
     FieldVisitor.ResolveWhereField(expression, source, false);
     return(this);
 }
Exemple #17
0
 private SqlLam <T> ResolveFieldExpression <TKey>(SqlPartType type, Expression <Func <T, TKey> > expression)
 {
     FieldVisitor.ResolveField <T, TKey>(type, expression);
     return(this);
 }
Exemple #18
0
 public IExecute <T> Update <TKey, TSource>(TSource obj, Expression <Func <T, TKey> > fields)
 {
     this.source = obj;
     FieldVisitor.ResolveUpdateField(fields, obj);
     return(this);
 }
Exemple #19
0
 public IWhere <T> Between <TKey>(Expression <Func <T, TKey> > expression, object between, object and)
 {
     Builder.And();
     FieldVisitor.ResolveWhereField <T, TKey>(expression, between, and);
     return(this);
 }
Exemple #20
0
 public IExecute <T> Update <TSource>(TSource obj, bool ignoreKey = true)
 {
     this.source = obj;
     FieldVisitor.ResolveUpdateField <T, TSource>(obj, ignoreKey);
     return(this);
 }
Exemple #21
0
 /// <summary>Constructs a new remapper for fields.</summary>
 /// <remarks>
 ///     Constructs a new remapper for fields. The default implementation of this method returns a new
 ///     <see cref="FieldRemapper" />
 ///     .
 /// </remarks>
 /// <param name="fieldVisitor">the FieldVisitor the remapper must delegate to.</param>
 /// <returns>the newly created remapper.</returns>
 protected internal virtual FieldVisitor CreateFieldRemapper(FieldVisitor fieldVisitor
                                                             )
 {
     return(new FieldRemapper(api, fieldVisitor, remapper));
 }
Exemple #22
0
 public IExecute <T> Insert(object obj, bool ignoreKey = true, bool increment = false)
 {
     Builder.InsertKey = increment;
     FieldVisitor.ResolveInsertField <T>(obj, ignoreKey);
     return(this);
 }
Exemple #23
0
 public IExecute <T> Insert <TKey>(IEnumerable <T> list, Expression <Func <T, TKey> > fields)
 {
     FieldVisitor.ResolveInsertField(fields, list);
     return(this);
 }
Exemple #24
0
 public IExecute <T> Insert(IEnumerable <T> list, bool ignoreKey = true)
 {
     FieldVisitor.ResolveInsertField <T, T>(list, ignoreKey);
     return(this);
 }
Exemple #25
0
 /// <summary>
 ///     Constructs a new
 ///     <see cref="CheckFieldAdapter" />
 ///     .
 /// </summary>
 /// <param name="api">
 ///     the ASM API version implemented by this visitor. Must be one of
 ///     <see cref="Org.Objectweb.Asm.Opcodes.Asm4" />
 ///     ,
 ///     <see cref="Org.Objectweb.Asm.Opcodes.Asm5" />
 ///     ,
 ///     <see cref="Org.Objectweb.Asm.Opcodes.Asm6" />
 ///     or
 ///     <see cref="Org.Objectweb.Asm.Opcodes.Asm7" />
 ///     .
 /// </param>
 /// <param name="fieldVisitor">
 ///     the field visitor to which this adapter must delegate calls.
 /// </param>
 protected internal CheckFieldAdapter(VisitorAsmApiVersion api, FieldVisitor fieldVisitor)
     : base(api, fieldVisitor)
 {
 }
Exemple #26
0
 public IExecute <T> InsertWithQuery <TKey, TResult>(Expression <Func <T, TKey> > fields, IQuery <TResult> sql)
 {
     FieldVisitor.ResolveInsertField <T, TKey, TResult>(sql, fields);
     return(this);
 }