Package wyil.lang

Examples of wyil.lang.Type


  @Test public void test_3719() { checkNotSubtype("{int f2}|int","{null f2}|null"); }
  @Test public void test_3720() { checkNotSubtype("{int f2}|int","{int f1}|int"); }
  @Test public void test_3721() { checkIsSubtype("{int f2}|int","{int f2}|int"); }

  private void checkIsSubtype(String from, String to) {
    Type ft = Type.fromString(from);
    Type tt = Type.fromString(to);
    assertTrue(Type.isSubtype(ft,tt));
  }
View Full Code Here


    Type ft = Type.fromString(from);
    Type tt = Type.fromString(to);
    assertTrue(Type.isSubtype(ft,tt));
  }
  private void checkNotSubtype(String from, String to) {
    Type ft = Type.fromString(from);
    Type tt = Type.fromString(to);
    assertFalse(Type.isSubtype(ft,tt));
  }
View Full Code Here

    public ArrayList<Nominal> elements() {
      ArrayList<Nominal> r = new ArrayList<Nominal>();
      java.util.List<Type> rawElements = raw.elements();
      java.util.List<Type> nominalElements = nominal.elements();
      for(int i=0;i!=rawElements.size();++i) {
        Type nominalElement = nominalElements.get(i);
        Type rawElement = rawElements.get(i);
        r.add(construct(nominalElement,rawElement));
      }
      return r;
    }
View Full Code Here

    public HashMap<String,Nominal> fields() {
      HashMap<String,Nominal> r = new HashMap<String,Nominal>();
      HashMap<String,Type> nominalFields = nominal.fields();
      for(java.util.Map.Entry<String, Type> e : raw.fields().entrySet()) {
        String key = e.getKey();
        Type rawField = e.getValue();
        Type nominalField = nominalFields.get(key);
        r.put(e.getKey(), Nominal.construct(nominalField,rawField));
      }
      return r;
    }
View Full Code Here

      }
      return r;
    }

    public Nominal field(String field) {
      Type rawField = raw.fields().get(field);
      if(rawField == null) {
        return null;
      } else {
        return construct(nominal.fields().get(field),rawField);
      }
View Full Code Here

    public HashMap<String,Nominal> fields() {
      HashMap<String,Nominal> r = new HashMap<String,Nominal>();
      HashMap<String,Type> nominalFields = nominal.fields();
      for(java.util.Map.Entry<String, Type> e : raw.fields().entrySet()) {
        String key = e.getKey();
        Type rawField = e.getValue();
        Type nominalField = nominalFields.get(key);
        r.put(e.getKey(), Nominal.construct(nominalField,rawField));
      }
      return r;
    }
View Full Code Here

      }
      return r;
    }

    public Nominal field(String field) {
      Type rawField = raw.fields().get(field);
      if(rawField == null) {
        return null;
      } else {
        return construct(nominal.fields().get(field),rawField);
      }
View Full Code Here

    public java.util.List<Nominal> params() {
      ArrayList<Nominal> r = new ArrayList<Nominal>();
      java.util.List<Type> rawElements = raw.params();
      java.util.List<Type> nominalElements = nominal.params();
      for(int i=0;i!=rawElements.size();++i) {
        Type nominalElement = nominalElements.get(i);
        Type rawElement = rawElements.get(i);
        r.add(construct(nominalElement,rawElement));
      }
      return r;
    }
View Full Code Here

    public java.util.List<Nominal> params() {
      ArrayList<Nominal> r = new ArrayList<Nominal>();
      java.util.List<Type> rawElements = raw.params();
      java.util.List<Type> nominalElements = nominal.params();
      for(int i=0;i!=rawElements.size();++i) {
        Type nominalElement = nominalElements.get(i);
        Type rawElement = rawElements.get(i);
        r.add(construct(nominalElement,rawElement));
      }
      return r;
    }
View Full Code Here

    // No child subsumes type.  So construct its child set.
    ArrayList<Node> nchildren = new ArrayList<Node>();
    for(int i=0;i!=children.size();) {
      Node n = children.get(i);
      Type nType = n.type;
      if(Type.isSubtype(type,nType)) {
        if(nType.equals(type)) {
          if(n.constraint != null) {
            String nextLabel = CodeUtils.freshLabel();
            Code.Block blk = chainBlock(nextLabel, n.constraint);
            blk.add(Codes.Label(nextLabel));
            blk.addAll(constraint);
View Full Code Here

TOP

Related Classes of wyil.lang.Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.