Added executable entry-point via @main type.

When a type (class, enum, or struct) is annotated @main, it is required
to provide a function with the following signature:

  static func main() -> ()

That function will be called when the executable the type is defined
within is launched.
This commit is contained in:
Nate Chandler
2020-02-14 18:47:06 -08:00
parent 31f715dbda
commit df99de804d
41 changed files with 525 additions and 67 deletions

View File

@@ -4986,7 +4986,7 @@ void Serializer::writeAST(ModuleOrSourceFile DC) {
}
for (auto nextFile : files) {
if (nextFile->hasEntryPoint())
entryPointClassID = addDeclRef(nextFile->getMainClass());
entryPointClassID = addDeclRef(nextFile->getMainDecl());
// FIXME: Switch to a visitor interface?
SmallVector<Decl *, 32> fileDecls;