javassist.compiler.ast.Keyword.get()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中javassist.compiler.ast.Keyword.get()方法的一些代码示例,展示了Keyword.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keyword.get()方法的具体详情如下:
包路径:javassist.compiler.ast.Keyword
类名称:Keyword
方法名:get

Keyword.get介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

private static boolean isAlwaysBranch(ASTree expr, boolean branchIf) {
  if (expr instanceof Keyword) {
    int t = ((Keyword)expr).get();
    return branchIf ? t == TRUE : t == FALSE;
  }
  return false;
}

代码示例来源:origin: org.javassist/javassist

private static boolean isAlwaysBranch(ASTree expr, boolean branchIf) {
  if (expr instanceof Keyword) {
    int t = ((Keyword)expr).get();
    return branchIf ? t == TRUE : t == FALSE;
  }
  return false;
}

代码示例来源:origin: redisson/redisson

Keyword k = (Keyword)mods.head();
mods = mods.tail();
switch (k.get()) {
case STATIC :
  m |= Modifier.STATIC;

代码示例来源:origin: redisson/redisson

public void atKeyword(Keyword k) throws CompileError {
  arrayDim = 0;
  int token = k.get();
  switch (token) {
  case TRUE :
  case FALSE :
    exprType = BOOLEAN;
    break;
  case NULL :
    exprType = NULL;
    break;
  case THIS :
  case SUPER :
    exprType = CLASS;
    if (token == THIS)
      className = getThisName();
    else
      className = getSuperName();             
    break;
  default :
    fatal();
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Returns non-null if target is something like Foo.super
 * for accessing the default method in an interface.
 * Otherwise, null.
 *
 * @return the class name followed by {@code .super} or null.
 */
static String isDotSuper(ASTree target) {
  if (target instanceof Expr) {
    Expr e = (Expr)target;
    if (e.getOperator() == '.') {
      ASTree right = e.oprand2();
      if (right instanceof Keyword && ((Keyword)right).get() == SUPER)
        return ((Symbol)e.oprand1()).get();
    }
  }
  return null;
}

代码示例来源:origin: org.javassist/javassist

Keyword k = (Keyword)mods.head();
mods = mods.tail();
switch (k.get()) {
case STATIC :
  m |= Modifier.STATIC;

代码示例来源:origin: redisson/redisson

private ASTree parseMethodCall(SymbolTable tbl, ASTree expr)
  throws CompileError
{
  if (expr instanceof Keyword) {
    int token = ((Keyword)expr).get();
    if (token != THIS && token != SUPER)
      throw new SyntaxError(lex);
  }
  else if (expr instanceof Symbol)        // Identifier
    ;
  else if (expr instanceof Expr) {
    int op = ((Expr)expr).getOperator();
    if (op != '.' && op != MEMBER)
      throw new SyntaxError(lex);
  }
  return CallExpr.makeCall(expr, parseArgumentList(tbl));
}

代码示例来源:origin: org.javassist/javassist

@Override
public void atKeyword(Keyword k) throws CompileError {
  arrayDim = 0;
  int token = k.get();
  switch (token) {
  case TRUE :
  case FALSE :
    exprType = BOOLEAN;
    break;
  case NULL :
    exprType = NULL;
    break;
  case THIS :
  case SUPER :
    exprType = CLASS;
    if (token == THIS)
      className = getThisName();
    else
      className = getSuperName();
    break;
  default :
    fatal();
  }
}

代码示例来源:origin: org.javassist/javassist

/**
 * Returns non-null if target is something like Foo.super
 * for accessing the default method in an interface.
 * Otherwise, null.
 *
 * @return the class name followed by {@code .super} or null.
 */
static String isDotSuper(ASTree target) {
  if (target instanceof Expr) {
    Expr e = (Expr)target;
    if (e.getOperator() == '.') {
      ASTree right = e.oprand2();
      if (right instanceof Keyword && ((Keyword)right).get() == SUPER)
        return ((Symbol)e.oprand1()).get();
    }
  }
  return null;
}

代码示例来源:origin: redisson/redisson

private boolean needsSuperCall(Stmnt body) throws CompileError {
  if (body.getOperator() == BLOCK)
    body = (Stmnt)body.head();
  if (body != null && body.getOperator() == EXPR) {
    ASTree expr = body.head();
    if (expr != null && expr instanceof Expr
      && ((Expr)expr).getOperator() == CALL) {
      ASTree target = ((Expr)expr).head();
      if (target instanceof Keyword) {
        int token = ((Keyword)target).get();
        return token != THIS && token != SUPER;
      }
    }
  }
  return true;
}

代码示例来源:origin: org.javassist/javassist

private ASTree parseMethodCall(SymbolTable tbl, ASTree expr)
  throws CompileError
{
  if (expr instanceof Keyword) {
    int token = ((Keyword)expr).get();
    if (token != THIS && token != SUPER)
      throw new SyntaxError(lex);
  }
  else if (expr instanceof Symbol)        // Identifier
    ;
  else if (expr instanceof Expr) {
    int op = ((Expr)expr).getOperator();
    if (op != '.' && op != MEMBER)
      throw new SyntaxError(lex);
  }
  return CallExpr.makeCall(expr, parseArgumentList(tbl));
}

代码示例来源:origin: org.javassist/javassist

private boolean needsSuperCall(Stmnt body) throws CompileError {
  if (body.getOperator() == BLOCK)
    body = (Stmnt)body.head();
  if (body != null && body.getOperator() == EXPR) {
    ASTree expr = body.head();
    if (expr != null && expr instanceof Expr
      && ((Expr)expr).getOperator() == CALL) {
      ASTree target = ((Expr)expr).head();
      if (target instanceof Keyword) {
        int token = ((Keyword)target).get();
        return token != THIS && token != SUPER;
      }
    }
  }
  return true;
}

代码示例来源:origin: redisson/redisson

public void atKeyword(Keyword k) throws CompileError {
  arrayDim = 0;
  int token = k.get();
  switch (token) {
  case TRUE :

代码示例来源:origin: org.javassist/javassist

@Override
public void atKeyword(Keyword k) throws CompileError {
  arrayDim = 0;
  int token = k.get();
  switch (token) {
  case TRUE :

代码示例来源:origin: redisson/redisson

public void atMethodDecl(MethodDecl method) throws CompileError {
  ASTList mods = method.getModifiers();
  setMaxLocals(1);
  while (mods != null) {
    Keyword k = (Keyword)mods.head();
    mods = mods.tail();
    if (k.get() == STATIC) {
      setMaxLocals(0);
      inStaticMethod = true;
    }
  }
    
  ASTList params = method.getParams();
  while (params != null) {
    atDeclarator((Declarator)params.head());
    params = params.tail();
  }
  Stmnt s = method.getBody();
  atMethodBody(s, method.isConstructor(),
         method.getReturn().getType() == VOID);
}

代码示例来源:origin: org.javassist/javassist

@Override
public void atMethodDecl(MethodDecl method) throws CompileError {
  ASTList mods = method.getModifiers();
  setMaxLocals(1);
  while (mods != null) {
    Keyword k = (Keyword)mods.head();
    mods = mods.tail();
    if (k.get() == STATIC) {
      setMaxLocals(0);
      inStaticMethod = true;
    }
  }
  ASTList params = method.getParams();
  while (params != null) {
    atDeclarator((Declarator)params.head());
    params = params.tail();
  }
  Stmnt s = method.getBody();
  atMethodBody(s, method.isConstructor(),
         method.getReturn().getType() == VOID);
}

代码示例来源:origin: redisson/redisson

bytecode.addAload(0);   // this
if (((Keyword)method).get() == SUPER)
  targetClass = MemberResolver.getSuperclass(targetClass);
      if (((Keyword)target).get() == SUPER)
        isSpecial = true;

代码示例来源:origin: org.javassist/javassist

bytecode.addAload(0);   // this
if (((Keyword)method).get() == SUPER)
  targetClass = MemberResolver.getSuperclass(targetClass);
      if (((Keyword)target).get() == SUPER)
        isSpecial = true;

代码示例来源:origin: redisson/redisson

if (((Keyword)method).get() == SUPER)
  targetClass = MemberResolver.getSuperclass(thisClass);
else

代码示例来源:origin: org.javassist/javassist

if (((Keyword)method).get() == SUPER)
  targetClass = MemberResolver.getSuperclass(thisClass);
else

相关文章