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

@@ -2974,9 +2974,9 @@ bool SerializedASTFile::getAllGenericSignatures(
return true;
}
ClassDecl *SerializedASTFile::getMainClass() const {
Decl *SerializedASTFile::getMainDecl() const {
assert(hasEntryPoint());
return cast_or_null<ClassDecl>(File.getDecl(File.Bits.EntryPointDeclID));
return File.getDecl(File.Bits.EntryPointDeclID);
}
const version::Version &SerializedASTFile::getLanguageVersionBuiltWith() const {