public ChapterSymbol?LookupChapter(Spanned <string> identifier) { ChapterSymbol?chapter = _module.LookupChapter(identifier.Value); if (chapter is not null) { return(chapter); } ReportUnresolvedIdentifier(identifier); return(null); }
public ChapterSymbol?ResolveCallChapterTarget(CallChapterStatement callChapterStmt) { string modulePath = callChapterStmt.TargetModule.Value; try { SourceModuleSymbol targetSourceModule = _compilation.GetSourceModule(modulePath); ChapterSymbol? chapter = targetSourceModule.LookupChapter("main"); if (chapter is null) { Report(callChapterStmt.TargetModule, DiagnosticId.ChapterMainNotFound); } return(chapter); } catch (FileNotFoundException) { string moduleName = callChapterStmt.TargetModule.Value; Report(callChapterStmt.TargetModule, DiagnosticId.ExternalModuleNotFound, moduleName); return(null); } }