Skip to content

Commit

Permalink
drop permissions prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed May 10, 2020
1 parent c232df9 commit ad9ad41
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
20 changes: 10 additions & 10 deletions cli/file_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::http_util::create_http_client;
use crate::http_util::FetchOnceResult;
use crate::msg;
use crate::op_error::OpError;
use crate::permissions::DenoPermissions;
use crate::permissions::Permissions;
use deno_core::ErrBox;
use deno_core::ModuleSpecifier;
use futures::future::FutureExt;
Expand Down Expand Up @@ -110,7 +110,7 @@ impl SourceFileFetcher {
pub fn fetch_cached_source_file(
&self,
specifier: &ModuleSpecifier,
_permissions: DenoPermissions,
_permissions: Permissions,
) -> Option<SourceFile> {
let maybe_source_file = self.source_file_cache.get(specifier.to_string());

Expand Down Expand Up @@ -150,7 +150,7 @@ impl SourceFileFetcher {
&self,
specifier: &ModuleSpecifier,
maybe_referrer: Option<ModuleSpecifier>,
_permissions: DenoPermissions,
_permissions: Permissions,
) -> Result<SourceFile, ErrBox> {
let module_url = specifier.as_url().to_owned();
debug!("fetch_source_file specifier: {} ", &module_url);
Expand Down Expand Up @@ -934,7 +934,7 @@ mod tests {

// first download
let r = fetcher
.fetch_source_file(&specifier, None, DenoPermissions::default())
.fetch_source_file(&specifier, None, Permissions::default())
.await;
assert!(r.is_ok());

Expand All @@ -952,7 +952,7 @@ mod tests {
// header file creation timestamp (should be the same as after first
// download)
let r = fetcher
.fetch_source_file(&specifier, None, DenoPermissions::default())
.fetch_source_file(&specifier, None, Permissions::default())
.await;
assert!(r.is_ok());

Expand Down Expand Up @@ -1336,7 +1336,7 @@ mod tests {
let specifier =
ModuleSpecifier::resolve_url(file_url!("/baddir/hello.ts")).unwrap();
let r = fetcher
.fetch_source_file(&specifier, None, DenoPermissions::default())
.fetch_source_file(&specifier, None, Permissions::default())
.await;
assert!(r.is_err());

Expand All @@ -1345,7 +1345,7 @@ mod tests {
let specifier =
ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap()).unwrap();
let r = fetcher
.fetch_source_file(&specifier, None, DenoPermissions::default())
.fetch_source_file(&specifier, None, Permissions::default())
.await;
assert!(r.is_ok());
}
Expand All @@ -1359,7 +1359,7 @@ mod tests {
let specifier =
ModuleSpecifier::resolve_url(file_url!("/baddir/hello.ts")).unwrap();
let r = fetcher
.fetch_source_file(&specifier, None, DenoPermissions::default())
.fetch_source_file(&specifier, None, Permissions::default())
.await;
assert!(r.is_err());

Expand All @@ -1368,7 +1368,7 @@ mod tests {
let specifier =
ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap()).unwrap();
let r = fetcher
.fetch_source_file(&specifier, None, DenoPermissions::default())
.fetch_source_file(&specifier, None, Permissions::default())
.await;
assert!(r.is_ok());
}
Expand All @@ -1383,7 +1383,7 @@ mod tests {
let specifier =
ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap()).unwrap();
let r = fetcher
.fetch_source_file(&specifier, None, DenoPermissions::default())
.fetch_source_file(&specifier, None, Permissions::default())
.await;
assert!(r.is_ok());
}
Expand Down
2 changes: 1 addition & 1 deletion cli/global_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl GlobalState {

// TODO(bartlomieju): currently unused, but file fetcher will
// require them in the near future
let permissions = DenoPermissions::default();
let permissions = Permissions::default();

let out = self
.file_fetcher
Expand Down
6 changes: 3 additions & 3 deletions cli/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ use crate::global_state::GlobalState;
use crate::msg::MediaType;
use crate::op_error::OpError;
use crate::ops::io::get_stdio;
use crate::permissions::DenoPermissions;
use crate::permissions::Permissions;
use crate::state::DebugType;
use crate::state::State;
use crate::tsc::TargetLib;
Expand Down Expand Up @@ -188,7 +188,7 @@ async fn print_file_info(

let out = global_state
.file_fetcher
.fetch_source_file(&module_specifier, None, DenoPermissions::default())
.fetch_source_file(&module_specifier, None, Permissions::default())
.await?;

println!(
Expand Down Expand Up @@ -409,7 +409,7 @@ async fn doc_command(

async move {
let source_file = fetcher
.fetch_source_file(&specifier, None, DenoPermissions::default())
.fetch_source_file(&specifier, None, Permissions::default())
.await?;
String::from_utf8(source_file.source_code)
.map_err(|_| OpError::other("failed to parse".to_string()))
Expand Down
4 changes: 2 additions & 2 deletions cli/ops/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::dispatch_json::JsonOp;
use super::dispatch_json::Value;
use crate::futures::future::try_join_all;
use crate::op_error::OpError;
use crate::permissions::DenoPermissions;
use crate::permissions::Permissions;
use crate::state::State;
use deno_core::CoreIsolate;
use deno_core::ModuleLoader;
Expand Down Expand Up @@ -72,7 +72,7 @@ fn op_fetch_source_files(

// TODO(bartlomieju): currently unused, but file fetcher will
// require them in the near future
let permissions = DenoPermissions::default();
let permissions = Permissions::default();
let perms_ = permissions.clone();
let global_state = state.borrow().global_state.clone();
let file_fetcher = global_state.file_fetcher.clone();
Expand Down
11 changes: 5 additions & 6 deletions cli/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ use crate::global_state::GlobalState;
use crate::msg;
use crate::op_error::OpError;
use crate::ops;
use crate::ops::JsonResult;
use crate::permissions::DenoPermissions;
use crate::permissions::Permissions;
use crate::source_maps::SourceMapGetter;
use crate::startup_data;
use crate::state::State;
Expand Down Expand Up @@ -599,7 +598,7 @@ impl TsCompiler {
) -> std::io::Result<()> {
let source_file = self
.file_fetcher
.fetch_cached_source_file(&module_specifier, DenoPermissions::default())
.fetch_cached_source_file(&module_specifier, Permissions::default())
.expect("Source file not found");

// NOTE: JavaScript files are only cached to disk if `checkJs`
Expand All @@ -616,7 +615,7 @@ impl TsCompiler {
self.mark_compiled(module_specifier.as_url());
let source_file = self
.file_fetcher
.fetch_cached_source_file(&module_specifier, DenoPermissions::default())
.fetch_cached_source_file(&module_specifier, Permissions::default())
.expect("Source file not found");

let version_hash = source_code_version_hash(
Expand Down Expand Up @@ -671,7 +670,7 @@ impl TsCompiler {
) -> std::io::Result<()> {
let source_file = self
.file_fetcher
.fetch_cached_source_file(&module_specifier)
.fetch_cached_source_file(&module_specifier, Permissions::default())
.expect("Source file not found");

// NOTE: JavaScript files are only cached to disk if `checkJs`
Expand Down Expand Up @@ -726,7 +725,7 @@ impl TsCompiler {
if let Some(module_specifier) = self.try_to_resolve(script_name) {
return self.file_fetcher.fetch_cached_source_file(
&module_specifier,
DenoPermissions::default(),
Permissions::default(),
);
}

Expand Down

0 comments on commit ad9ad41

Please sign in to comment.