]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | pub fn get_array_index_from_id(_cx: *mut JSContext, id: HandleId) -> Option<u32> { |
2 | let raw_id = id.into(); | |
3 | unsafe { | |
4 | if RUST_JSID_IS_INT(raw_id) { | |
5 | return Some(RUST_JSID_TO_INT(raw_id) as u32); | |
6 | } | |
7 | None | |
8 | } | |
9 | // If `id` is length atom, `-1`, otherwise: | |
10 | /*return if JSID_IS_ATOM(id) { | |
11 | let atom = JSID_TO_ATOM(id); | |
12 | //let s = *GetAtomChars(id); | |
13 | if s > 'a' && s < 'z' { | |
14 | return -1; | |
15 | } | |
16 | ||
17 | let i = 0; | |
18 | let str = AtomToLinearString(JSID_TO_ATOM(id)); | |
19 | return if StringIsArray(str, &mut i) != 0 { i } else { -1 } | |
20 | } else { | |
21 | IdToInt32(cx, id); | |
22 | }*/ | |
23 | } | |
24 | ||
25 | impl Foo { | |
26 | fn bar() -> usize { | |
27 | 42 | |
28 | /* a block comment */ | |
29 | } | |
30 | ||
31 | fn baz() -> usize { | |
32 | 42 | |
33 | // this is a line | |
34 | /* a block comment */ | |
35 | } | |
36 | } |