You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Stmnt.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Javassist, a Java-bytecode translator toolkit.
  3. * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. Alternatively, the contents of this file may be used under
  8. * the terms of the GNU Lesser General Public License Version 2.1 or later,
  9. * or the Apache License Version 2.0.
  10. *
  11. * Software distributed under the License is distributed on an "AS IS" basis,
  12. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. * for the specific language governing rights and limitations under the
  14. * License.
  15. */
  16. package javassist.compiler.ast;
  17. import javassist.compiler.CompileError;
  18. import javassist.compiler.TokenId;
  19. /**
  20. * Statement.
  21. */
  22. public class Stmnt extends ASTList implements TokenId {
  23. /** default serialVersionUID */
  24. private static final long serialVersionUID = 1L;
  25. protected int operatorId;
  26. public Stmnt(int op, ASTree _head, ASTList _tail, int lineNumber) {
  27. super(_head, _tail, lineNumber);
  28. operatorId = op;
  29. }
  30. public Stmnt(int op, ASTree _head, int lineNumber) {
  31. super(_head, lineNumber);
  32. operatorId = op;
  33. }
  34. public Stmnt(int op, int lineNumber) {
  35. this(op, null, lineNumber);
  36. }
  37. public static Stmnt make(int op, ASTree oprand1, ASTree oprand2, int lineNumber) {
  38. return new Stmnt(op, oprand1, new ASTList(oprand2, lineNumber), lineNumber);
  39. }
  40. public static Stmnt make(int op, ASTree op1, ASTree op2, ASTree op3, int lineNumber) {
  41. return new Stmnt(op, op1, new ASTList(op2, new ASTList(op3, lineNumber), lineNumber), lineNumber);
  42. }
  43. @Override
  44. public void accept(Visitor v) throws CompileError { v.atStmnt(this); }
  45. public int getOperator() { return operatorId; }
  46. @Override
  47. protected String getTag() {
  48. if (operatorId < 128)
  49. return "stmnt:" + (char)operatorId;
  50. return "stmnt:" + operatorId;
  51. }
  52. }