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

Function CheckScopeContent

deps/v8/test/debugger/bugs/harmony/debug-blockscopes.js:98–132  ·  view source on GitHub ↗
(content, number, exec_state)

Source from the content-addressed store, hash-verified

96// Check that the content of the scope is as expected. For functions just check
97// that there is a function.
98function CheckScopeContent(content, number, exec_state) {
99 var scope = exec_state.frame().scope(number);
100 var count = 0;
101 for (var p in content) {
102 var property_mirror = scope.scopeObject().property(p);
103 if (property_mirror.isUndefined()) {
104 print('property ' + p + ' not found in scope');
105 }
106 assertFalse(property_mirror.isUndefined(),
107 'property ' + p + ' not found in scope');
108 assertEquals(content[p], property_mirror.value().value(),
109 'property ' + p + ' has unexpected value');
110 count++;
111 }
112
113 // 'arguments' and might be exposed in the local and closure scope. Just
114 // ignore this.
115 var scope_size = scope.scopeObject().properties().length;
116 if (!scope.scopeObject().property('arguments').isUndefined()) {
117 scope_size--;
118 }
119 // Skip property with empty name.
120 if (!scope.scopeObject().property('').isUndefined()) {
121 scope_size--;
122 }
123
124 if (scope_size < count) {
125 print('Names found in scope:');
126 var names = scope.scopeObject().propertyNames();
127 for (var i = 0; i < names.length; i++) {
128 print(names[i]);
129 }
130 }
131 assertTrue(scope_size >= count);
132}
133
134
135// Simple closure formed by returning an inner function referering to an outer

Callers 1

Calls 7

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

Tested by

no test coverage detected