Introduce Name Binding as a Frontend Action

Introduces the -name-bind frontend action that is intended as an intermediary between the parse-only actions and a full typechecking pass.  In this phase, module imports will be validated and resolved, making it possible to emit full make-style dependencies files among other things.

Note that all information available to a parse-only pass is available to name binding, but because it does not continue-on to typecheck input files, full semantic information is not.
This commit is contained in:
Robert Widmann
2018-06-29 15:49:54 -07:00
parent c440b0ba5a
commit cb1e9dd821
8 changed files with 89 additions and 29 deletions

View File

@@ -31,6 +31,7 @@ bool FrontendOptions::needsProperModuleName(ActionType action) {
switch (action) {
case ActionType::NoneAction:
case ActionType::Parse:
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::DumpParse:
case ActionType::DumpAST:
@@ -65,6 +66,7 @@ bool FrontendOptions::isActionImmediate(ActionType action) {
switch (action) {
case ActionType::NoneAction:
case ActionType::Parse:
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::DumpParse:
case ActionType::DumpAST:
@@ -134,6 +136,7 @@ FrontendOptions::suffixForPrincipalOutputFileForAction(ActionType action) {
return StringRef();
case ActionType::Parse:
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::DumpParse:
case ActionType::DumpInterfaceHash:
@@ -195,6 +198,7 @@ bool FrontendOptions::canActionEmitDependencies(ActionType action) {
case ActionType::Immediate:
case ActionType::REPL:
return false;
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::MergeModules:
case ActionType::EmitModuleOnly:
@@ -216,6 +220,7 @@ bool FrontendOptions::canActionEmitReferenceDependencies(ActionType action) {
switch (action) {
case ActionType::NoneAction:
case ActionType::Parse:
case ActionType::NameBind:
case ActionType::DumpParse:
case ActionType::DumpInterfaceHash:
case ActionType::DumpAST:
@@ -258,6 +263,7 @@ bool FrontendOptions::canActionEmitObjCHeader(ActionType action) {
case ActionType::REPL:
return false;
case ActionType::Parse:
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::MergeModules:
case ActionType::EmitModuleOnly:
@@ -288,6 +294,7 @@ bool FrontendOptions::canActionEmitLoadedModuleTrace(ActionType action) {
case ActionType::Immediate:
case ActionType::REPL:
return false;
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::MergeModules:
case ActionType::EmitModuleOnly:
@@ -309,6 +316,7 @@ bool FrontendOptions::canActionEmitModule(ActionType action) {
switch (action) {
case ActionType::NoneAction:
case ActionType::Parse:
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::DumpParse:
case ActionType::DumpInterfaceHash:
@@ -343,6 +351,7 @@ bool FrontendOptions::canActionEmitModuleDoc(ActionType action) {
bool FrontendOptions::doesActionProduceOutput(ActionType action) {
switch (action) {
case ActionType::Parse:
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::DumpParse:
case ActionType::DumpAST:
@@ -388,6 +397,7 @@ bool FrontendOptions::doesActionProduceTextualOutput(ActionType action) {
return false;
case ActionType::Parse:
case ActionType::NameBind:
case ActionType::Typecheck:
case ActionType::DumpParse:
case ActionType::DumpInterfaceHash: