This repository has been archived by the owner on Dec 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathTrivia.hack
71 lines (61 loc) · 1.49 KB
/
Trivia.hack
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
namespace Facebook\HHAST;
use namespace HH\Lib\Str;
/* HHAST_IGNORE_ALL[5624] */
abstract class Trivia extends Node {
private string $_text;
<<__Override>>
public function __construct(string $text, ?__Private\SourceRef $ref) {
$this->_text = $text;
parent::__construct($ref);
}
public function getText(): string {
return $this->_text;
}
<<__Override>>
protected function getCodeUncached(): string {
return $this->_text;
}
<<__Override>>
public function getWidth(): int {
return Str\length($this->_text);
}
<<__Override>>
final public function isTrivia(): bool {
return true;
}
<<__Override>>
public function getChildren(): dict<string, Node> {
return dict[];
}
<<__Override>>
public static function fromJSON(
dict<arraykey, mixed> $json,
string $file,
int $offset,
string $source,
string $_type_hint,
): Trivia {
return __Private\trivia_from_json($json, shape(
'file' => $file,
'source' => $source,
'offset' => $offset,
'width' => $json['width'] as int,
));
}
<<__Override>>
final public function rewriteChildren<Tret as ?Node>(
(function(Node, vec<Node>): Tret) $_rewriter,
vec<Node> $_parents = vec[],
): this {
// Trivia have no children
return $this;
}
}