diff --git a/packages/ptc-runtime/ptc-runtime-node/src/bindings.ts b/packages/ptc-runtime/ptc-runtime-node/src/bindings.ts index c142ef43f5..422fb97657 100644 --- a/packages/ptc-runtime/ptc-runtime-node/src/bindings.ts +++ b/packages/ptc-runtime/ptc-runtime-node/src/bindings.ts @@ -2,7 +2,7 @@ import { PtcImage, RESERVED_BINDING_WORDS, PtcRuntimeError, RESERVED_BINDING_GLOBALS, RESERVED_ERROR_MEMBERS } from '@deepseek-ai/dsh-ptc-runtime' import type { PtcBindingFunction, PtcBindingNamespace, PtcJsonValue, PtcProgramFormat, PtcRunRequest } from '@deepseek-ai/dsh-ptc-runtime' import { snapshotPtcJsonValue, encodePtcJsonWire, type PtcJsonWire, type PtcImageWire } from './json-wire.ts' -import { RESERVED_PREFIX } from './evaluators/scoped-repl-names.ts' +import { RESERVED_PREFIX } from './evaluators/scoped-repl.ts' const IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/ /** * Reject unusable namespaces before starting a process. diff --git a/packages/ptc-runtime/ptc-runtime-node/src/evaluators/scoped-repl-names.ts b/packages/ptc-runtime/ptc-runtime-node/src/evaluators/scoped-repl-names.ts deleted file mode 100644 index 93a6fc4a86..0000000000 --- a/packages/ptc-runtime/ptc-runtime-node/src/evaluators/scoped-repl-names.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** Internal identifiers shared by scoped REPL source generation and host binding validation. */ - -/** Prefix of generated names, excluded from program source and injected identifiers. */ -export const RESERVED_PREFIX = '__$binding_' diff --git a/packages/ptc-runtime/ptc-runtime-node/src/evaluators/scoped-repl.ts b/packages/ptc-runtime/ptc-runtime-node/src/evaluators/scoped-repl.ts index c58dfabbb1..8323f7be7b 100644 --- a/packages/ptc-runtime/ptc-runtime-node/src/evaluators/scoped-repl.ts +++ b/packages/ptc-runtime/ptc-runtime-node/src/evaluators/scoped-repl.ts @@ -2,8 +2,6 @@ import { getLineInfo, parse } from 'acorn' import type { Identifier, ModuleDeclaration, Pattern, Program, Statement } from 'acorn' import { Script, type Context, type ScriptOptions } from 'node:vm' -import { RESERVED_PREFIX } from './scoped-repl-names.ts' -export { RESERVED_PREFIX } from './scoped-repl-names.ts' /** Declaration keyword recorded for a top-level binding; later programs copy `var` bindings as `var` and every other binding as `let`. */ export type ScopedReplBindingKind = 'var' | 'let' | 'const' | 'function' | 'class' @@ -36,6 +34,8 @@ export interface ScopedReplScan { finalExpression?: ScopedReplFinalExpression } +/** Prefix of every generated name; programs that contain it anywhere are rejected. */ +export const RESERVED_PREFIX = '__$binding_' /** Generated parameter receiving the values copied from earlier programs. */ export const BINDING_VALUES = `${RESERVED_PREFIX}vals` /** Generated parameter receiving one read function per binding, in binding order. */