Examples of asAnnotatable()


Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

          IValue value = visitor.generate(entry.getValue());
          if (value == null) {
            return null;

          }
          result = result.asAnnotatable().setAnnotation(entry.getKey(), value);
        }

        return result;

      }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

          try {
            @SuppressWarnings("unused")
            Type cons = iter.next();
            ISourceLocation loc = TreeAdapter.getLocation(tree);
            IConstructor ast = makeConstructor(type, constructorName, ctx, values.string(yield));
            return ast.asAnnotatable().setAnnotation("location", loc);
          }
          catch (Backtrack b) {
            continue;
          }
        }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

      }
     
      // if in node space, make untyped nodes
      if (isUntypedNodeType(type)) {
        INode ast = values.node(constructorName, implodeArgs(store, type, args, ctx));
        return ast.asAnnotatable().setAnnotation("location", TreeAdapter.getLocation(tree)).asAnnotatable().setAnnotation("comments", comments);
      }
     
      // make a typed constructor
      if (!type.isAbstractData()) {
        throw new Backtrack(RuntimeExceptionFactory.illegalArgument(tree, null, null, "Constructor (" + constructorName + ") should match with abstract data type and not with " + type));
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

        try {
          Type cons = iter.next();
          ISourceLocation loc = TreeAdapter.getLocation(tree);
          IValue[] implodedArgs = implodeArgs(store, cons, args, ctx);
          IConstructor ast = makeConstructor(type, constructorName, ctx, implodedArgs);
          return ast.asAnnotatable().setAnnotation("location", loc).asAnnotatable().setAnnotation("comments", comments);
        }
        catch (Backtrack b) {
          continue;
        }
      }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

          rcons = (IConstructor) eval.getValueFactory().constructor(cons.getConstructorType(),  args);
        }
      }
     
      if (!cons.mayHaveKeywordParameters() && cons.asAnnotatable().hasAnnotations()) {
        rcons = rcons.asAnnotatable().setAnnotations(cons.asAnnotatable().getAnnotations());
      }

      return rcons;
    }
    else {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

  @Override
  public IConstructor constructor(Type cons, Map<String, IValue> annotations, IValue... children)
      throws FactTypeUseException {
    try {
      IConstructor result = (IConstructor) ctx.getEvaluator().call(cons.getAbstractDataType().getName(), cons.getName(), children);
      return result.asAnnotatable().setAnnotations(annotations);
    }
    catch (UndeclaredFunction | ArgumentsMismatch e) {
      // TODO this makes this very robust, but also may hide issues. Not sure what is best here yet.
      return adapted.constructor(cons, annotations, children);
    }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

      throw RuntimeExceptionFactory.illegalArgument(
          values.string(obj.toString() + " (class=" + obj.getClass() + ")"),
          ctx.getCurrentAST(), ctx.getStackTrace());
    }
    if (anchors.get(obj) != -1) {
      result = result.asAnnotatable().setAnnotation(ANCHOR_ANNO, values.integer(anchors.get(obj)));
    }
    return result;
  }
 
  public IString dumpYAML(IConstructor yaml, IEvaluatorContext ctx) {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

        for (Map.Entry<String, Type> entry : annotations.entrySet()) {
          IValue value = visitor.generate(entry.getValue());
          if (value == null) {
            return null;
          }
          result = result.asAnnotatable().setAnnotation(entry.getKey(), value);
        }

        return result;

      }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

      } else
        q = q.append(a);
    }
    IConstructor r = BoxADT.TAG.H.create(q);
    if (hspace >= 0)
      r = r.asAnnotatable().setAnnotation("hs", vf.integer(hspace));
    return r;
  }

  static IConstructor V(IValue... t) {
    return V(-1, t);
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IConstructor.asAnnotatable()

    // if (c.getConstructorType().getName()=="I") {
    // q=q.put(last, c.get(0));
    // }
    IConstructor r =  BoxADT.TAG.V.create(q);
    if (vspace >= 0)
      r = r.asAnnotatable().setAnnotation("vs", vf.integer(vspace));
    return r;
  }

  static IConstructor I(IValue... t) {
    return BoxADT.TAG.I.create(t);
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.