Skip to content

Commit

Permalink
Add intra-doc links for Class/Instance PhantomData.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonforal committed Oct 2, 2024
1 parent 1fef782 commit 7600490
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::marker::PhantomData;
#[derive(Debug)]
pub struct FileContext<T> {
v8_object: v8::Global<v8::Object>,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
// Individual language support:
pub ctx_go: Option<js::FileContextGo<Instance>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct FileContextGo<T> {
// Cached keys
s_alias_map: v8::Global<v8::String>,
s_is_cached: v8::Global<v8::String>,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ pub struct FileContextJavaScript<T> {
v8_object: v8::Global<v8::Object>,
// Cached keys
s_imports: v8::Global<v8::String>,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
}

/// A function representing the ES6 class `PackageImport`.
#[derive(Debug)]
pub struct JSPackageImport<T> {
class: v8::Global<v8::Function>,
/// (See documentation on [`Class`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ pub struct FileContextTerraform<T> {
v8_object: v8::Global<v8::Object>,
// Cached keys
s_resource_map: v8::Global<v8::String>,
/// (See documentation on [`Class`]).
_pd: PhantomData<T>,
}

/// A function representing the ES6 class `TerraformResource`.
#[derive(Debug)]
pub struct TerraformResource<T> {
class: v8::Global<v8::Function>,
/// (See documentation on [`Class`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct RootContext<T> {
s_ts_lang_ctx: v8::Global<v8::String>,
s_filename: v8::Global<v8::String>,
s_file_contents: v8::Global<v8::String>,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct RuleContext<T> {
v8_object: v8::Global<v8::Object>,
// Cached keys
s_arguments: v8::Global<v8::String>,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct TsLanguageContext<T> {
// Cached keys
s_node_type: v8::Global<v8::String>,
s_field: v8::Global<v8::String>,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::marker::PhantomData;
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct Edit<T> {
pub kind: EditKind,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use crate::analysis;
use crate::analysis::ddsa_lib::common::{
load_function, v8_interned, Class, DDSAJsRuntimeError, NodeId, StellaCompat,
load_function, v8_interned, Class, DDSAJsRuntimeError, Instance, NodeId, StellaCompat,
};
use crate::analysis::ddsa_lib::js::capture::{MultiCaptureTemplate, SingleCaptureTemplate};
use crate::analysis::ddsa_lib::js::TreeSitterNodeFn;
Expand All @@ -21,6 +21,7 @@ pub struct QueryMatch<T> {
class: v8::Global<v8::Function>,
single_capture: SingleCaptureTemplate,
multi_capture: MultiCaptureTemplate,
/// (See documentation on [`Class`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub struct QueryMatchCompat<T> {
class: v8::Global<v8::Function>,
/// The `QueryMatch` class. An instance of this is used as a JavaScript `Proxy` target.
proxied: QueryMatch<T>,
_pd: PhantomData<T>,
}

impl QueryMatchCompat<Class> {
Expand All @@ -50,11 +49,7 @@ impl QueryMatchCompat<Class> {
pub fn try_new(scope: &mut HandleScope) -> Result<Self, DDSAJsRuntimeError> {
let class = load_function(scope, Self::CLASS_NAME)?;
let proxied = QueryMatch::<Class>::try_new(scope)?;
Ok(Self {
class,
proxied,
_pd: PhantomData,
})
Ok(Self { class, proxied })
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct CodeRegion<T> {
pub start_col: u32,
pub end_line: u32,
pub end_col: u32,
/// (See documentation on [`Instance`]).
pub _pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::marker::PhantomData;
#[derive(Debug)]
pub struct VisitArgFilenameCompat<T> {
v8_object: v8::Global<v8::Object>,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct TreeSitterNode<T> {
end_col: u32,
/// The type of node this is. This corresponds to [`tree_sitter::Node::kind_id`].
node_type_id: u16,
/// (See documentation on [`Instance`]).
_pd: PhantomData<T>,
}

Expand Down Expand Up @@ -51,7 +52,11 @@ impl<T> TreeSitterNode<T> {

/// A function representing the ES6 class `TreeSitterNode`.
#[derive(Debug)]
pub struct TreeSitterNodeFn<T>(v8::Global<v8::Function>, PhantomData<T>);
pub struct TreeSitterNodeFn<T>(
v8::Global<v8::Function>,
/// (See documentation on [`Class`]).
PhantomData<T>,
);

impl TreeSitterNodeFn<Class> {
pub const CLASS_NAME: &'static str = "TreeSitterNode";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub struct Violation<T> {
pub fixes: Option<Vec<Fix<T>>>,
pub base_region: CodeRegion<T>,
pub taint_flow_regions: Option<Vec<CodeRegion<T>>>,
/// (See documentation on [`Instance`]).
pub _pd: PhantomData<T>,
}

Expand Down

0 comments on commit 7600490

Please sign in to comment.