Package org.rascalmpl.ast

Examples of org.rascalmpl.ast.Parameters


    @Override
    public Type typeOf(Environment env, boolean instantiateTypeParameters, IEvaluator<Result<IValue>> eval) {
      RascalTypeFactory RTF = org.rascalmpl.interpreter.types.RascalTypeFactory
          .getInstance();
      Parameters parameters = getParameters();
      Type kwParams = TF.voidType();

      if (parameters.hasKeywordFormals() && parameters.getKeywordFormals().hasKeywordFormalList()) {
        List<KeywordFormal> kwd = parameters.getKeywordFormals().getKeywordFormalList();
        kwParams = TypeDeclarationEvaluator.computeKeywordParametersType(kwd, eval);
      }

      return RTF.functionType(getType().typeOf(env, instantiateTypeParameters, eval), parameters.typeOf(env, instantiateTypeParameters, eval), kwParams);
    }
View Full Code Here


    public Type typeOf(Environment env, boolean instantiateTypeParameters, IEvaluator<Result<IValue>> eval) {
      RascalTypeFactory RTF = RascalTypeFactory.getInstance();

      Type kwParams = TF.voidType();

      Parameters parameters = getParameters();

      if (parameters.hasKeywordFormals() && parameters.getKeywordFormals().hasKeywordFormalList()) {
        List<KeywordFormal> kwd = parameters.getKeywordFormals().getKeywordFormalList();
        kwParams = TypeDeclarationEvaluator.computeKeywordParametersType(kwd, eval);
      }

      return RTF.functionType(getType().typeOf(env, instantiateTypeParameters, eval), getParameters()
          .typeOf(env, instantiateTypeParameters, eval), kwParams);
View Full Code Here

    }
   
    for(ClassLoader loader : loaders){
      try{
        Class<?> clazz = loader.loadClass(className);
        Parameters parameters = func.getSignature().getParameters();
        Class<?>[] javaTypes = getJavaTypes(parameters, env, hasReflectiveAccess);

        try{
          Method m;
         
View Full Code Here

  public IConstructor getFirstOutermostProduction() {
    return firstOutermostProduction;
  }
 
  private List<Expression> cacheFormals() throws ImplementationError {
    Parameters params;
    List<Expression> formals;
   
    if (ast instanceof FunctionDeclaration) {
      params = ((FunctionDeclaration) ast).getSignature().getParameters();
    }
    else if (ast instanceof Closure) {
      params = ((Closure) ast).getParameters();
    }
    else if (ast instanceof VoidClosure) {
      params = ((VoidClosure) ast).getParameters();
    }
    else {
      throw new ImplementationError("Unexpected kind of Rascal function: " + ast);
    }
   
    formals = params.getFormals().getFormals();
   
    if (params.isVarArgs() && formals.size() > 0) {
      // deal with varags, change the last argument to a list if its not a pattern
      Expression last = formals.get(formals.size() - 1);
      if (last.isTypedVariable()) {
        org.rascalmpl.ast.Type oldType = last.getType();
        ISourceLocation origin = last.getLocation();
View Full Code Here

    public Result<IValue> interpret(IEvaluator<Result<IValue>> eval) {

      eval.setCurrentAST(this);
      eval.notifyAboutSuspension(this);     

      Parameters parameters = getParameters();
      Type formals = parameters.typeOf(eval.getCurrentEnvt(), true, eval);
      RascalTypeFactory RTF = RascalTypeFactory.getInstance();

      Type kwParams = TF.voidType();
      java.util.List<KeywordFormal> kws = parameters.getKeywordFormals().hasKeywordFormalList() ? parameters.getKeywordFormals().getKeywordFormalList() : Collections.<KeywordFormal>emptyList();
     
      if (parameters.hasKeywordFormals() && parameters.getKeywordFormals().hasKeywordFormalList()) {
        kwParams = TypeDeclarationEvaluator.computeKeywordParametersType(kws, eval);
      }

      return new RascalFunction(this, eval, null, (FunctionType) RTF
          .functionType(TF.voidType(), formals, kwParams), kws, this.getParameters()
View Full Code Here

    public Result<IValue> interpret(IEvaluator<Result<IValue>> __eval) {
      __eval.setCurrentAST(this);
      __eval.notifyAboutSuspension(this);     

      Environment env = __eval.getCurrentEnvt();
      Parameters parameters = getParameters();
      Type formals = parameters.typeOf(env, true, __eval);
      Type returnType = typeOf(env, true, __eval);
      RascalTypeFactory RTF = RascalTypeFactory.getInstance();

      Type kwParams = TF.voidType();

      java.util.List<KeywordFormal> kwd = parameters.getKeywordFormals().hasKeywordFormalList() ? parameters.getKeywordFormals().getKeywordFormalList() : Collections.<KeywordFormal>emptyList();
     
      if (parameters.hasKeywordFormals() && parameters.getKeywordFormals().hasKeywordFormalList()) {
        kwParams = TypeDeclarationEvaluator.computeKeywordParametersType(kwd, __eval);
      }

      return new RascalFunction(this, __eval, null,
          (FunctionType) RTF.functionType(returnType, formals, kwParams),
View Full Code Here

TOP

Related Classes of org.rascalmpl.ast.Parameters

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.