Skip to content

Commit

Permalink
remove debug stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Nov 20, 2019
1 parent c1b614b commit b69e6f7
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 184 deletions.
3 changes: 0 additions & 3 deletions packages/@ember/-internals/glimmer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,8 @@ export { default as AbstractComponentManager } from './lib/component-managers/ab
// TODO just test these through public API
// a lot of these are testing how a problem was solved
// rather than the problem was solved
// DebugStack should just test the assert message
// it supports for example
export { UpdatableReference, INVOKE } from './lib/utils/references';
export { default as iterableFor } from './lib/utils/iterable';
export { default as getDebugStack, DebugStack } from './lib/utils/debug-stack';
export { default as OutletView } from './lib/views/outlet';
export { capabilities } from './lib/component-managers/custom';
export { setComponentManager, getComponentManager } from './lib/utils/custom-component-manager';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,16 @@ import {
PreparedArguments,
} from '@glimmer/runtime';
import { Destroyable, Opaque, Option } from '@glimmer/util';
import { DebugStack } from '../utils/debug-stack';

// implements the ComponentManager interface as defined in glimmer:
// tslint:disable-next-line:max-line-length
// https://github.com/glimmerjs/glimmer-vm/blob/v0.24.0-beta.4/packages/%40glimmer/runtime/lib/component/interfaces.ts#L21

export default abstract class AbstractManager<T, U> implements ComponentManager<T, U> {
public debugStack: DebugStack | undefined = undefined;

prepareArgs(_state: U, _args: Arguments): Option<PreparedArguments> {
return null;
}

// must be implemented by inheritors, inheritors should also
// call `this._pushToDebugStack` to ensure the rerendering
// assertion messages are properly maintained

abstract create(
env: Environment,
definition: U,
Expand All @@ -43,9 +36,6 @@ export default abstract class AbstractManager<T, U> implements ComponentManager<
// noop
}

// inheritors should also call `this.debugStack.pop()` to
// ensure the rerendering assertion messages are properly
// maintained
didRenderLayout(_component: T, _bounds: Bounds): void {
// noop
}
Expand All @@ -56,16 +46,10 @@ export default abstract class AbstractManager<T, U> implements ComponentManager<

abstract getTag(_bucket: T): Tag;

// inheritors should also call `this._pushToDebugStack`
// to ensure the rerendering assertion messages are
// properly maintained
update(_bucket: T, _dynamicScope: DynamicScope): void {
// noop
}

// inheritors should also call `this.debugStack.pop()` to
// ensure the rerendering assertion messages are properly
// maintained
didUpdateLayout(_bucket: T, _bounds: Bounds): void {
// noop
}
Expand Down
16 changes: 0 additions & 16 deletions packages/@ember/-internals/glimmer/lib/component-managers/curly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ export default class CurlyComponentManager
callerSelfRef: VersionedPathReference,
hasBlock: boolean
): ComponentStateBucket {
if (DEBUG) {
environment.debugStack.push(`component:${state.name}`);
}

// Get the nearest concrete component instance from the scope. "Virtual"
// components will be skipped.
let parentView = dynamicScope.view;
Expand Down Expand Up @@ -430,10 +426,6 @@ export default class CurlyComponentManager
if (ENV._DEBUG_RENDER_TREE) {
bucket.environment.debugRenderTree.didRender(bucket, bounds);
}

if (DEBUG) {
bucket.environment.debugStack.pop();
}
}

getTag({ args, component }: ComponentStateBucket): Tag {
Expand All @@ -455,10 +447,6 @@ export default class CurlyComponentManager
environment.debugRenderTree.update(bucket);
}

if (DEBUG) {
environment.debugStack.push(component._debugContainerKey);
}

bucket.finalizer = _instrumentStart('render.component', rerenderInstrumentDetails, component);

if (args && !validate(args.tag, argsRevision)) {
Expand Down Expand Up @@ -486,10 +474,6 @@ export default class CurlyComponentManager
if (ENV._DEBUG_RENDER_TREE) {
bucket.environment.debugRenderTree.didRender(bucket, bounds);
}

if (DEBUG) {
bucket.environment.debugStack.pop();
}
}

didUpdate({ component, environment }: ComponentStateBucket): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ class MountManager extends AbstractManager<EngineState, EngineDefinitionState>
}

create(environment: Environment, { name }: EngineDefinitionState, args: Arguments) {
if (DEBUG) {
environment.debugStack.pushEngine(`engine:${name}`);
}

// TODO
// mount is a runtime helper, this shouldn't use dynamic layout
// we should resolve the engine app template in the helper
Expand Down Expand Up @@ -172,10 +168,6 @@ class MountManager extends AbstractManager<EngineState, EngineDefinitionState>
}

didRenderLayout(bucket: EngineState, bounds: Bounds): void {
if (DEBUG) {
bucket.environment.debugStack.pop();
}

if (ENV._DEBUG_RENDER_TREE) {
bucket.environment.debugRenderTree.didRender(bucket.controller, bounds);
bucket.environment.debugRenderTree.didRender(bucket, bounds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { assert } from '@ember/debug';
import EngineInstance from '@ember/engine/instance';
import { _instrumentStart } from '@ember/instrumentation';
import { assign } from '@ember/polyfills';
import { DEBUG } from '@glimmer/env';
import { ComponentCapabilities, Option, Simple } from '@glimmer/interfaces';
import { CONSTANT_TAG, createTag, Tag, VersionedPathReference } from '@glimmer/reference';
import {
Expand Down Expand Up @@ -76,10 +75,6 @@ class OutletComponentManager extends AbstractManager<OutletInstanceState, Outlet
args: Arguments,
dynamicScope: DynamicScope
): OutletInstanceState {
if (DEBUG) {
environment.debugStack.push(`template:${definition.template.referrer.moduleName}`);
}

let parentStateRef = dynamicScope.outletState;
let currentStateRef = definition.ref;

Expand Down Expand Up @@ -167,10 +162,6 @@ class OutletComponentManager extends AbstractManager<OutletInstanceState, Outlet
didRenderLayout(state: OutletInstanceState, bounds: Bounds): void {
state.finalize();

if (DEBUG) {
state.environment.debugStack.pop();
}

if (ENV._DEBUG_RENDER_TREE) {
state.environment.debugRenderTree.didRender(state, bounds);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ class RootComponentManager extends CurlyComponentManager {
) {
let component = this.component;

if (DEBUG) {
environment.debugStack.push((component as any)._debugContainerKey);
}

let finalizer = _instrumentStart('render.component', initialRenderInstrumentDetails, component);

dynamicScope.view = component;
Expand Down
14 changes: 0 additions & 14 deletions packages/@ember/-internals/glimmer/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
SimpleDynamicAttribute,
} from '@glimmer/runtime';
import { Destroyable, Opaque } from '@glimmer/util';
import getDebugStack, { DebugStack } from './utils/debug-stack';
import createIterable from './utils/iterable';
import { ConditionalReference, UpdatableReference } from './utils/references';
import { isHTMLSafe } from './utils/string';
Expand All @@ -35,7 +34,6 @@ export default class Environment extends GlimmerEnvironment {
public isInteractive: boolean;
public destroyedComponents: Destroyable[];

private _debugStack: DebugStack | undefined;
private _debugRenderTree: DebugRenderTree | undefined;
public inTransaction = false;

Expand All @@ -52,23 +50,11 @@ export default class Environment extends GlimmerEnvironment {

installPlatformSpecificProtocolForURL(this);

if (DEBUG) {
this._debugStack = getDebugStack();
}

if (ENV._DEBUG_RENDER_TREE) {
this._debugRenderTree = new DebugRenderTree();
}
}

get debugStack(): DebugStack {
if (DEBUG) {
return this._debugStack!;
} else {
throw new Error("Can't access debug stack outside of debug mode");
}
}

get debugRenderTree(): DebugRenderTree {
if (ENV._DEBUG_RENDER_TREE) {
return this._debugRenderTree!;
Expand Down
75 changes: 0 additions & 75 deletions packages/@ember/-internals/glimmer/lib/utils/debug-stack.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/@ember/-internals/glimmer/lib/utils/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export class RootPropertyReference extends PropertyReference
super();

if (DEBUG) {
// Capture the stack when this reference is created, as that is the
// component/context that the component was created _in_. Later, it could
// be accessed from any number of components.
this.debugStackLog = env ? env.debugRenderTree.logCurrentRenderStack() : '';
}

Expand Down

This file was deleted.

0 comments on commit b69e6f7

Please sign in to comment.