Skip to content

Commit

Permalink
again.
Browse files Browse the repository at this point in the history
  • Loading branch information
InsertCreativityHere committed Dec 4, 2024
1 parent 1553cf1 commit 7ebcae3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
36 changes: 10 additions & 26 deletions cpp/src/Slice/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,23 +1178,15 @@ Slice::Container::createClassDef(const string& name, int id, const ClassDefPtr&
}

ClassDefPtr def = make_shared<ClassDef>(shared_from_this(), name, id, base);
_unit->addContent(def);
_contents.push_back(def);

for (const auto& q : matches)
{
ClassDeclPtr decl = dynamic_pointer_cast<ClassDecl>(q);
decl->_definition = def;
}

//
// Implicitly create a class declaration for each class
// definition. This way the code generator can rely on always
// having a class declaration available for lookup.
//
// Implicitly create a class declaration for each class definition.
// This way the code generator can rely on always having a class declaration available for lookup.
ClassDeclPtr decl = createClassDecl(name);
def->_declaration = decl;
decl->_definition = def;

_unit->addContent(def);
_contents.push_back(def);
return def;
}

Expand Down Expand Up @@ -1330,23 +1322,15 @@ Slice::Container::createInterfaceDef(const string& name, const InterfaceList& ba
InterfaceDecl::checkBasesAreLegal(name, bases, _unit);

InterfaceDefPtr def = make_shared<InterfaceDef>(shared_from_this(), name, bases);
_unit->addContent(def);
_contents.push_back(def);

for (const auto& q : matches)
{
InterfaceDeclPtr decl = dynamic_pointer_cast<InterfaceDecl>(q);
decl->_definition = def;
}

//
// Implicitly create an interface declaration for each interface
// definition. This way the code generator can rely on always
// having an interface declaration available for lookup.
//
// Implicitly create an interface declaration for each interface definition.
// This way the code generator can rely on always having an interface declaration available for lookup.
InterfaceDeclPtr decl = createInterfaceDecl(name);
def->_declaration = decl;
decl->_definition = def;

_unit->addContent(def);
_contents.push_back(def);
return def;
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/test/Slice/errorDetection/InterfaceMismatch.err
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
InterfaceMismatch.ice:9: class `Foo1' was previously declared as an interface
InterfaceMismatch.ice:10: class `Foo1' was previously declared as an interface
InterfaceMismatch.ice:13: class `Foo2' was previously defined as an interface
InterfaceMismatch.ice:13: class `Foo2' was previously declared as an interface
InterfaceMismatch.ice:16: interface `Foo3' was previously declared as a class
InterfaceMismatch.ice:17: interface `Foo3' was previously declared as a class
InterfaceMismatch.ice:20: interface `Foo4' was previously defined as a class
InterfaceMismatch.ice:20: interface `Foo4' was previously declared as a class

0 comments on commit 7ebcae3

Please sign in to comment.