⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 symtab.java

📁 这是实现Javac功能的GJC的最新源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      * Constructor; enters all predefined identifiers and operators      *  into symbol table.      */    private Symtab(Context context) throws CompletionFailure {        super();        context.put(symtabKey, this);        names = Name.Table.instance(context);        byteType = new Type(TypeTags.BYTE, null);        charType = new Type(TypeTags.CHAR, null);        shortType = new Type(TypeTags.SHORT, null);        intType = new Type(TypeTags.INT, null);        longType = new Type(TypeTags.LONG, null);        floatType = new Type(TypeTags.FLOAT, null);        doubleType = new Type(TypeTags.DOUBLE, null);        booleanType = new Type(TypeTags.BOOLEAN, null);        voidType = new Type(TypeTags.VOID, null);        botType = new Type(TypeTags.BOT, null);        unknownType = new Type(TypeTags.UNKNOWN, null) {                          public boolean isSameType(Type that) {                              return true;                          }                          public boolean isSubType(Type that) {                              return false;                          }                          public boolean isSuperType(Type that) {                              return true;                          }                      };        rootPackage = new PackageSymbol(names.empty, null);        emptyPackage = new PackageSymbol(names.emptyPackage, rootPackage);        noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage);        noSymbol.kind = Kinds.NIL;        errSymbol = new ClassSymbol(PUBLIC | STATIC, names.any, null, rootPackage);        errType = new ErrorType(errSymbol);        initType(byteType, "byte", "Byte");        initType(shortType, "short", "Short");        initType(charType, "char", "Character");        initType(intType, "int", "Integer");        initType(longType, "long", "Long");        initType(floatType, "float", "Float");        initType(doubleType, "double", "Double");        initType(booleanType, "boolean", "Boolean");        initType(voidType, "void", "Void");        initType(botType, "<nulltype>");        initType(errType, errSymbol);        initType(unknownType, "<any?>");        arrayClass = new ClassSymbol(PUBLIC, names.Array, noSymbol);        methodClass = new ClassSymbol(PUBLIC, names.Method, noSymbol);        predefClass = new ClassSymbol(PUBLIC, names.empty, rootPackage);        Scope scope = new Scope(predefClass);        predefClass.members_field = scope;        scope.enter(byteType.tsym);        scope.enter(shortType.tsym);        scope.enter(charType.tsym);        scope.enter(intType.tsym);        scope.enter(longType.tsym);        scope.enter(floatType.tsym);        scope.enter(doubleType.tsym);        scope.enter(booleanType.tsym);        scope.enter(errType.tsym);        classes.put(predefClass.fullname, predefClass);        reader = ClassReader.instance(context);        reader.init(this);        objectType = enterClass("java.lang.Object");        classType = enterClass("java.lang.Class");        stringType = enterClass("java.lang.String");        stringBufferType = enterClass("java.lang.StringBuffer");        cloneableType = enterClass("java.lang.Cloneable");        throwableType = enterClass("java.lang.Throwable");        serializableType = enterClass("java.io.Serializable");        errorType = enterClass("java.lang.Error");        exceptionType = enterClass("java.lang.Exception");        runtimeExceptionType = enterClass("java.lang.RuntimeException");        classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");        noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError");        assertionErrorType = enterClass("java.lang.AssertionError");        classLoaderType = enterClass("java.lang.ClassLoader");        ClassType arrayClassType = (ClassType) arrayClass.type;        arrayClassType.supertype_field = objectType;        arrayClassType.interfaces_field = List.make(cloneableType, serializableType);        arrayClass.members_field = new Scope(arrayClass);        lengthVar = new VarSymbol(PUBLIC | FINAL, names.length, intType, arrayClass);        arrayClass.members().enter(lengthVar);        Symbol cloneMethod = new MethodSymbol(PUBLIC, names.clone,                new MethodType(Type.emptyList, objectType, Type.emptyList,                methodClass), arrayClass);        arrayClass.members().enter(cloneMethod);        nullConst = enterConstant("null", botType);        trueConst = enterConstant("true", booleanType.constType(new Integer(1)));        falseConst = enterConstant("false", booleanType.constType(new Integer(0)));        enterUnop("+", intType, intType, nop);        enterUnop("+", longType, longType, nop);        enterUnop("+", floatType, floatType, nop);        enterUnop("+", doubleType, doubleType, nop);        enterUnop("-", intType, intType, ineg);        enterUnop("-", longType, longType, lneg);        enterUnop("-", floatType, floatType, fneg);        enterUnop("-", doubleType, doubleType, dneg);        enterUnop("~", intType, intType, ixor);        enterUnop("~", longType, longType, lxor);        enterUnop("++", byteType, byteType, iadd);        enterUnop("++", shortType, shortType, iadd);        enterUnop("++", charType, charType, iadd);        enterUnop("++", intType, intType, iadd);        enterUnop("++", longType, longType, ladd);        enterUnop("++", floatType, floatType, fadd);        enterUnop("++", doubleType, doubleType, dadd);        enterUnop("--", byteType, byteType, isub);        enterUnop("--", shortType, shortType, isub);        enterUnop("--", charType, charType, isub);        enterUnop("--", intType, intType, isub);        enterUnop("--", longType, longType, lsub);        enterUnop("--", floatType, floatType, fsub);        enterUnop("--", doubleType, doubleType, dsub);        enterUnop("!", booleanType, booleanType, bool_not);        nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk);        enterBinop("+", stringType, stringType, stringType, string_add);        enterBinop("+", stringType, intType, stringType, string_add);        enterBinop("+", stringType, longType, stringType, string_add);        enterBinop("+", stringType, floatType, stringType, string_add);        enterBinop("+", stringType, doubleType, stringType, string_add);        enterBinop("+", stringType, booleanType, stringType, string_add);        enterBinop("+", stringType, objectType, stringType, string_add);        enterBinop("+", stringType, botType, stringType, string_add);        enterBinop("+", intType, stringType, stringType, string_add);        enterBinop("+", longType, stringType, stringType, string_add);        enterBinop("+", floatType, stringType, stringType, string_add);        enterBinop("+", doubleType, stringType, stringType, string_add);        enterBinop("+", booleanType, stringType, stringType, string_add);        enterBinop("+", objectType, stringType, stringType, string_add);        enterBinop("+", botType, stringType, stringType, string_add);        enterBinop("+", intType, intType, intType, iadd);        enterBinop("+", longType, longType, longType, ladd);        enterBinop("+", floatType, floatType, floatType, fadd);        enterBinop("+", doubleType, doubleType, doubleType, dadd);        enterBinop("+", botType, botType, botType, error);        enterBinop("+", botType, intType, botType, error);        enterBinop("+", botType, longType, botType, error);        enterBinop("+", botType, floatType, botType, error);        enterBinop("+", botType, doubleType, botType, error);        enterBinop("+", botType, booleanType, botType, error);        enterBinop("+", botType, objectType, botType, error);        enterBinop("+", intType, botType, botType, error);        enterBinop("+", longType, botType, botType, error);        enterBinop("+", floatType, botType, botType, error);        enterBinop("+", doubleType, botType, botType, error);        enterBinop("+", booleanType, botType, botType, error);        enterBinop("+", objectType, botType, botType, error);        enterBinop("-", intType, intType, intType, isub);        enterBinop("-", longType, longType, longType, lsub);        enterBinop("-", floatType, floatType, floatType, fsub);        enterBinop("-", doubleType, doubleType, doubleType, dsub);        enterBinop("*", intType, intType, intType, imul);        enterBinop("*", longType, longType, longType, lmul);        enterBinop("*", floatType, floatType, floatType, fmul);        enterBinop("*", doubleType, doubleType, doubleType, dmul);        enterBinop("/", intType, intType, intType, idiv);        enterBinop("/", longType, longType, longType, ldiv);        enterBinop("/", floatType, floatType, floatType, fdiv);        enterBinop("/", doubleType, doubleType, doubleType, ddiv);        enterBinop("%", intType, intType, intType, imod);        enterBinop("%", longType, longType, longType, lmod);        enterBinop("%", floatType, floatType, floatType, fmod);        enterBinop("%", doubleType, doubleType, doubleType, dmod);        enterBinop("&", booleanType, booleanType, booleanType, iand);        enterBinop("&", intType, intType, intType, iand);        enterBinop("&", longType, longType, longType, land);        enterBinop("|", booleanType, booleanType, booleanType, ior);        enterBinop("|", intType, intType, intType, ior);        enterBinop("|", longType, longType, longType, lor);        enterBinop("^", booleanType, booleanType, booleanType, ixor);        enterBinop("^", intType, intType, intType, ixor);        enterBinop("^", longType, longType, longType, lxor);        enterBinop("<<", intType, intType, intType, ishl);        enterBinop("<<", longType, intType, longType, lshl);        enterBinop("<<", intType, longType, intType, ishll);        enterBinop("<<", longType, longType, longType, lshll);        enterBinop(">>", intType, intType, intType, ishr);        enterBinop(">>", longType, intType, longType, lshr);        enterBinop(">>", intType, longType, intType, ishrl);        enterBinop(">>", longType, longType, longType, lshrl);        enterBinop(">>>", intType, intType, intType, iushr);        enterBinop(">>>", longType, intType, longType, lushr);        enterBinop(">>>", intType, longType, intType, iushrl);        enterBinop(">>>", longType, longType, longType, lushrl);        enterBinop("<", intType, intType, booleanType, if_icmplt)        ;        enterBinop("<", longType, longType, booleanType, lcmp, iflt);        enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt);        enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt);        enterBinop(">", intType, intType, booleanType, if_icmpgt)        ;        enterBinop(">", longType, longType, booleanType, lcmp, ifgt);        enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt);        enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt);        enterBinop("<=", intType, intType, booleanType, if_icmple)        ;        enterBinop("<=", longType, longType, booleanType, lcmp, ifle);        enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle);        enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle);        enterBinop(">=", intType, intType, booleanType, if_icmpge)        ;        enterBinop(">=", longType, longType, booleanType, lcmp, ifge);        enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge);        enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge);        enterBinop("==", intType, intType, booleanType, if_icmpeq)        ;        enterBinop("==", longType, longType, booleanType, lcmp, ifeq);        enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq);        enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq);        enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq)        ;        enterBinop("==", objectType, objectType, booleanType, if_acmpeq)        ;        enterBinop("!=", intType, intType, booleanType, if_icmpne)        ;        enterBinop("!=", longType, longType, booleanType, lcmp, ifne);        enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne);        enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne);        enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne)        ;        enterBinop("!=", objectType, objectType, booleanType, if_acmpne)        ;        enterBinop("&&", booleanType, booleanType, booleanType, bool_and);        enterBinop("||", booleanType, booleanType, booleanType, bool_or);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -