Exemple #1
0
static void insertPrecedenceGroupDecl(NameBinder &binder, SourceFile &SF,
                                      PrecedenceGroupDecl *group) {
  auto previousDecl = SF.PrecedenceGroups.find(group->getName());
  if (previousDecl != SF.PrecedenceGroups.end()) {
    binder.diagnose(group->getLoc(), diag::precedence_group_redeclared);
    binder.diagnose(previousDecl->second.getPointer(),
                    diag::previous_precedence_group_decl);
    return;
  }

  // FIXME: The second argument indicates whether the given precedence
  // group is visible outside the current file.
  SF.PrecedenceGroups[group->getName()] = { group, true };  
}
Exemple #2
0
static void insertOperatorDecl(NameBinder &Binder,
                               SourceFile::OperatorMap<OP_DECL*> &Operators,
                               OP_DECL *OpDecl) {
    auto previousDecl = Operators.find(OpDecl->getName());
    if (previousDecl != Operators.end()) {
        Binder.diagnose(OpDecl->getLoc(), diag::operator_redeclared);
        Binder.diagnose(previousDecl->second.getPointer(),
                        diag::previous_operator_decl);
        return;
    }

    // FIXME: The second argument indicates whether the given operator is visible
    // outside the current file.
    Operators[OpDecl->getName()] = { OpDecl, true };
}