Beispiel #1
0
  public Macro newMacro(PMacro pDeclaration) {

    if (pDeclaration == null) {
      throw new InternalException("pDeclaration may not be null");
    }

    if (pDeclaration.parent() instanceof AMacroSourceFilePart) {
      throw new InternalException("pDeclaration may not be a top-level macro");
    }

    Macro macro = getGlobalIndex().newMacro(pDeclaration, this);

    this.macroMap.put(macro.getName(), macro);
    this.macros.add(macro);

    return macro;
  }
Beispiel #2
0
  public Expand getExpand(PExpand declaration) {

    if (declaration == null) {
      throw new InternalException("declaration may not be null");
    }

    Expand expand = getGlobalIndex().getExpand(declaration, this);

    if (expand.getEnclosingMacro() != this) {
      throw new InternalError("getExpand must be called on its enclosing macro");
    }

    ExpandSignature signature = expand.getSignature();
    this.expandSignatures.add(signature);

    for (Macro macro : signature.getMacroSet()) {
      this.explicitlyExpandedMacros.add(macro);
      macro.addCaller(this);
    }

    return expand;
  }