Skip to content

Commit bc85744

Browse files
docs: Fix links and various other minor issues with the documentation (#908)
1 parent 2c0bbd7 commit bc85744

File tree

11 files changed

+23
-16
lines changed

11 files changed

+23
-16
lines changed

nova_lint/src/no_it_performs_the_following.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ use rustc_span::{BytePos, Span};
1010
dylint_linting::declare_early_lint! {
1111
/// ### What it does
1212
///
13-
/// This lint disallows doc comments that contain the phrase "It performs the following steps when called".
13+
/// This lint disallows doc comments that contain the phrase
14+
/// "It performs the following steps when called", or any variation of it
15+
/// like: "This method performs the following steps when called".
1416
///
1517
/// ### Why is this bad?
1618
///
17-
/// This phrase is a leftover from copy-pasting the TC-39 specification and does not add value to the documentation.
19+
/// This phrase is a leftover from copy-pasting the TC-39 specification and
20+
/// does not add value to the documentation.
1821
///
1922
/// ### Example
2023
///
@@ -47,9 +50,12 @@ dylint_linting::declare_early_lint! {
4750
}
4851

4952
impl EarlyLintPass for NoItPerformsTheFollowing {
53+
// TODO: This should check for multiline comments too, probably using the
54+
// `check_attributes` method instead because each doc comment line is it's
55+
// own attribute.
5056
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) {
5157
static RE: LazyLock<Regex> = LazyLock::new(|| {
52-
RegexBuilder::new(r"It performs the following steps when called:?")
58+
RegexBuilder::new(r"(This method|It) performs the following steps when called:?")
5359
.case_insensitive(true)
5460
.build()
5561
.unwrap()

nova_vm/src/ecmascript/abstract_operations/operations_on_objects.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ pub(crate) fn construct<'a>(
12471247
.internal_construct(agent, arguments_list, new_target.unbind(), gc)
12481248
}
12491249

1250-
/// ### [7.3.20 Invoke ( V, P \[ , argumentsList \] )]()
1250+
/// ### [7.3.20 Invoke ( V, P \[ , argumentsList \] )](https://tc39.es/ecma262/#sec-invoke)
12511251
///
12521252
/// The abstract operation Invoke takes arguments V (an ECMAScript language
12531253
/// value) and P (a property key) and optional argument argumentsList (a List

nova_vm/src/ecmascript/builtins/control_abstraction_objects/promise_objects/promise_abstract_operations/promise_capability_records.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

5-
//! ## [27.2.1.1 PromiseCapability Records]()
5+
//! ### [27.2.1.1 PromiseCapability Records](https://tc39.es/ecma262/#sec-promisecapability-records)
66
77
use crate::{
88
ecmascript::{
@@ -49,6 +49,7 @@ pub struct PromiseCapability<'a> {
4949

5050
impl<'a> PromiseCapability<'a> {
5151
///### [27.2.1.5 NewPromiseCapability ( C )](https://tc39.es/ecma262/#sec-newpromisecapability)
52+
///
5253
/// NOTE: Our implementation doesn't take C as a parameter, since we don't
5354
/// yet support promise subclassing.
5455
pub fn new(agent: &mut Agent, gc: NoGcScope<'a, '_>) -> Self {

nova_vm/src/ecmascript/builtins/control_abstraction_objects/promise_objects/promise_abstract_operations/promise_resolving_functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(crate) enum PromiseResolvingFunctionType {
2929
Reject,
3030
}
3131

32-
/// ### [27.2.1.3.1 Promise Reject Functions]()
32+
/// ### [27.2.1.3.1 Promise Reject Functions](https://tc39.es/ecma262/#sec-promise-reject-functions)
3333
///
3434
/// A promise reject function is an anonymous built-in function that has
3535
/// \[\[Promise\]\] and \[\[AlreadyResolved\]\] internal slots.

nova_vm/src/ecmascript/builtins/indexed_collections/array_objects/array_prototype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ impl ArrayPrototype {
12291229
Ok(Number::try_from(find_rec.0).unwrap().into_value())
12301230
}
12311231

1232-
/// ### [23.1.3.13 Array.prototype.flat ( \[ depth \] )]()
1232+
/// ### [23.1.3.13 Array.prototype.flat ( \[ depth \] )](https://tc39.es/ecma262/#sec-array.prototype.flat)
12331233
fn flat<'gc>(
12341234
agent: &mut Agent,
12351235
this_value: Value,

nova_vm/src/ecmascript/builtins/keyed_collections/weak_map_objects/weak_map_constructor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl BuiltinIntrinsicConstructor for WeakMapConstructor {
3636
}
3737

3838
impl WeakMapConstructor {
39-
/// ### [24.3.1.1 WeakMap ( \[ iterable \] )]()
39+
/// ### [24.3.1.1 WeakMap ( \[ iterable \] )](https://tc39.es/ecma262/#sec-weakmap-iterable)
4040
///
4141
/// > NOTE: If the parameter _iterable_ is present, it is expected to be an
4242
/// > object that implements a %Symbol.iterator% method that returns an

nova_vm/src/ecmascript/builtins/managing_memory/weak_ref_objects/weak_ref_prototype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl Builtin for WeakRefPrototypeDeref {
2323
}
2424

2525
impl WeakRefPrototype {
26-
/// ### [26.1.3.2 WeakRef.prototype.deref ( )]()
26+
/// ### [26.1.3.2 WeakRef.prototype.deref ( )](https://tc39.es/ecma262/#sec-weak-ref.prototype.deref)
2727
fn deref<'gc>(
2828
agent: &mut Agent,
2929
this_value: Value,

nova_vm/src/ecmascript/builtins/regexp/abstract_operations.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use crate::{
4343

4444
use super::{RegExp, RegExpHeapData, data::RegExpLastIndex};
4545

46-
/// ### [22.2.3.1 RegExpCreate ( P, F )]()
46+
/// ### [22.2.3.1 RegExpCreate ( P, F )](https://tc39.es/ecma262/#sec-regexpcreate)
4747
///
4848
/// The abstract operation RegExpCreate takes arguments P (an ECMAScript
4949
/// language value) and F (a String or undefined) and returns either a normal
@@ -63,7 +63,7 @@ pub(crate) fn reg_exp_create<'a>(
6363
reg_exp_initialize(agent, obj.unbind(), p, f, gc)
6464
}
6565

66-
/// ### [22.2.3.1 RegExpCreate ( P, F )]()
66+
/// ### [22.2.3.1 RegExpCreate ( P, F )](https://tc39.es/ecma262/#sec-regexpcreate)
6767
///
6868
/// The abstract operation RegExpCreate takes arguments P (an ECMAScript
6969
/// language value) and F (a String or undefined) and returns either a normal
@@ -83,7 +83,7 @@ pub(crate) fn reg_exp_create_literal<'a>(
8383
agent.heap.create(RegExpHeapData::new(agent, p, f)).bind(gc)
8484
}
8585

86-
/// ### [22.2.3.2 RegExpAlloc ( newTarget )]()
86+
/// ### [22.2.3.2 RegExpAlloc ( newTarget )](https://tc39.es/ecma262/#sec-regexpalloc)
8787
///
8888
/// The abstract operation RegExpAlloc takes argument newTarget (a constructor)
8989
/// and returns either a normal completion containing an Object or a throw
@@ -106,7 +106,7 @@ pub(crate) fn reg_exp_alloc<'a>(
106106
Ok(obj)
107107
}
108108

109-
/// ### [22.2.3.3 RegExpInitialize ( obj, pattern, flags )]()
109+
/// ### [22.2.3.3 RegExpInitialize ( obj, pattern, flags )](https://tc39.es/ecma262/#sec-regexpinitialize)
110110
///
111111
/// The abstract operation RegExpInitialize takes arguments obj (an Object),
112112
/// pattern (an ECMAScript language value), and flags (an ECMAScript language

nova_vm/src/ecmascript/builtins/text_processing/regexp_objects/regexp_constructor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl RegExpConstructor {
180180
reg_exp_initialize(agent, o.unbind(), p, f, gc).map(|o| o.into_value())
181181
}
182182

183-
/// ### [22.2.5.1 RegExp.escape ( S )]()
183+
/// ### [22.2.5.1 RegExp.escape ( S )](https://tc39.es/ecma262/#sec-regexp.escape)
184184
///
185185
/// This function returns a copy of S in which characters that are
186186
/// potentially special in a regular expression Pattern have been replaced

nova_vm/src/ecmascript/builtins/text_processing/string_objects/string_prototype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ impl StringPrototype {
10221022
Ok(Value::Boolean(s.as_str(agent).is_some()))
10231023
}
10241024

1025-
/// ### [22.1.3.11 String.prototype.lastIndexOf ( searchString \[ , position \] )]()
1025+
/// ### [22.1.3.11 String.prototype.lastIndexOf ( searchString \[ , position \] )](https://tc39.es/ecma262/#sec-string.prototype.lastindexof)
10261026
///
10271027
/// > NOTE 1: If _searchString_ appears as a substring of the result of
10281028
/// > converting this object to a String at one or more indices that are

0 commit comments

Comments
 (0)