This repository was archived by the owner on Apr 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathv8.d.ts
318 lines (295 loc) · 10.5 KB
/
v8.d.ts
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// TODO: Determine if the use of snake case should be allowed in this file.
// tslint:disable:variable-name
// See https://github.com/v8/v8/blob/master/src/debug/mirrors.js
export declare type MirrorType = 'undefined' | 'null' | 'boolean' | 'number' |
'string' | 'symbol' | 'object' | 'function' | 'regexp' | 'error' |
'property' | 'internalProperty' | 'frame' | 'script' | 'context' | 'scope' |
'promise' | 'map' | 'set' | 'iterator' | 'generator';
export interface Mirror {
type: () => MirrorType;
isValue: () => boolean;
isUndefined: () => boolean;
isNull: () => boolean;
isBoolean: () => boolean;
isNumber: () => boolean;
isString: () => boolean;
isSymbol: () => boolean;
isObject: () => boolean;
isFunction: () => boolean;
isUnresolvedFunction: () => boolean;
isArray: () => boolean;
isDate: () => boolean;
isRegExp: () => boolean;
isError: () => boolean;
isPromise: () => boolean;
isGenerator: () => boolean;
isProperty: () => boolean;
isInternalProperty: () => boolean;
isFrame: () => boolean;
isScript: () => boolean;
isContext: () => boolean;
isScope: () => boolean;
isMap: () => boolean;
isSet: () => boolean;
isIterator: () => boolean;
toText: () => string;
}
export interface ValueMirror extends Mirror {
value_: any;
isPrimitive: () => boolean;
value: () => any;
}
export interface UndefinedMirror extends ValueMirror {}
export interface InternalPropertyMirror extends Mirror {
name: () => string;
// TODO: Determine if this should not be any
value: () => any;
}
export interface ObjectMirror extends ValueMirror {
className: () => string;
constructorFunction: () => Mirror;
prototypeObject: () => Mirror;
protoObject: () => Mirror;
hasNamedInterceptor: () => boolean;
hasIndexedInterceptor: () => boolean;
// TODO: Determine if string[] is the correct return type
propertyNames: (kind: number, limit: number) => string[];
// TODO: Determine if PropertyMirror[] is the corrrect return type
// The debug code assumes `kind` and `limit` below are optional.
// Determine if that is the case.
properties: (kind?: number, limit?: number) => PropertyMirror[];
// TODO: Determine if PropertyMirror[] is the corrrect return type
internalProperties: () => PropertyMirror[];
property: () => PropertyMirror | UndefinedMirror;
lookupProperty: (value: Mirror) => PropertyMirror | UndefinedMirror;
// TODO: Determine if the return type can be ObjectMirror[]
referencedBy: (opt_max_objects?: number) => Mirror[];
// TODO: Determine how to express that this is a static method
GetInternalProperties: (value: any) => InternalPropertyMirror[];
}
export interface PropertyMirror extends Mirror {
// TODO: Determine if this attribute should be treated as public and, if so,
// include the rest of the public attributes.
mirror_: ObjectMirror;
isReadOnly: () => boolean;
isEnum: () => boolean;
canDelete: () => boolean;
name: () => string;
isIndexed: () => boolean;
// TODO: Determine if this return type is correct.
// The debug agent code expects this method to return a `ValueMirror`.
value: () => ValueMirror;
isException: () => boolean;
// TODO: Determine the correct return type for these
attributes: () => any;
propertyType: () => any;
hasGetter: () => boolean;
hasSetter: () => boolean;
getter: () => Mirror;
setter: () => Mirror;
isNative: () => boolean;
}
export interface FrameDetails {
// TODO: The debug code expects this to have `arguments` and `locals` fields.
// The code at https://github.com/v8/v8/blob/master/src/debug/mirrors.js
// seems to suggest that these fields should exist. Make sure that is
// the case.
arguments: Array < {
name: string;
value: any;
}
> ;
locals: Array < {
name: string;
value: any;
}
> ;
break_id_: number;
// TODO: Determine the type of details_ and the methods in this interface
details_: any;
frameId: () => any;
receiver: () => any;
func: () => any;
script: () => any;
isConstructCall: () => any;
isAtReturn: () => any;
isDebuggerFrame: () => any;
isOptimizedFrame: () => any;
isInlinedFrame: () => any;
inlinedFrameIndex: () => any;
argumentCount: () => any;
argumentName: (index: number) => any;
argumentValue: (index: number) => any;
localCount: () => any;
sourcePosition: () => any;
localName: () => any;
localValue: () => any;
returnValue: () => any;
scopeCount: () => any;
}
export interface FrameMirror extends Mirror {
break_id_: number;
index_: number;
// TODO: Determine the type of details_
details_: FrameDetails;
details: () => FrameDetails;
index: () => number;
// TODO: Determine if this can be made more precise
// The debug agent code assumes this is a FunctionMirror
func: () => FunctionMirror;
// TODO: Determine if this can be made more precise
script: () => Mirror;
receiver: () => Mirror;
// TODO: Determine if the return type is correct
isConstructCall: () => boolean;
// TODO: Determine if the return type is correct
isAtReturn: () => boolean;
// TODO: Determine if the return type is correct
isDebuggerFrame: () => boolean;
// TODO: Determine if the return type is correct
isOptimizedFrame: () => boolean;
// TODO: Determine if the return type is correct
isInlinedFrame: () => boolean;
// TODO: Determine if the return type is correct
inlinedFrameIndex: () => number;
// TODO: Determine if the return type is correct
argumentCount: () => number;
// TODO: Determine if the return type is correct
argumentName: () => string;
argumentValue: () => Mirror;
// TODO: Determine if the return type is correct
localCount: () => number;
// TODO: Determine if the return type is correct
localName: () => string;
localValue: () => Mirror;
returnValue: () => Mirror;
// TODO: Determine if the return type is correct
sourcePosition: () => any;
// TODO: Determine if the return type is correct
sourceLocation: () => any;
// TODO: Determine if the return type is correct
sourceLine: () => number;
// TODO: Determine if the return type is correct
sourceColumn: () => number;
// TODO: Determine if the return type is correct
sourceLineText: () => string;
// TODO: Determine if the return type is correct
scopeCount: () => number;
// More precisely, the return type is ScopeMirror
scope: () => Mirror;
allScopes: (opt_ignore_nested_scopes?: boolean) => ScopeMirror[];
// TODO: Determine if ValueMirror is the correct return type.
// The debug aget code expects the type to be ValueMirror.
evaluate: (source: string, throw_on_side_effect?: boolean) => ValueMirror;
invocationText: () => string;
sourceAndPositionText: () => string;
localsText: () => string;
// TODO: Determine the return type
restart: () => any;
}
// TODO: Determine and verify the types of the parameters and return types
// of each member of this interface
export interface ScopeDetails {
type: () => any;
object: () => any;
name: () => any;
startPosition: () => any;
endPosition: () => any;
func: () => any;
setVariableValueImpl: (name: string, new_value: any) => void;
}
export interface ScopeMirror extends Mirror {
details: () => ScopeDetails;
frameIndex: () => number;
scopeIndex: () => number;
// TODO: Determine this type. It is the same as ScopeDetails#type()
scopeType: () => any;
scopeObject: () => Mirror;
// TODO: Verify the parameter types and return type
setVariableValue: (name: string, new_value: any) => void;
}
export interface ScriptMirror {
// TODO: Determine the other members of this interface
name: () => string;
}
export interface Location {
// TODO: Determine the members of this interface
}
export interface ContextMirror {
// TODO: Determine the members of this interface
}
export interface FunctionMirror extends ObjectMirror {
resolved: () => boolean;
name: () => string;
debugName: () => string;
inferredName: () => string;
source: () => string | undefined;
script: () => ScriptMirror | undefined;
sourcePosition: () => number | undefined;
sourceLocation: () => Location | undefined;
constructedBy: (opt_max_instances?: number) => Mirror[] | undefined;
scopeCount: () => number;
scope: (index: number) => ScopeMirror;
toText: () => string;
context: () => ContextMirror;
}
// See https://github.com/v8/v8/blob/master/src/debug/debug.js and
// https://github.com/nodejs/node/blob/master/src/node_contextify.cc
export interface ExecutionState {
// This interface only contains the elements used within the debug agent
// for the full implementation.
frame: (index: number) => FrameMirror;
frameCount: () => number;
}
// TODO: Add the rest of the methods in this interface
export interface BreakPoint {
script_break_point: () => ScriptBreakPoint;
// TODO: The debug code assumes these method exist. Verify they exist.
number: () => number;
active: () => boolean;
}
// TODO: Add the rest of the methods in this interface
export interface ScriptBreakPoint { number: () => number; }
// TODO: Verify the return types of these methods
export interface BreakEvent {
eventType: () => DebugEvent;
func: () => any;
sourceLine: () => number;
sourceColumn: () => number;
sourceLineText: () => string;
breakPointsHit: () => BreakPoint[];
}
export interface DebugEvent {
Break: DebugEvent;
Exception: DebugEvent;
AfterCompile: DebugEvent;
CompileError: DebugEvent;
AsyncTaskEvent: DebugEvent;
}
// See https://github.com/v8/v8/blob/master/src/debug/debug.js
// TODO: Add the rest of the methods in this interface
export interface Debug {
DebugEvent: DebugEvent;
setListener: (listener: any, opt_data?: any) => void;
clearBreakPoint: (break_point_number: number) => void;
setScriptBreakPointByRegExp:
(script_regexp: RegExp, opt_line?: number, opt_column?: number,
opt_condition?: any, opt_groupId?: number) => number;
findBreakPoint: (break_point_number: number, remove?: boolean) => BreakPoint;
MakeMirror: (value: any) => Mirror;
}