Package dtool.ast.definitions

Examples of dtool.ast.definitions.DefUnit$ProtoDefSymbol


 
  public static void removeDefUnitByMarker(Collection<INamedElement> resolvedDefUnits, MetadataEntry marker) {
    for (Iterator<INamedElement> iterator = resolvedDefUnits.iterator(); iterator.hasNext(); ) {
      INamedElement element = iterator.next();
      if(element instanceof DefUnit) {
        DefUnit defNode = (DefUnit) element;
        if(defNode.defname.getEndPos() == marker.offset || defNode.defname.getStartPos() == marker.offset) {
          iterator.remove();
          return;
        }
      }
View Full Code Here


  public void precheckOriginalResults(Collection<INamedElement> resultElementsOriginal) {
    for (INamedElement elem : resultElementsOriginal) {
      elem.getExtendedName();
      elem.getModuleFullyQualifiedName();
      if(elem instanceof DefUnit) {
        DefUnit defUnit = (DefUnit) elem;
        defUnit.getModuleNode();
      }
    }
  }
View Full Code Here

public class MiscNodeUtils {

  public static DefUnit getDefUniFromScope(IASTNode[] children, String defUnitName) {
    for (IASTNode node : children) {
      if(node instanceof DefUnit) {
        DefUnit defUnit = (DefUnit) node;
        if(defUnit.getName().equals(defUnitName)) {
          return defUnit;
        }
      }
    }
    return null;
View Full Code Here

    ASTNodeSearcher<DefUnit> searcher = new ASTNodeSearcher<DefUnit>() {
     
      @Override
      public boolean doPreVisit(ASTNode node) {
        if(node instanceof DefUnit) {
          DefUnit defUnit = (DefUnit) node;
          if(defUnit.getName().equals(defName)) {
            match = defUnit;
            return continueSearch = false;
          }
        }
       
View Full Code Here

      return namedElement.getFullyQualifiedName();
    default:
      break;
    }
   
    DefUnit defUnit = tryCast(namedElement, DefUnit.class);
    if(defUnit == null) {
      return namedElement.getFullyQualifiedName();
    }
   
    ASTCodePrinter cp = new ASTCodePrinter();
   
    switch (defUnit.getNodeType()) {
    case DEFINITION_VARIABLE: {
      DefinitionVariable var = (DefinitionVariable) defUnit;
     
      return typeRefToUIString(var.type) + " " + var.getName();
    }
    case DEFINITION_VAR_FRAGMENT: {
      DefVarFragment fragment = (DefVarFragment) defUnit;
     
      return typeRefToUIString(fragment.getDeclaredType()) + " " + fragment.getName();
    }
   
    case DEFINITION_FUNCTION: {
      DefinitionFunction function = (DefinitionFunction) defUnit;
      cp.appendStrings(typeRefToUIString(function.retType), " ");
      cp.append(function.getName());
      cp.appendList("(", function.tplParams, ", ", ") ");
      cp.appendList("(", function.getParams_asNodes(), ", ", ") ");
      return cp.toString();
    }
   
    default: break;
    }
   
    if(defUnit instanceof DefinitionAggregate) {
      DefinitionAggregate defAggr = (DefinitionAggregate) defUnit;
      cp.append(defAggr.getName());
      cp.appendList("(", defAggr.tplParams, ",", ") ");
      return cp.toString();
    }
   
    // Default hover signature:
    return defUnit.getName();
  }
View Full Code Here

    if(node instanceof INonScopedContainer) {
      INonScopedContainer container = ((INonScopedContainer) node);
      findDefUnits(search, container.getMembersIterator(), isSequentialLookup, importsOnly);
    }
    if(!importsOnly && node instanceof DefUnit) {
      DefUnit defunit = (DefUnit) node;
      evaluateDefUnitForSearch(search, defunit);
    }
    else if(importsOnly && node instanceof DeclarationImport) {
      DeclarationImport declImport = (DeclarationImport) node;
     
View Full Code Here

    MetadataEntry targetMDE = removeTestMetadata("DDOC_TEST_TARGET");
    if(targetMDE == null) {
      return;
    }
   
    DefUnit defUnit = findDDocTargetDefUnit(result, targetMDE);
    assertNotNull(defUnit);
    List<MetadataEntry> ddocTestEntries = removeTestMetadataEntries("DDOC_TEST");
   
    ArrayList<Token> commentsToCheck = defUnit.getDocComments() == null ? new ArrayList<Token>() :
      new ArrayList<>(Arrays.asList(defUnit.getDocComments()));
   
   
    Token[] comments = defUnit.getDocComments();
    CommonDefinition commonDefinition = defUnit instanceof CommonDefinition ? (CommonDefinition) defUnit : null;
   
    if(comments != null && comments.length > 0 && !(defUnit instanceof Module) && commonDefinition != null) {
      int extendedStartPos = commonDefinition.getExtendedStartPos();
      int extendedEndPos = commonDefinition.getExtendedEndPos();
View Full Code Here

    if(targetMDEOverride != null) {
      targetMDE = targetMDEOverride;
    }
   
    String defUnitName = targetMDE.sourceValue.trim();
    DefUnit targetDefUnit = null;
   
    for (ASTNode child : result.node.getChildren()) {
      DefUnit defUnit = getDefunitFromExtendedDefinition(child);
      if(defUnit != null) {
        if(defUnit.defname.name.equals(defUnitName)) {
          assertTrue(targetDefUnit == null); // check that there is only one defunit with that name
          targetDefUnit = defUnit;
        }
View Full Code Here

  }
 
  // TODO: refactor this code maybe?
  public static void evaluateNamedElementForSearch(CommonDefUnitSearch search, INamedElement namedElement) {
    if(namedElement instanceof DefUnit) {
      DefUnit defUnit = (DefUnit) namedElement;
      evaluateDefUnitForSearch(search, defUnit);
    } else {
      if(namedElement != null && search.matches(namedElement)) {
        search.addMatch(namedElement);
      }
View Full Code Here

  }
 
  @Override
  public void resolveSearchInScope(CommonDefUnitSearch search) {
    if(containedElement.getArcheType() == EArcheType.Module) {
      DefUnit resolvedDefUnit = containedElement.resolveDefUnit();
      if(resolvedDefUnit == null) {
        // Note that we dont use resolvedDefUnit for evaluateNodeForSearch,
        // this means modules with mismatched names will match again the import name (file name),
        // instead of the module declaration name
        return;
View Full Code Here

TOP

Related Classes of dtool.ast.definitions.DefUnit$ProtoDefSymbol

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.