This commit is contained in:
Zihan Chen
2017-06-24 01:12:10 -07:00
parent 38b95ec22a
commit d031334b83
8 changed files with 69 additions and 26 deletions
+15 -2
View File
@@ -463,8 +463,11 @@ WfLexicalScopeManager
baseConstructorCallResolvings.Clear();
}
void WfLexicalScopeManager::Rebuild(bool keepTypeDescriptorNames)
#define CALLBACK(EXPR) if (callback) callback->EXPR
void WfLexicalScopeManager::Rebuild(bool keepTypeDescriptorNames, IWfCompilerCallback* callback)
{
CALLBACK(OnLoadEnvironment());
Clear(keepTypeDescriptorNames, false);
if (!globalName)
{
@@ -472,6 +475,7 @@ WfLexicalScopeManager
BuildGlobalNameFromTypeDescriptors(this);
}
CALLBACK(OnInitialize(this));
vint errorCount = errors.Count();
#define EXIT_IF_ERRORS_EXIST\
@@ -507,12 +511,15 @@ WfLexicalScopeManager
EXIT_IF_ERRORS_EXIST;
FOREACH(Ptr<WfModule>, module, modules)
{
CALLBACK(OnValidateModule(module));
ValidateModuleSemantic(this, module);
}
#undef EXIT_IF_ERRORS_EXIST
}
#undef CALLBACK
bool WfLexicalScopeManager::ResolveMember(ITypeDescriptor* typeDescriptor, const WString& name, bool preferStatic, collections::SortedList<ITypeDescriptor*>& searchedTypes, collections::List<ResolveExpressionResult>& results)
{
if (searchedTypes.Contains(typeDescriptor))
@@ -20661,8 +20668,11 @@ GenerateTypeCastInstructions
GenerateAssembly
***********************************************************************/
Ptr<runtime::WfAssembly> GenerateAssembly(analyzer::WfLexicalScopeManager* manager)
#define CALLBACK(EXPR) if (callback) callback->EXPR
Ptr<runtime::WfAssembly> GenerateAssembly(analyzer::WfLexicalScopeManager* manager, IWfCompilerCallback* callback)
{
CALLBACK(OnGenerateMetadata());
auto assembly = MakePtr<WfAssembly>();
assembly->insBeforeCodegen = new WfInstructionDebugInfo;
assembly->insAfterCodegen = new WfInstructionDebugInfo;
@@ -20757,16 +20767,19 @@ GenerateAssembly
FOREACH(Ptr<WfModule>, module, manager->GetModules())
{
CALLBACK(OnGenerateCode(module));
FOREACH(Ptr<WfDeclaration>, decl, module->declarations)
{
GenerateDeclarationInstructions(context, decl);
}
}
CALLBACK(OnGenerateDebugInfo());
assembly->Initialize();
return assembly;
}
#undef CALLBACK
#undef INSTRUCTION
/***********************************************************************