Package wyvern.tools.types

Examples of wyvern.tools.types.Environment.extend()


     
      //TODO: fix this
     
      //first get/ create the binding
      TagBinding tagBinding = TagBinding.getOrCreate(taggedInfo.getTagName());
      newEnv = newEnv.extend(tagBinding);
     
      //now handle case-of and comprises clauses
      if (taggedInfo.getCaseOfTag() != null) {
        String caseOf = taggedInfo.getCaseOfTag();
       
View Full Code Here


      if (!(b instanceof NameBinding))
        continue;

      if (b.getType() instanceof Arrow) {
        tev = tev.extend(b);
        continue;
      }
     
      if (b.getType() instanceof TypeType) {
        tev = tev.extend(b);
View Full Code Here

        tev = tev.extend(b);
        continue;
      }
     
      if (b.getType() instanceof TypeType) {
        tev = tev.extend(b);
        continue;
      }
     
      // System.out.println("Assume it is a getter even if it is wrong! :-)");
     
View Full Code Here

        String propName = vd.getName();
        Type type = vd.getType();
        FileLocation line = vd.getLocation();


        newEnv = newEnv.extend(new NameBindingImpl(propName, type));
        newEnv = newEnv.extend(
            new NameBindingImpl(
                "set" + propName.substring(0,1).toUpperCase() + propName.substring(1),
                new Arrow(type, Unit.getInstance())));
      } else if (d instanceof ValDeclaration) {
View Full Code Here

        Type type = vd.getType();
        FileLocation line = vd.getLocation();


        newEnv = newEnv.extend(new NameBindingImpl(propName, type));
        newEnv = newEnv.extend(
            new NameBindingImpl(
                "set" + propName.substring(0,1).toUpperCase() + propName.substring(1),
                new Arrow(type, Unit.getInstance())));
      } else if (d instanceof ValDeclaration) {
        if (((ValDeclaration) d).isClassMember() != useClassMembers)
View Full Code Here

      } else if (d instanceof TypeDeclaration) {
        newEnv = d.extend(newEnv, newEnv);
      } else if (d instanceof ClassDeclaration) {
        ClassDeclaration cd = (ClassDeclaration) d;
        TypeType tt = ((ClassType) cd.getType()).getEquivType();
        newEnv = newEnv.extend(new NameBindingImpl(cd.getName(), tt));
      } else {
        System.out.println("Unsupported class member in class to type converter: " + d.getClass());
      }
    }
    return newEnv;
View Full Code Here

      Environment innerEnv = seq.extendName(Environment.getEmptyEnvironment(), env).extend(declEnv);
      seq.typecheck(env.extend(new NameBindingImpl("this", new ClassType(new Reference<>(innerEnv), new Reference<>(innerEnv), new LinkedList<>(), classVarTypeBinding.getClassDecl().getName()))), Optional.empty());


      Environment environment = seq.extendType(declEnv, declEnv.extend(env));
      environment = seq.extendName(environment, environment.extend(env));
      Environment nnames = seq.extend(environment, environment);

      Environment objTee = TypeDeclUtils.getTypeEquivalentEnvironment(nnames.extend(declEnv));
      Type classVarType = new ClassType(new Reference<>(nnames.extend(declEnv)), new Reference<>(objTee), new LinkedList<>(), classVarTypeBinding.getClassDecl().getName());
      if (!(classVarType instanceof ClassType)) {
View Full Code Here

  @Override
  public Value evaluate(Environment env) {
    Environment argValEnv = Environment.getEmptyEnvironment();
    for (Entry<String, TypedAST> elem : args.entrySet())
      argValEnv = argValEnv.extend(new ValueBinding(elem.getKey(), elem.getValue().evaluate(env)));

    ClassBinding classVarTypeBinding = (ClassBinding) env.lookupBinding("class", ClassBinding.class).orElse(null);
    ClassDeclaration classDecl;
    if (classVarTypeBinding != null)
      classDecl = classVarTypeBinding.getClassDecl();
View Full Code Here

    Environment evalEnv = env.extend(new LateValueBinding("this", objRef, ct));
    classDecl.evalDecl(evalEnv, classDecl.extendWithValue(Environment.getEmptyEnvironment()));
    final Environment ideclEnv = StreamSupport.stream(seq.getDeclIterator().spliterator(), false).
        reduce(evalEnv, (oenv,decl)->(decl instanceof ClassDeclaration)?decl.evalDecl(oenv):oenv, Environment::extend);
    Environment objenv = seq.bindDecls(ideclEnv, seq.extendWithDecls(classDecl.getFilledBody(objRef)));
    objRef.set(new Obj(objenv.extend(argValEnv)));
   
    // System.out.println("Finished evaluating new: " + this);
   
    return objRef.get();
  }
View Full Code Here

     
      //TODO: fix this
     
      //first get/ create the binding
      TagBinding tagBinding = TagBinding.getOrCreate(taggedInfo.getTagName());
      newEnv = newEnv.extend(tagBinding);
     
      //now handle case-of and comprises clauses
      if (taggedInfo.getCaseOfTag() != null) {
        String caseOf = taggedInfo.getCaseOfTag();
       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.