589 names.clone, |
503 names.clone, |
590 new MethodType(List.<Type>nil(), objectType, |
504 new MethodType(List.<Type>nil(), objectType, |
591 List.<Type>nil(), methodClass), |
505 List.<Type>nil(), methodClass), |
592 arrayClass); |
506 arrayClass); |
593 arrayClass.members().enter(arrayCloneMethod); |
507 arrayClass.members().enter(arrayCloneMethod); |
594 |
|
595 // Enter operators. |
|
596 /* Internally we use +++, --- for unary +, - to reduce +, - operators |
|
597 * overloading |
|
598 */ |
|
599 enterUnop("+++", doubleType, doubleType, nop); |
|
600 enterUnop("+++", floatType, floatType, nop); |
|
601 enterUnop("+++", longType, longType, nop); |
|
602 enterUnop("+++", intType, intType, nop); |
|
603 |
|
604 enterUnop("---", doubleType, doubleType, dneg); |
|
605 enterUnop("---", floatType, floatType, fneg); |
|
606 enterUnop("---", longType, longType, lneg); |
|
607 enterUnop("---", intType, intType, ineg); |
|
608 |
|
609 enterUnop("~", longType, longType, lxor); |
|
610 enterUnop("~", intType, intType, ixor); |
|
611 |
|
612 enterUnop("++", doubleType, doubleType, dadd); |
|
613 enterUnop("++", floatType, floatType, fadd); |
|
614 enterUnop("++", longType, longType, ladd); |
|
615 enterUnop("++", intType, intType, iadd); |
|
616 enterUnop("++", charType, charType, iadd); |
|
617 enterUnop("++", shortType, shortType, iadd); |
|
618 enterUnop("++", byteType, byteType, iadd); |
|
619 |
|
620 enterUnop("--", doubleType, doubleType, dsub); |
|
621 enterUnop("--", floatType, floatType, fsub); |
|
622 enterUnop("--", longType, longType, lsub); |
|
623 enterUnop("--", intType, intType, isub); |
|
624 enterUnop("--", charType, charType, isub); |
|
625 enterUnop("--", shortType, shortType, isub); |
|
626 enterUnop("--", byteType, byteType, isub); |
|
627 |
|
628 enterUnop("!", booleanType, booleanType, bool_not); |
|
629 nullcheck = enterUnop("<*nullchk*>", objectType, objectType, nullchk); |
|
630 |
|
631 // string concatenation |
|
632 enterBinop("+", stringType, objectType, stringType, string_add); |
|
633 enterBinop("+", objectType, stringType, stringType, string_add); |
|
634 enterBinop("+", stringType, stringType, stringType, string_add); |
|
635 enterBinop("+", stringType, intType, stringType, string_add); |
|
636 enterBinop("+", stringType, longType, stringType, string_add); |
|
637 enterBinop("+", stringType, floatType, stringType, string_add); |
|
638 enterBinop("+", stringType, doubleType, stringType, string_add); |
|
639 enterBinop("+", stringType, booleanType, stringType, string_add); |
|
640 enterBinop("+", stringType, botType, stringType, string_add); |
|
641 enterBinop("+", intType, stringType, stringType, string_add); |
|
642 enterBinop("+", longType, stringType, stringType, string_add); |
|
643 enterBinop("+", floatType, stringType, stringType, string_add); |
|
644 enterBinop("+", doubleType, stringType, stringType, string_add); |
|
645 enterBinop("+", booleanType, stringType, stringType, string_add); |
|
646 enterBinop("+", botType, stringType, stringType, string_add); |
|
647 |
|
648 // these errors would otherwise be matched as string concatenation |
|
649 enterBinop("+", botType, botType, botType, error); |
|
650 enterBinop("+", botType, intType, botType, error); |
|
651 enterBinop("+", botType, longType, botType, error); |
|
652 enterBinop("+", botType, floatType, botType, error); |
|
653 enterBinop("+", botType, doubleType, botType, error); |
|
654 enterBinop("+", botType, booleanType, botType, error); |
|
655 enterBinop("+", botType, objectType, botType, error); |
|
656 enterBinop("+", intType, botType, botType, error); |
|
657 enterBinop("+", longType, botType, botType, error); |
|
658 enterBinop("+", floatType, botType, botType, error); |
|
659 enterBinop("+", doubleType, botType, botType, error); |
|
660 enterBinop("+", booleanType, botType, botType, error); |
|
661 enterBinop("+", objectType, botType, botType, error); |
|
662 |
|
663 enterBinop("+", doubleType, doubleType, doubleType, dadd); |
|
664 enterBinop("+", floatType, floatType, floatType, fadd); |
|
665 enterBinop("+", longType, longType, longType, ladd); |
|
666 enterBinop("+", intType, intType, intType, iadd); |
|
667 |
|
668 enterBinop("-", doubleType, doubleType, doubleType, dsub); |
|
669 enterBinop("-", floatType, floatType, floatType, fsub); |
|
670 enterBinop("-", longType, longType, longType, lsub); |
|
671 enterBinop("-", intType, intType, intType, isub); |
|
672 |
|
673 enterBinop("*", doubleType, doubleType, doubleType, dmul); |
|
674 enterBinop("*", floatType, floatType, floatType, fmul); |
|
675 enterBinop("*", longType, longType, longType, lmul); |
|
676 enterBinop("*", intType, intType, intType, imul); |
|
677 |
|
678 enterBinop("/", doubleType, doubleType, doubleType, ddiv); |
|
679 enterBinop("/", floatType, floatType, floatType, fdiv); |
|
680 enterBinop("/", longType, longType, longType, ldiv); |
|
681 enterBinop("/", intType, intType, intType, idiv); |
|
682 |
|
683 enterBinop("%", doubleType, doubleType, doubleType, dmod); |
|
684 enterBinop("%", floatType, floatType, floatType, fmod); |
|
685 enterBinop("%", longType, longType, longType, lmod); |
|
686 enterBinop("%", intType, intType, intType, imod); |
|
687 |
|
688 enterBinop("&", booleanType, booleanType, booleanType, iand); |
|
689 enterBinop("&", longType, longType, longType, land); |
|
690 enterBinop("&", intType, intType, intType, iand); |
|
691 |
|
692 enterBinop("|", booleanType, booleanType, booleanType, ior); |
|
693 enterBinop("|", longType, longType, longType, lor); |
|
694 enterBinop("|", intType, intType, intType, ior); |
|
695 |
|
696 enterBinop("^", booleanType, booleanType, booleanType, ixor); |
|
697 enterBinop("^", longType, longType, longType, lxor); |
|
698 enterBinop("^", intType, intType, intType, ixor); |
|
699 |
|
700 enterBinop("<<", longType, longType, longType, lshll); |
|
701 enterBinop("<<", intType, longType, intType, ishll); |
|
702 enterBinop("<<", longType, intType, longType, lshl); |
|
703 enterBinop("<<", intType, intType, intType, ishl); |
|
704 |
|
705 enterBinop(">>", longType, longType, longType, lshrl); |
|
706 enterBinop(">>", intType, longType, intType, ishrl); |
|
707 enterBinop(">>", longType, intType, longType, lshr); |
|
708 enterBinop(">>", intType, intType, intType, ishr); |
|
709 |
|
710 enterBinop(">>>", longType, longType, longType, lushrl); |
|
711 enterBinop(">>>", intType, longType, intType, iushrl); |
|
712 enterBinop(">>>", longType, intType, longType, lushr); |
|
713 enterBinop(">>>", intType, intType, intType, iushr); |
|
714 |
|
715 enterBinop("<", doubleType, doubleType, booleanType, dcmpg, iflt); |
|
716 enterBinop("<", floatType, floatType, booleanType, fcmpg, iflt); |
|
717 enterBinop("<", longType, longType, booleanType, lcmp, iflt); |
|
718 enterBinop("<", intType, intType, booleanType, if_icmplt); |
|
719 |
|
720 enterBinop(">", doubleType, doubleType, booleanType, dcmpl, ifgt); |
|
721 enterBinop(">", floatType, floatType, booleanType, fcmpl, ifgt); |
|
722 enterBinop(">", longType, longType, booleanType, lcmp, ifgt); |
|
723 enterBinop(">", intType, intType, booleanType, if_icmpgt); |
|
724 |
|
725 enterBinop("<=", doubleType, doubleType, booleanType, dcmpg, ifle); |
|
726 enterBinop("<=", floatType, floatType, booleanType, fcmpg, ifle); |
|
727 enterBinop("<=", longType, longType, booleanType, lcmp, ifle); |
|
728 enterBinop("<=", intType, intType, booleanType, if_icmple); |
|
729 |
|
730 enterBinop(">=", doubleType, doubleType, booleanType, dcmpl, ifge); |
|
731 enterBinop(">=", floatType, floatType, booleanType, fcmpl, ifge); |
|
732 enterBinop(">=", longType, longType, booleanType, lcmp, ifge); |
|
733 enterBinop(">=", intType, intType, booleanType, if_icmpge); |
|
734 |
|
735 enterBinop("==", objectType, objectType, booleanType, if_acmpeq); |
|
736 enterBinop("==", booleanType, booleanType, booleanType, if_icmpeq); |
|
737 enterBinop("==", doubleType, doubleType, booleanType, dcmpl, ifeq); |
|
738 enterBinop("==", floatType, floatType, booleanType, fcmpl, ifeq); |
|
739 enterBinop("==", longType, longType, booleanType, lcmp, ifeq); |
|
740 enterBinop("==", intType, intType, booleanType, if_icmpeq); |
|
741 |
|
742 enterBinop("!=", objectType, objectType, booleanType, if_acmpne); |
|
743 enterBinop("!=", booleanType, booleanType, booleanType, if_icmpne); |
|
744 enterBinop("!=", doubleType, doubleType, booleanType, dcmpl, ifne); |
|
745 enterBinop("!=", floatType, floatType, booleanType, fcmpl, ifne); |
|
746 enterBinop("!=", longType, longType, booleanType, lcmp, ifne); |
|
747 enterBinop("!=", intType, intType, booleanType, if_icmpne); |
|
748 |
|
749 enterBinop("&&", booleanType, booleanType, booleanType, bool_and); |
|
750 enterBinop("||", booleanType, booleanType, booleanType, bool_or); |
|
751 } |
508 } |
752 |
509 |
753 /** Define a new class given its name and owner. |
510 /** Define a new class given its name and owner. |
754 */ |
511 */ |
755 public ClassSymbol defineClass(Name name, Symbol owner) { |
512 public ClassSymbol defineClass(Name name, Symbol owner) { |