Package org.eclipse.imp.pdb.facts

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


            args = w.done();

            return TreeAdapter.setArgs(tree, args);
          }

          IConstructor type = retrieveHoleType(tree);
          return antiquotes.get(TreeAdapter.yield(tree)).asAnnotatable().setAnnotation("holeType", type);
        }

        private IConstructor retrieveHoleType(IConstructor tree) {
          IConstructor prod = TreeAdapter.getProduction(tree);
          ISet attrs = ProductionAdapter.getAttributes(prod);

          for (IValue attr : attrs) {
            if (((IConstructor) attr).getConstructorType() == Factory.Attr_Tag) {
              IValue arg = ((IConstructor) attr).get(0);
View Full Code Here


    }
    else if (cons.getConstructorType() == Factory.Tree_Appl) {
      this.symbol = TreeAdapter.getType(cons);
    }
    else if (cons.getConstructorType() == Factory.Tree_Amb) {
      IConstructor first = (IConstructor) TreeAdapter.getAlternatives(cons).iterator().next();
      this.symbol = TreeAdapter.getType(first);
    }
    else {
      throw new ImplementationError("Invalid concrete syntax type constructor:" + cons);
    }
View Full Code Here

    return type.glbWithNonTerminal(this);
  }
 
  @Override
  public boolean isSubtypeOfNonTerminal(RascalType other) {
    IConstructor otherSym = ((NonTerminalType)other).symbol;
    if (SymbolAdapter.isIterPlus(symbol) && SymbolAdapter.isIterStar(otherSym)) {
      return SymbolAdapter.isEqual(SymbolAdapter.getSymbol(symbol), SymbolAdapter.getSymbol(otherSym));
    }

    if (SymbolAdapter.isIterPlusSeps(symbol) && SymbolAdapter.isIterStarSeps(otherSym)) {
View Full Code Here

    return SymbolAdapter.isEqual(otherSym, symbol);
  }
 
  @Override
  protected Type lubWithNonTerminal(RascalType other) {
    IConstructor otherSym = ((NonTerminalType)other).symbol;
   
    // * eats +
    if (SymbolAdapter.isIterPlus(symbol) && SymbolAdapter.isIterStar(otherSym)) {
      return other;
    }
View Full Code Here

    return SymbolAdapter.isEqual(otherSym, symbol) ? this : Factory.Tree;
  }

  @Override
  protected Type glbWithNonTerminal(RascalType other) {
    IConstructor otherSym = ((NonTerminalType)other).symbol;
   
  if (SymbolAdapter.isIterPlus(symbol) && SymbolAdapter.isIterStar(otherSym)) {
      return this;
    }
    else if (SymbolAdapter.isIterPlus(otherSym) && SymbolAdapter.isIterStar(symbol)) {
View Full Code Here

    TypeStore store = new TypeStore();
    IMap definitions = rex.getSymbolDefinitions();
    TypeReifier tr = new TypeReifier(vf);
    tr.declareAbstractDataTypes(definitions, store);
   
    IConstructor symbol = typeToSymbol(t, store);
   
    Map<Type,Type> bindings = new HashMap<Type,Type>();
    bindings.put(Factory.TypeParam, t);
    Factory.Type.instantiate(bindings);
   
View Full Code Here

    boolean allLabels = true;
    Type[] types = new Type[symbols.length()];
    String[] labels = new String[symbols.length()];
   
    for (int i = 0; i < symbols.length(); i++) {
      IConstructor elem = (IConstructor) symbols.get(i);
      if (elem.getConstructorType() == Factory.Symbol_Label) {
        labels[i] = ((IString) elem.get("name")).getValue();
        elem = (IConstructor) elem.get("symbol");
      }
      else {
        allLabels = false;
      }
     
View Full Code Here

      return tf.tupleType(types);
    }
  }
 
  private Type mapToType(IConstructor symbol, TypeStore store) {
    IConstructor from = (IConstructor) symbol.get("from");
    IConstructor to = (IConstructor) symbol.get("to");
    String fromLabel = null;
    String toLabel = null;
   
    if (SymbolAdapter.isLabel(from)) {
      fromLabel = SymbolAdapter.getLabel(from);
      from = (IConstructor) from.get("symbol");
    }
    if (SymbolAdapter.isLabel(to)) {
      toLabel = SymbolAdapter.getLabel(to);
      to = (IConstructor) to.get("symbol");
    }
    if (fromLabel != null && toLabel != null) {
      return tf.mapType(symbolToType(from, store), fromLabel, symbolToType(to, store), toLabel);
    }
    else {
View Full Code Here

      }
    return makeBinding("unknown", null, null);
  }
 
  public IConstructor resolveType(IBinding binding, boolean isDeclaration) {
    IConstructor result = unresolvedSym();
    if (binding != null) {
      ISourceLocation uri = resolveBinding(binding);
        if (binding instanceof ITypeBinding) {
          return computeTypeSymbol(uri, (ITypeBinding) binding, isDeclaration);
        } else if (binding instanceof IMethodBinding) {
View Full Code Here

   
    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

TOP

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

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.