From 4492d0574b25a8462bbed985cdb2317ec1d90eee Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:42:51 -0500 Subject: [PATCH] Rename Option to Nullable to align with glimmer-vm terminology --- .../glimmer/lib/component-managers/curly.ts | 8 ++++---- .../glimmer/lib/component-managers/mount.ts | 4 ++-- .../glimmer/lib/component-managers/outlet.ts | 4 ++-- .../glimmer/lib/component-managers/root.ts | 4 ++-- .../-internals/glimmer/lib/components/link-to.ts | 8 ++++---- packages/@ember/-internals/glimmer/lib/renderer.ts | 6 +++--- packages/@ember/-internals/glimmer/lib/resolver.ts | 14 +++++++------- .../@ember/-internals/glimmer/lib/syntax/mount.ts | 4 ++-- .../@ember/-internals/glimmer/lib/syntax/utils.ts | 4 ++-- .../-internals/glimmer/lib/utils/iterator.ts | 4 ++-- packages/@ember/-internals/utility-types/index.ts | 2 +- .../@ember/-internals/views/lib/system/utils.ts | 8 ++++---- packages/@ember/routing/lib/dsl.ts | 4 ++-- .../tests/utils/transform-test-case.ts | 4 ++-- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts b/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts index bc9c1870c04..23d004c28f5 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/curly.ts @@ -6,7 +6,7 @@ import { } from '@ember/-internals/owner'; import { enumerableSymbol, guidFor } from '@ember/-internals/utils'; import { addChildView, setElementView, setViewElement } from '@ember/-internals/views'; -import type { Option } from '@ember/-internals/utility-types'; +import type { Nullable } from '@ember/-internals/utility-types'; import { assert, debugFreeze } from '@ember/debug'; import { _instrumentStart } from '@ember/instrumentation'; import { DEBUG } from '@glimmer/env'; @@ -154,7 +154,7 @@ export default class CurlyComponentManager return this.templateFor(bucket.component); } - getTagName(state: ComponentStateBucket): Option { + getTagName(state: ComponentStateBucket): Nullable { let { component, hasWrappedElement } = state; if (!hasWrappedElement) { @@ -168,7 +168,7 @@ export default class CurlyComponentManager return CURLY_CAPABILITIES; } - prepareArgs(ComponentClass: ComponentFactory, args: VMArguments): Option { + prepareArgs(ComponentClass: ComponentFactory, args: VMArguments): Nullable { if (args.named.has('__ARGS__')) { assert( '[BUG] cannot pass both __ARGS__ and positional arguments', @@ -467,7 +467,7 @@ export default class CurlyComponentManager } } - getDestroyable(bucket: ComponentStateBucket): Option { + getDestroyable(bucket: ComponentStateBucket): Nullable { return bucket; } } diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/mount.ts b/packages/@ember/-internals/glimmer/lib/component-managers/mount.ts index 67655a37d1e..068d30c8fbf 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/mount.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/mount.ts @@ -17,7 +17,7 @@ import type { WithDynamicLayout, WithSubOwner, } from '@glimmer/interfaces'; -import type { Option } from '@ember/-internals/utility-types'; +import type { Nullable } from '@ember/-internals/utility-types'; import { capabilityFlagsFrom } from '@glimmer/manager'; import type { Reference } from '@glimmer/reference'; import { createConstRef, valueForRef } from '@glimmer/reference'; @@ -149,7 +149,7 @@ class MountManager return self; } - getDestroyable(bucket: EngineState): Option { + getDestroyable(bucket: EngineState): Nullable { return bucket.engine; } diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts b/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts index 403bc7e88aa..39cf2cfd29c 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts @@ -19,7 +19,7 @@ import type { WithCustomDebugRenderTree, WithDynamicTagName, } from '@glimmer/interfaces'; -import type { Option } from '@ember/-internals/utility-types'; +import type { Nullable } from '@ember/-internals/utility-types'; import { capabilityFlagsFrom } from '@glimmer/manager'; import type { Reference } from '@glimmer/reference'; import { createConstRef, valueForRef } from '@glimmer/reference'; @@ -179,7 +179,7 @@ class OutletComponentManager didUpdateLayout() {} - getDestroyable(): Option { + getDestroyable(): Nullable { return null; } } diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/root.ts b/packages/@ember/-internals/glimmer/lib/component-managers/root.ts index 94e067217f0..00aca8f633c 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/root.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/root.ts @@ -9,7 +9,7 @@ import type { Owner, VMArguments, } from '@glimmer/interfaces'; -import type { Option } from '@ember/-internals/utility-types'; +import type { Nullable } from '@ember/-internals/utility-types'; import { capabilityFlagsFrom } from '@glimmer/manager'; import { CONSTANT_TAG, consumeTag } from '@glimmer/validator'; import type Component from '../component'; @@ -32,7 +32,7 @@ class RootComponentManager extends CurlyComponentManager { create( _owner: Owner, _state: unknown, - _args: Option, + _args: Nullable, { isInteractive }: Environment, dynamicScope: DynamicScope ) { diff --git a/packages/@ember/-internals/glimmer/lib/components/link-to.ts b/packages/@ember/-internals/glimmer/lib/components/link-to.ts index 2da84f8ff70..f5110758a4e 100644 --- a/packages/@ember/-internals/glimmer/lib/components/link-to.ts +++ b/packages/@ember/-internals/glimmer/lib/components/link-to.ts @@ -9,7 +9,7 @@ import { action } from '@ember/object'; import { service } from '@ember/service'; import { DEBUG } from '@glimmer/env'; import type { Maybe } from '@glimmer/interfaces'; -import type { Option } from '@ember/-internals/utility-types'; +import type { Nullable } from '@ember/-internals/utility-types'; import { consumeTag, createCache, getValue, tagFor, untrack } from '@glimmer/validator'; import type { Transition } from 'router_js'; import LinkToTemplate from '../templates/link-to'; @@ -32,7 +32,7 @@ function isPresent(value: Maybe): value is T { interface QueryParams { isQueryParams: true; - values: Option<{}>; + values: Nullable<{}>; } function isQueryParams(value: unknown): value is QueryParams { @@ -474,7 +474,7 @@ class _LinkTo extends InternalComponent { return this.isActiveForState(this.routing.currentState as Maybe); } - private get willBeActive(): Option { + private get willBeActive(): Nullable { let current = this.routing.currentState; let target = this.routing.targetState; @@ -586,7 +586,7 @@ class _LinkTo extends InternalComponent { let { prototype } = _LinkTo; -let descriptorFor = (target: object, property: string): Option => { +let descriptorFor = (target: object, property: string): Nullable => { if (target) { return ( Object.getOwnPropertyDescriptor(target, property) || diff --git a/packages/@ember/-internals/glimmer/lib/renderer.ts b/packages/@ember/-internals/glimmer/lib/renderer.ts index 2144748225c..1c9c0e44469 100644 --- a/packages/@ember/-internals/glimmer/lib/renderer.ts +++ b/packages/@ember/-internals/glimmer/lib/renderer.ts @@ -23,7 +23,7 @@ import type { } from '@glimmer/interfaces'; import { CurriedType } from '@glimmer/vm'; -import type { Option } from '@ember/-internals/utility-types'; +import type { Nullable } from '@ember/-internals/utility-types'; import { programCompilationContext } from '@glimmer/opcode-compiler'; import { artifacts, RuntimeOpImpl } from '@glimmer/program'; import type { Reference } from '@glimmer/reference'; @@ -55,7 +55,7 @@ import OutletView from './views/outlet'; export type IBuilder = (env: Environment, cursor: Cursor) => ElementBuilder; export interface View { - parentView: Option; + parentView: Nullable; renderer: Renderer; tagName: string | null; elementId: string | null; @@ -464,7 +464,7 @@ export class Renderer { this._clearAllRoots(); } - getElement(view: View): Option { + getElement(view: View): Nullable { if (this._isInteractive) { return getViewElement(view); } else { diff --git a/packages/@ember/-internals/glimmer/lib/resolver.ts b/packages/@ember/-internals/glimmer/lib/resolver.ts index e1d9415e828..5ad07efc0c4 100644 --- a/packages/@ember/-internals/glimmer/lib/resolver.ts +++ b/packages/@ember/-internals/glimmer/lib/resolver.ts @@ -14,7 +14,7 @@ import type { Template, TemplateFactory, } from '@glimmer/interfaces'; -import type { Option } from '@ember/-internals/utility-types'; +import type { Nullable } from '@ember/-internals/utility-types'; import { getComponentTemplate, getInternalComponentManager, @@ -55,7 +55,7 @@ function instrumentationPayload(name: string) { function componentFor( name: string, owner: InternalOwner -): Option | object> { +): Nullable | object> { let fullName = `component:${name}` as const; return owner.factoryFor(fullName) || null; } @@ -64,7 +64,7 @@ function layoutFor( name: string, owner: InternalOwner, options?: RegisterOptions -): Option