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

Function CheckScopeContent

deps/v8/test/debugger/debug/es6/generators-debug-scopes.js:86–117  ·  view source on GitHub ↗
(content, number, exec_state)

Source from the content-addressed store, hash-verified

84// Check that the content of the scope is as expected. For functions just check
85// that there is a function.
86function CheckScopeContent(content, number, exec_state) {
87 var scope = exec_state.frame().scope(number);
88 var count = 0;
89 for (var p in content) {
90 var property_mirror = scope.scopeObject().property(p);
91 assertFalse(property_mirror.isUndefined(),
92 'property ' + p + ' not found in scope');
93 assertEquals(content[p], property_mirror.value().value(),
94 'property ' + p + ' has unexpected value');
95 count++;
96 }
97
98 // 'arguments' and might be exposed in the local and closure scope. Just
99 // ignore this.
100 var scope_size = scope.scopeObject().properties().length;
101 if (!scope.scopeObject().property('arguments').isUndefined()) {
102 scope_size--;
103 }
104 // Skip property with empty name.
105 if (!scope.scopeObject().property('').isUndefined()) {
106 scope_size--;
107 }
108
109 if (scope_size < count) {
110 print('Names found in scope:');
111 var names = scope.scopeObject().propertyNames();
112 for (var i = 0; i < names.length; i++) {
113 print(names[i]);
114 }
115 }
116 assertTrue(scope_size >= count);
117}
118
119
120// Simple empty local scope.

Callers 1

Calls 7

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

Tested by

no test coverage detected