MCPcopy Index your code
hub / github.com/nodejs/node / CheckScopeContent

Function CheckScopeContent

deps/v8/test/debugger/debug/debug-scopes.js:133–166  ·  view source on GitHub ↗
(minimum_content, number, exec_state)

Source from the content-addressed store, hash-verified

131// Check that the scope contains at least minimum_content. For functions just
132// check that there is a function.
133function CheckScopeContent(minimum_content, number, exec_state) {
134 var scope = exec_state.frame().scope(number);
135 var minimum_count = 0;
136 for (var p in minimum_content) {
137 var property_mirror = scope.scopeObject().property(p);
138 assertFalse(property_mirror.isUndefined(),
139 'property ' + p + ' not found in scope');
140 assertEquals(minimum_content[p], property_mirror.value().value(),
141 'property ' + p + ' has unexpected value');
142 minimum_count++;
143 }
144
145 // 'arguments' and might be exposed in the local and closure scope. Just
146 // ignore this.
147 var scope_size = scope.scopeObject().properties().length;
148 if (!scope.scopeObject().property('arguments').isUndefined()) {
149 scope_size--;
150 }
151 // Ditto for 'this'.
152 if (!scope.scopeObject().property('this').isUndefined()) {
153 scope_size--;
154 }
155 // Temporary variables introduced by the parser have not been materialized.
156 assertTrue(scope.scopeObject().property('').isUndefined());
157
158 if (scope_size < minimum_count) {
159 print('Names found in scope:');
160 var names = scope.scopeObject().propertyNames();
161 for (var i = 0; i < names.length; i++) {
162 print(names[i]);
163 }
164 }
165 assertTrue(scope_size >= minimum_count);
166}
167
168// Check that the scopes have positions as expected.
169function CheckScopeChainPositions(positions, exec_state) {

Callers 1

debug-scopes.jsFile · 0.70

Calls 7

assertFalseFunction · 0.50
assertEqualsFunction · 0.50
assertTrueFunction · 0.50
printFunction · 0.50
propertyMethod · 0.45
valueMethod · 0.45
propertyNamesMethod · 0.45

Tested by

no test coverage detected