Examples of IList


Examples of org.eclipse.imp.pdb.facts.IList

  }

  private Type aliasToType(IConstructor symbol, TypeStore store) {
    String name = ((IString) symbol.get("name")).getValue();
    Type aliased = symbolToType((IConstructor) symbol.get("aliased"), store);
    IList parameters = (IList) symbol.get("parameters");
   
    if (parameters.isEmpty()) {
      return tf.aliasType(store, name, aliased);
    }
    else {
      return tf.aliasTypeFromTuple(store, name, aliased, symbolsToTupleType(parameters, store));
    }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

    try{
      boolean isListRel = rel instanceof IList;
      out = new UnicodeOutputStreamWriter(rex.getResolverRegistry().getOutputStream(loc.getURI(), false), encoding.getValue(), false);
      out = new BufferedWriter(out); // performance
      ISet irel = null;
      IList lrel = null;
      if (isListRel) {
        lrel = (IList)rel;
      }
      else {
        irel = (ISet) rel;
      }
     
      int nfields = isListRel ? lrel.asRelation().arity() : irel.asRelation().arity();
      if(head){
        for(int i = 0; i < nfields; i++){
          if(i > 0)
            out.write(sep);
          String label = paramType.getFieldName(i);
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

    }
      return result;
  }
 
  private IConstructor computeMethodTypeSymbol(ISourceLocation decl, IMethodBinding binding, boolean isDeclaration) {
    IList parameters = computeTypes(isDeclaration ? binding.getParameterTypes() : binding.getTypeArguments(), false);
   
    if (binding.isConstructor()) {
      return constructorSymbol(decl, parameters);
    } else {
      IList typeParameters = computeTypes(isDeclaration ? binding.getTypeParameters() : binding.getTypeArguments(), isDeclaration);
      IConstructor retSymbol = resolveType(binding.getReturnType(), false);
     
      return methodSymbol(decl, typeParameters, retSymbol,  parameters);
    }
  }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

    return values.constructor(cons, boundSymbol);
  }

  private IConstructor boundSymbol(ITypeBinding[] bound, boolean isDeclaration, boolean isUpperbound) {
  // Assumption: Anything appearing in a bound symbol is not a declaration
    IList boundSym = computeTypes(bound, false);
   
    org.eclipse.imp.pdb.facts.type.Type boundType = store.lookupAbstractDataType("Bound");
   
    if (!isUpperbound) {
      org.eclipse.imp.pdb.facts.type.Type sup = store.lookupConstructor(boundType, "super", tf.tupleType(boundSym.getType()));
      return values.constructor(sup, boundSym);
    }
    else {
      org.eclipse.imp.pdb.facts.type.Type ext = store.lookupConstructor(boundType, "extends", tf.tupleType(boundSym.getType()));
      return values.constructor(ext, boundSym);
    }
  }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

      }

      if (rec.getType().isList()
          && subscript.getType().isInteger()) {
        try {
          IList list = (IList) rec.getValue();
          int index = ((IInteger) subscript.getValue()).intValue();
          __eval.__setValue(__eval.newResult(list.get(index), __eval
              .__getValue()));
          list = list.put(index, __eval.__getValue().getValue());
          result = org.rascalmpl.interpreter.result.ResultFactory
              .makeResult(rec.hasInferredType() ? rec.getType()
                  .lub(list.getType()) : rec.getType(), list,
                  __eval.__getEval());
        } catch (IndexOutOfBoundsException e) {
          throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
              .indexOutOfBounds((IInteger) subscript.getValue(),
                  __eval.__getEval().getCurrentAST(), __eval
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

      assert receiver != null && receiver.getValue() != null;
     
      if (receiver.getType().isList()) {
        if (subscript.getType().isInteger()) {
          IList list = (IList) receiver.getValue();
          IValue result = list.get(((IInteger) subscript.getValue())
              .intValue());
          Type type = receiver.getType().getElementType();
          return normalizedResult(__eval, type, result);
        }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

      secondIndex = firstIndex <= endIndex ? firstIndex + 1 : firstIndex - 1;

      if (rec.getType().isList()) {
        try {
          IList list = (IList) rec.getValue();
         
          IValue repl = __eval.__getValue().getValue();
          if(!repl.getType().isList()){
            throw new UnexpectedType(rec.getType(), repl.getType(), __eval.__getEval().getCurrentAST());
          }
         
          __eval.__setValue(__eval.newResult(list, __eval.__getValue()));
          list = list.replace(firstIndex, secondIndex, endIndex, (IList) repl);
         
          result = org.rascalmpl.interpreter.result.ResultFactory
              .makeResult(rec.hasInferredType() ? rec.getType()
                  .lub(list.getType()) : rec.getType(), list,
                  __eval.__getEval());
        } catch (IndexOutOfBoundsException e) { // include last in message
          throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
          .indexOutOfBounds((IInteger) first.getValue(),
              __eval.__getEval().getCurrentAST(), __eval
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

        writePlainJSON((IConstructor) props.get(k));
      }
      out.endObject();
      break;
    case "array":
      IList vals = (IList) value.get(0);
      out.beginArray();
      for (IValue v: vals) {
        writePlainJSON((IConstructor) v);
      }
      out.endArray();
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

      ITuple ofTuple = (ITuple) of;
      String scopeIn = ((IString) ofTuple.get(0)).getValue();
      if(scopeIn.equals("")) {
        scopeIn = null;
      }
      IList fuids = (IList) ofTuple.get(1);
      int[] funs = new int[fuids.length()];
      int i = 0;
      for(IValue fuid : fuids) {
        String name = ((IString) fuid).getValue();
        //stdout.println("fillOverloadedStore: " + name);
        //stdout.flush();
        Integer index = functionMap.get(name);
        if(index == null){
          throw new CompilerError("No definition for " + fuid + " in functionMap");
        }
        funs[i++] = index;
      }
      fuids = (IList) ofTuple.get(2);
      int[] constrs = new int[fuids.length()];
      i = 0;
      for(IValue fuid : fuids) {
        Integer index = constructorMap.get(((IString) fuid).getValue());
        if(index == null){
          throw new CompilerError("No definition for " + fuid + " in constructorMap");
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IList

            t = ((IConstructor) val).getConstructorType();
          } else {
            t = val.getType();
          }
          int labelIndex = ToplevelType.getToplevelTypeAsInt(t);
          IList labels = (IList) cf.function.constantStore[CodeBlock.fetchArg1(instruction)];
          pc = ((IInteger) labels.get(labelIndex)).intValue();
          continue NEXT_INSTRUCTION;
         
        case Opcode.OP_JMPINDEXED:
          labelIndex = ((IInteger) stack[--sp]).intValue();
          labels = (IList) cf.function.constantStore[CodeBlock.fetchArg1(instruction)];
          pc = ((IInteger) labels.get(labelIndex)).intValue();
          continue NEXT_INSTRUCTION;
         
        case Opcode.OP_LOADTYPE:
          stack[sp++] = cf.function.typeConstantStore[CodeBlock.fetchArg1(instruction)];
          continue NEXT_INSTRUCTION;
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.