Package org.rascalmpl.interpreter.staticErrors

Examples of org.rascalmpl.interpreter.staticErrors.UndeclaredField


        Type node = cons.getConstructorType();

        if (!receiverType.hasField(label, __eval.getCurrentEnvt()
            .getStore())
            && !receiverType.hasKeywordParameter(label, __eval.getCurrentEnvt().getStore())) {
          throw new UndeclaredField(label, receiverType, this);
        }

        if (!node.hasField(label) && ! node.hasKeywordParameter(label)) {
          throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
              .noSuchField(label, this, __eval.getStackTrace());
        }

        if (node.hasKeywordParameter(label)) {
          return ResultFactory
              .makeResult(node.getKeywordParameterType(label), cons.asWithKeywordParameters().getParameter(label)
                  ,__eval);
        }
        else {
          int index = node.getFieldIndex(label);
          return ResultFactory
              .makeResult(node.getFieldType(index), cons.get(index),
                  __eval);
        }
      } else if (receiverType.isSourceLocation()) {
        return receiver.fieldAccess(label, new TypeStore());
      } else {
        throw new UndeclaredField(label, receiverType, this);
      }

    }
View Full Code Here


      }
    } catch (InvalidDateTimeException e) {
      throw RuntimeExceptionFactory.illegalArgument(dt, ctx.getCurrentAST(), null, e.getMessage());

    }
    throw new UndeclaredField(name, getTypeFactory().dateTimeType(), ctx.getCurrentAST());

  }
View Full Code Here

        if (!replType.isInteger()) {
          throw new UnexpectedType(getTypeFactory().integerType(), replType, ctx.getCurrentAST());
        }
        tzOffsetMin = ((IInteger) replValue).intValue();       
      } else {
        throw new UndeclaredField(name, getTypeFactory().dateTimeType(), ctx.getCurrentAST());
      }

      IDateTime newdt = null;
      if (dt.isDate()) {
        newdt = getValueFactory().date(year, month, day);
View Full Code Here

        w.insert(it.next());
      }
      return makeResult(getTypeFactory().setType(type.getValueType()), w.done(), ctx);
    }

    throw new UndeclaredField(name, type, ctx.getCurrentAST());
  }
View Full Code Here

        String fieldName = org.rascalmpl.interpreter.utils.Names
            .name(f.getFieldName());
        try {
          fieldIndices[i] = baseType.getFieldIndex(fieldName);
        } catch (UndeclaredFieldException e) {
          throw new UndeclaredField(fieldName, baseType,
              ctx.getCurrentAST());
        }
      }

      if (fieldIndices[i] < 0 || fieldIndices[i] > 1) {
View Full Code Here

    @Override
    public <U extends IValue> Result<U> fieldAccess(String name, TypeStore store) {
      Type tupleType = getType().getFieldTypes()
     
      if (!getType().hasFieldNames()) {
        throw new UndeclaredField(name, getType(), ctx.getCurrentAST());
      }
     
      if (!getType().hasField(name, store)) {
        throw new UndeclaredField(name, getType(), ctx.getCurrentAST());
      }
     
      try {
        ISetWriter w = getValueFactory().setWriter();
        for (IValue e : getValue()) {
          w.insert(((ITuple) e).get(tupleType.getFieldIndex(name)));
        }
        return makeResult(getTypeFactory().setType(tupleType.getFieldType(name)), w.done(), ctx);
      }
      // TODO: why catch this exception here?
      catch (UndeclaredFieldException e) {
        throw new UndeclaredField(name, getType(), ctx.getCurrentAST());
      }
    }
View Full Code Here

          String fieldName = org.rascalmpl.interpreter.utils.Names
              .name(f.getFieldName());
          try {
            fieldIndices[i] = baseType.getFieldIndex(fieldName);
          } catch (UndeclaredFieldException e) {
            throw new UndeclaredField(fieldName, baseType,
                ctx.getCurrentAST());
          }
        }

        if (fieldIndices[i] < 0 || (fieldIndices[i] > baseType.getArity() && !getType().getElementType().isBottom())) {
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.staticErrors.UndeclaredField

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.