Package org.eclipse.imp.pdb.facts

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


    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

      }

      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

      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

      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

        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

      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

            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

   
    for (int i = 0; i < args.length(); i+=(delta+1)) {
      IConstructor tree = (IConstructor) args.get(i);
     
      if (TreeAdapter.isList(tree) && ProductionAdapter.shouldFlatten(production, TreeAdapter.getProduction(tree))) {
        IList nestedArgs = TreeAdapter.getArgs(tree);
        if (nestedArgs.length() > 0) {
          appendPreviousSeparators(args, result, delta, i, previousWasEmpty);
          result.appendAll(nestedArgs);
        }
        else {
          previousWasEmpty = true;
View Full Code Here

    for (; i < n; i++) {
      if (debug)
        System.err.println("matched:" + computed[i].getType() + " "
            + computed[i].getType().isList());
      if (computed[i].getType().isList()) {
        IList v = (IList) computed[i];
        if (found.getFieldType(i).isSet())
          b[i] = vf.set(toArray(v));
        else if (found.getFieldType(i).isTuple())
          b[i] = vf.tuple(toArray(v));
        else if (found.getFieldType(i).isRational()) {
View Full Code Here

TOP

Related Classes of org.eclipse.imp.pdb.facts.IList

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.