Example #1
0
  public ClassDecl ClassDeclAttribute(
      Position pos,
      Flags flags,
      String name,
      TypeNode superClass,
      List interfaces,
      ClassBody body,
      TypeNode domain,
      TypeSystem typeSys) {
    JeddTypeSystem ts = (JeddTypeSystem) typeSys;
    body =
        body.addMember(
            FieldDecl(
                pos,
                Flags.PUBLIC.set(Flags.FINAL),
                domain,
                "domain",
                Cast(pos, domain, Call(pos, domain, "v"))));
    body =
        body.addMember(
            MethodDecl(
                pos,
                Flags.PUBLIC,
                CanonicalTypeNode(pos, ts.domain()),
                "domain",
                Collections.EMPTY_LIST,
                Collections.EMPTY_LIST,
                Block(pos, Return(pos, AmbExpr(pos, "domain")))));
    body =
        body.addMember(
            MethodDecl(
                pos,
                Flags.PUBLIC.set(Flags.STATIC),
                CanonicalTypeNode(pos, ts.attribute()),
                "v",
                Collections.EMPTY_LIST,
                Collections.EMPTY_LIST,
                Block(pos, Return(pos, AmbExpr(pos, "instance")))));
    body =
        body.addMember(
            FieldDecl(
                pos,
                Flags.PRIVATE.set(Flags.STATIC),
                CanonicalTypeNode(pos, ts.attribute()),
                "instance",
                New(pos, AmbTypeNode(pos, name), Collections.EMPTY_LIST)));

    return ClassDecl(pos, flags, name, superClass, interfaces, body);
  }
Example #2
0
 static {
   flagsToHex.put(Flags.PUBLIC.toString(), 0x0001);
   flagsToHex.put(Flags.PRIVATE.toString(), 0x0002);
   flagsToHex.put(Flags.PROTECTED.toString(), 0x0004);
   flagsToHex.put(Flags.STATIC.toString(), 0x0008);
   flagsToHex.put(Flags.FINAL.toString(), 0x0010);
   // flagsToHex.put(Flags.SYNCHRONIZED.toString(), 0x0020);
   flagsToHex.put(Flags.NATIVE.toString(), 0x0100);
   flagsToHex.put(Flags.ABSTRACT.toString(), 0x0400);
   // flagsToHex.put(Flags.STRICTFP.toString(), 0x0800);
 }
Example #3
0
  public ClassDecl ClassDeclPhysDom(
      Position pos,
      Flags flags,
      String name,
      TypeNode superClass,
      List interfaces,
      ClassBody body,
      TypeSystem typeSys) {
    JeddTypeSystem ts = (JeddTypeSystem) typeSys;
    body =
        body.addMember(
            MethodDecl(
                pos,
                Flags.PUBLIC,
                CanonicalTypeNode(pos, ts.Int()),
                "bits",
                Collections.EMPTY_LIST,
                Collections.EMPTY_LIST,
                Block(pos, Return(pos, IntLit(pos, IntLit.INT, 0)))));
    body =
        body.addMember(
            MethodDecl(
                pos,
                Flags.PUBLIC.set(Flags.STATIC),
                CanonicalTypeNode(pos, ts.physicalDomain()),
                "v",
                Collections.EMPTY_LIST,
                Collections.EMPTY_LIST,
                Block(pos, Return(pos, AmbExpr(pos, "instance")))));
    body =
        body.addMember(
            FieldDecl(
                pos,
                Flags.PRIVATE.set(Flags.STATIC),
                CanonicalTypeNode(pos, ts.physicalDomain()),
                "instance",
                New(pos, AmbTypeNode(pos, name), Collections.EMPTY_LIST)));

    return ClassDecl(pos, flags, name, superClass, interfaces, body);
  }