internal DebugScope(DebugScopeType type, EnvironmentRecord record, List <string> bindingNames, bool isTopLevel) { ScopeType = type; _record = record; _bindingNames = bindingNames; BindingObject = record is ObjectEnvironmentRecord objEnv ? objEnv._bindingObject : null; IsTopLevel = isTopLevel; }
private static void AssertScope(DebugScope actual, DebugScopeType expectedType, params string[] expectedBindingNames) { Assert.Equal(expectedType, actual.ScopeType); // Global scope will have a number of intrinsic bindings that are outside the scope [no pun] of these tests if (actual.ScopeType != DebugScopeType.Global) { Assert.Equal(expectedBindingNames.Length, actual.BindingNames.Count); } foreach (string expectedName in expectedBindingNames) { Assert.Contains(expectedName, actual.BindingNames); } }
private void AddScope(DebugScopeType type, EnvironmentRecord record, bool isTopLevel = false) { var bindings = new List <string>(); PopulateBindings(bindings, record); if (bindings.Count > 0) { var scope = new DebugScope(type, record, bindings, isTopLevel); _scopes.Add(scope); switch (type) { case DebugScopeType.Global: Global = scope; break; case DebugScopeType.Local: Local = scope; break; } } }
private static JsValue AssertOnlyScopeContains(DebugScopes scopes, string name, DebugScopeType scopeType) { var containingScope = Assert.Single(scopes, s => s.ScopeType == scopeType && s.BindingNames.Contains(name)); Assert.DoesNotContain(scopes, s => s != containingScope && s.BindingNames.Contains(name)); return(containingScope.GetBindingValue(name)); }