Beispiel #1
0
        private static Program ParseModuleContent(ModuleData module)
        {
            var parser = new JavaScriptParser(module.Content, new ParserOptions {
                Loc = true, Range = true, SourceType = SourceType.Module, Tolerant = true
            });

            try { return(parser.ParseProgram()); }
            catch (Exception ex) { throw EcmaScriptErrorHelper.ParsingModuleFileFailed(module.FilePath, GetFileProviderHint(module.File), ex); }
        }
Beispiel #2
0
 private async Task LoadModuleContent(ModuleData module)
 {
     try
     {
         using (Stream stream = module.File.GetFileInfo().CreateReadStream())
             using (var reader = new StreamReader(stream))
                 module.Content = await reader.ReadToEndAsync().ConfigureAwait(false);
     }
     catch (Exception ex) { throw EcmaScriptErrorHelper.ReadingModuleFileFailed(module.FilePath, GetFileProviderHint(module.File), ex); }
 }