Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/units/Goccia.Builtins.Benchmark.pas
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ constructor TGocciaBenchmark.Create(const AName: string; const AScope: TGocciaSc
FRegisteredBenchmarks := TObjectList<TBenchmarkCase>.Create;
FCurrentSuiteName := '';

AScope.DefineLexicalBinding('suite', TGocciaNativeFunctionValue.Create(Suite, 'suite', 2), dtConst);
AScope.DefineLexicalBinding('bench', TGocciaNativeFunctionValue.Create(Bench, 'bench', 2), dtConst);
AScope.DefineLexicalBinding('runBenchmarks', TGocciaNativeFunctionValue.Create(RunBenchmarks, 'runBenchmarks', 0), dtConst);
AScope.DefineLexicalBinding('suite', TGocciaNativeFunctionValue.Create(Suite, 'suite', 2), dtConst, True);
AScope.DefineLexicalBinding('bench', TGocciaNativeFunctionValue.Create(Bench, 'bench', 2), dtConst, True);
AScope.DefineLexicalBinding('runBenchmarks', TGocciaNativeFunctionValue.Create(RunBenchmarks, 'runBenchmarks', 0), dtConst, True);
end;

destructor TGocciaBenchmark.Destroy;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.CSV.pas
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ constructor TGocciaCSVBuiltin.Create(const AName: string;
end;

RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

destructor TGocciaCSVBuiltin.Destroy;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.Console.pas
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ constructor TGocciaConsole.Create(const AName: string; const AScope: TGocciaScop
end;
RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);

AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

procedure TGocciaConsole.EmitLine(const AMethod, ALine: string);
Expand Down
4 changes: 2 additions & 2 deletions source/units/Goccia.Builtins.DisposableStack.pas
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ constructor TGocciaBuiltinDisposableStack.Create(const AName: string;

DisposableStackFunc := TGocciaNativeFunctionValue.Create(
DisposableStackConstructor, CONSTRUCTOR_DISPOSABLE_STACK, 0);
AScope.DefineLexicalBinding(CONSTRUCTOR_DISPOSABLE_STACK, DisposableStackFunc, dtConst);
AScope.DefineLexicalBinding(CONSTRUCTOR_DISPOSABLE_STACK, DisposableStackFunc, dtConst, True);

AsyncDisposableStackFunc := TGocciaNativeFunctionValue.Create(
AsyncDisposableStackConstructor, CONSTRUCTOR_ASYNC_DISPOSABLE_STACK, 0);
AScope.DefineLexicalBinding(CONSTRUCTOR_ASYNC_DISPOSABLE_STACK, AsyncDisposableStackFunc, dtConst);
AScope.DefineLexicalBinding(CONSTRUCTOR_ASYNC_DISPOSABLE_STACK, AsyncDisposableStackFunc, dtConst, True);
end;

function TGocciaBuiltinDisposableStack.DisposableStackConstructor(
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.GlobalBigInt.pas
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ constructor TGocciaGlobalBigInt.Create(const AName: string; const AScope: TGocci
TGocciaPropertyDescriptorData.Create(Proto, []));

// Bind BigInt in scope
AScope.DefineLexicalBinding(AName, FBigIntFunction, dtLet);
AScope.DefineLexicalBinding(AName, FBigIntFunction, dtLet, True);
end;

// ES2026 §21.2.1.1 BigInt(value) — conversion function
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.GlobalFFI.pas
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ constructor TGocciaGlobalFFI.Create(const AName: string; const AScope: TGocciaSc
end;
RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);

AScope.DefineLexicalBinding(AName, FBuiltinObject, dtConst);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtConst, True);
end;

function TGocciaGlobalFFI.FFIOpen(const AArgs: TGocciaArgumentsCollection; const AThisValue: TGocciaValue): TGocciaValue;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.GlobalFetch.pas
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ constructor TGocciaGlobalFetch.Create(const AName: string;

// Register fetch as a global function
AScope.DefineLexicalBinding('fetch',
TGocciaNativeFunctionValue.Create(FetchCallback, 'fetch', 1), dtConst);
TGocciaNativeFunctionValue.Create(FetchCallback, 'fetch', 1), dtConst, True);
end;

destructor TGocciaGlobalFetch.Destroy;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.GlobalPromise.pas
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ constructor TGocciaGlobalPromise.Create(const AName: string; const AScope: TGocc
end;
RegisterMemberDefinitions(FPromiseConstructor, FStaticMembers);

AScope.DefineLexicalBinding(AName, FPromiseConstructor, dtLet);
AScope.DefineLexicalBinding(AName, FPromiseConstructor, dtLet, True);
end;

// ES2026 §27.2.4.8 get Promise [ @@species ]
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.GlobalProxy.pas
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ constructor TGocciaGlobalProxy.Create(const AScope: TGocciaScope);
PROP_REVOCABLE, 2));
FConstructorValue := ConstructorFn;

AScope.DefineLexicalBinding(CONSTRUCTOR_PROXY, FConstructorValue, dtConst);
AScope.DefineLexicalBinding(CONSTRUCTOR_PROXY, FConstructorValue, dtConst, True);
end;

// ES2026 §28.2.1 Proxy(target, handler)
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.GlobalReflect.pas
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ constructor TGocciaGlobalReflect.Create(const AName: string; const AScope: TGocc
end;
RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);

AScope.DefineLexicalBinding(AName, FBuiltinObject, dtConst);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtConst, True);
end;

// ES2026 §28.1.1 Reflect.apply(target, thisArgument, argumentsList)
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.GlobalRegExp.pas
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ constructor TGocciaGlobalRegExp.Create(const AName: string;
end;
RegisterMemberDefinitions(FRegExpConstructor, FStaticMembers);

AScope.DefineLexicalBinding(AName, FRegExpConstructor, dtConst);
AScope.DefineLexicalBinding(AName, FRegExpConstructor, dtConst, True);
end;

// ES2026 §22.2.4.2 get RegExp [ @@species ]
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.GlobalSymbol.pas
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ constructor TGocciaGlobalSymbol.Create(const AName: string; const AScope: TGocci
TGocciaPropertyDescriptorData.Create(FSymbolFunction, [pfConfigurable, pfWritable]));

// Bind Symbol in scope
AScope.DefineLexicalBinding(AName, FSymbolFunction, dtLet);
AScope.DefineLexicalBinding(AName, FSymbolFunction, dtLet, True);
end;

destructor TGocciaGlobalSymbol.Destroy;
Expand Down
36 changes: 18 additions & 18 deletions source/units/Goccia.Builtins.Globals.pas
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ constructor TGocciaGlobals.Create(const AName: string; const AScope: TGocciaScop
begin
inherited Create(AName, AScope, AThrowError);

AScope.DefineLexicalBinding('undefined', TGocciaUndefinedLiteralValue.UndefinedValue, dtConst);
AScope.DefineLexicalBinding('NaN', TGocciaNumberLiteralValue.NaNValue, dtConst);
AScope.DefineLexicalBinding('Infinity', TGocciaNumberLiteralValue.InfinityValue, dtConst);
AScope.DefineLexicalBinding('undefined', TGocciaUndefinedLiteralValue.UndefinedValue, dtConst, True);
AScope.DefineLexicalBinding('NaN', TGocciaNumberLiteralValue.NaNValue, dtConst, True);
AScope.DefineLexicalBinding('Infinity', TGocciaNumberLiteralValue.InfinityValue, dtConst, True);

FErrorProto := TGocciaObjectValue.Create;
FErrorProto.DefineProperty(PROP_NAME, TGocciaPropertyDescriptorData.Create(TGocciaStringLiteralValue.Create(ERROR_NAME), [pfConfigurable, pfWritable]));
Expand Down Expand Up @@ -323,36 +323,36 @@ constructor TGocciaGlobals.Create(const AName: string; const AScope: TGocciaScop
FSuppressedErrorProto.DefineProperty(PROP_CONSTRUCTOR, TGocciaPropertyDescriptorData.Create(SuppressedErrorConstructorFunc, [pfConfigurable, pfWritable]));
FDOMExceptionProto.DefineProperty(PROP_CONSTRUCTOR, TGocciaPropertyDescriptorData.Create(DOMExceptionConstructorFunc, [pfConfigurable, pfWritable]));

AScope.DefineLexicalBinding(ERROR_NAME, ErrorConstructorFunc, dtConst);
AScope.DefineLexicalBinding(TYPE_ERROR_NAME, TypeErrorConstructorFunc, dtConst);
AScope.DefineLexicalBinding(REFERENCE_ERROR_NAME, ReferenceErrorConstructorFunc, dtConst);
AScope.DefineLexicalBinding(RANGE_ERROR_NAME, RangeErrorConstructorFunc, dtConst);
AScope.DefineLexicalBinding(SYNTAX_ERROR_NAME, SyntaxErrorConstructorFunc, dtConst);
AScope.DefineLexicalBinding(URI_ERROR_NAME, URIErrorConstructorFunc, dtConst);
AScope.DefineLexicalBinding(AGGREGATE_ERROR_NAME, AggregateErrorConstructorFunc, dtConst);
AScope.DefineLexicalBinding(SUPPRESSED_ERROR_NAME, SuppressedErrorConstructorFunc, dtConst);
AScope.DefineLexicalBinding(DOM_EXCEPTION_NAME, DOMExceptionConstructorFunc, dtConst);
AScope.DefineLexicalBinding(ERROR_NAME, ErrorConstructorFunc, dtConst, True);
AScope.DefineLexicalBinding(TYPE_ERROR_NAME, TypeErrorConstructorFunc, dtConst, True);
AScope.DefineLexicalBinding(REFERENCE_ERROR_NAME, ReferenceErrorConstructorFunc, dtConst, True);
AScope.DefineLexicalBinding(RANGE_ERROR_NAME, RangeErrorConstructorFunc, dtConst, True);
AScope.DefineLexicalBinding(SYNTAX_ERROR_NAME, SyntaxErrorConstructorFunc, dtConst, True);
AScope.DefineLexicalBinding(URI_ERROR_NAME, URIErrorConstructorFunc, dtConst, True);
AScope.DefineLexicalBinding(AGGREGATE_ERROR_NAME, AggregateErrorConstructorFunc, dtConst, True);
AScope.DefineLexicalBinding(SUPPRESSED_ERROR_NAME, SuppressedErrorConstructorFunc, dtConst, True);
AScope.DefineLexicalBinding(DOM_EXCEPTION_NAME, DOMExceptionConstructorFunc, dtConst, True);

AScope.DefineLexicalBinding('encodeURI',
TGocciaNativeFunctionValue.Create(EncodeURICallback, 'encodeURI', 1), dtConst);
TGocciaNativeFunctionValue.Create(EncodeURICallback, 'encodeURI', 1), dtConst, True);

AScope.DefineLexicalBinding('decodeURI',
TGocciaNativeFunctionValue.Create(DecodeURICallback, 'decodeURI', 1), dtConst);
TGocciaNativeFunctionValue.Create(DecodeURICallback, 'decodeURI', 1), dtConst, True);

AScope.DefineLexicalBinding('encodeURIComponent',
TGocciaNativeFunctionValue.Create(EncodeURIComponentCallback, 'encodeURIComponent', 1), dtConst);
TGocciaNativeFunctionValue.Create(EncodeURIComponentCallback, 'encodeURIComponent', 1), dtConst, True);

AScope.DefineLexicalBinding('decodeURIComponent',
TGocciaNativeFunctionValue.Create(DecodeURIComponentCallback, 'decodeURIComponent', 1), dtConst);
TGocciaNativeFunctionValue.Create(DecodeURIComponentCallback, 'decodeURIComponent', 1), dtConst, True);
end;

procedure TGocciaGlobals.RegisterRuntimeGlobals;
begin
FScope.DefineLexicalBinding('queueMicrotask',
TGocciaNativeFunctionValue.Create(QueueMicrotaskCallback, 'queueMicrotask', 1), dtConst);
TGocciaNativeFunctionValue.Create(QueueMicrotaskCallback, 'queueMicrotask', 1), dtConst, True);

FScope.DefineLexicalBinding('structuredClone',
TGocciaNativeFunctionValue.Create(StructuredCloneCallback, 'structuredClone', 1), dtConst);
TGocciaNativeFunctionValue.Create(StructuredCloneCallback, 'structuredClone', 1), dtConst, True);
end;

{ NativeError ( message [ , options ] ) — §20.5.6.1.1 (shared by all NativeError constructors)
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.JSON.pas
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ constructor TGocciaJSONBuiltin.Create(const AName: string; const AScope: TGoccia
end;
RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);

AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

destructor TGocciaJSONBuiltin.Destroy;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.JSON5.pas
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ constructor TGocciaJSON5Builtin.Create(const AName: string;
end;

RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

destructor TGocciaJSON5Builtin.Destroy;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.JSONL.pas
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ constructor TGocciaJSONLBuiltin.Create(const AName: string;
end;

RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

destructor TGocciaJSONLBuiltin.Destroy;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.Math.pas
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ constructor TGocciaMath.Create(const AName: string; const AScope: TGocciaScope;
end;
RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);

AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

// §21.3.2.1 Math.abs ( x )
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.Performance.pas
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ constructor TGocciaPerformance.Create(const AName: string; const AScope: TGoccia
TGocciaObjectValue.InitializeSharedPrototype;

FBuiltinObject := TGocciaPerformanceValue.Create;
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

initialization
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.TOML.pas
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ constructor TGocciaTOMLBuiltin.Create(const AName: string;
end;

RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

destructor TGocciaTOMLBuiltin.Destroy;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.TSV.pas
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ constructor TGocciaTSVBuiltin.Create(const AName: string;
end;

RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

destructor TGocciaTSVBuiltin.Destroy;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.Temporal.pas
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ constructor TGocciaTemporalBuiltin.Create(const AName: string; const AScope: TGo
[pfConfigurable]);
RegisterMemberDefinitions(FTemporalNamespace, TemporalMembers);

AScope.DefineLexicalBinding(AName, FTemporalNamespace, dtLet);
AScope.DefineLexicalBinding(AName, FTemporalNamespace, dtLet, True);
finally
TGarbageCollector.Instance.RemoveTempRoot(FTemporalNamespace);
end;
Expand Down
6 changes: 3 additions & 3 deletions source/units/Goccia.Builtins.TestingLibrary.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@ constructor TGocciaTestAssertions.Create(const AName: string; const AScope: TGoc
GlobalObject.DefineProperty(AName,
TGocciaPropertyDescriptorData.Create(AValue, [pfWritable, pfConfigurable]))
else
AScope.DefineLexicalBinding(AName, AValue, dtConst);
AScope.DefineLexicalBinding(AName, AValue, dtConst, True);
end;

begin
Expand Down Expand Up @@ -2419,8 +2419,8 @@ constructor TGocciaTestAssertions.Create(const AName: string; const AScope: TGoc
// Private aliases used by generated Test262 wrappers. Some conformance
// tests intentionally declare globals named describe/test.
AScope.DefineLexicalBinding('__gocciaTest262Describe', DescribeFunction,
dtConst);
AScope.DefineLexicalBinding('__gocciaTest262Test', TestFunction, dtConst);
dtConst, True);
AScope.DefineLexicalBinding('__gocciaTest262Test', TestFunction, dtConst, True);

ItFunction := TGocciaNativeFunctionValue.Create(It, 'it', 2);
ConfigureTestFunction(ItFunction);
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.Builtins.YAML.pas
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ constructor TGocciaYAMLBuiltin.Create(const AName: string;
end;

RegisterMemberDefinitions(FBuiltinObject, FStaticMembers);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet);
AScope.DefineLexicalBinding(AName, FBuiltinObject, dtLet, True);
end;

destructor TGocciaYAMLBuiltin.Destroy;
Expand Down
16 changes: 8 additions & 8 deletions source/units/Goccia.Engine.pas
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ procedure TGocciaEngine.ExecuteShims;
LoadShimValue(FInterpreter, Shim)
else
FInterpreter.GlobalScope.DefineLexicalBinding(Shim.Name,
LoadShimValue(FInterpreter, Shim), dtConst);
LoadShimValue(FInterpreter, Shim), dtConst, True);
end;
end;

Expand Down Expand Up @@ -745,7 +745,7 @@ procedure TGocciaEngine.RegisterBuiltIns;
FBuiltinGlobalString := TGocciaGlobalString.Create(CONSTRUCTOR_STRING, Scope, ThrowError);
FBuiltinGlobals := TGocciaGlobals.Create('Globals', Scope, ThrowError);
FBuiltinDisposableStack := TGocciaBuiltinDisposableStack.Create('DisposableStack', Scope, ThrowError);
Scope.DefineLexicalBinding(CONSTRUCTOR_ITERATOR, TGocciaIteratorValue.CreateGlobalObject, dtConst);
Scope.DefineLexicalBinding(CONSTRUCTOR_ITERATOR, TGocciaIteratorValue.CreateGlobalObject, dtConst, True);
RegisterBuiltinConstructors;
end;

Expand Down Expand Up @@ -892,12 +892,12 @@ procedure TGocciaEngine.RegisterBuiltinConstructors;
if Assigned(FBuiltinArrayBuffer) then
for Key in FBuiltinArrayBuffer.BuiltinObject.GetAllPropertyNames do
ArrayBufferConstructor.SetProperty(Key, FBuiltinArrayBuffer.BuiltinObject.GetProperty(Key));
FInterpreter.GlobalScope.DefineLexicalBinding(CONSTRUCTOR_ARRAY_BUFFER, ArrayBufferConstructor, dtConst);
FInterpreter.GlobalScope.DefineLexicalBinding(CONSTRUCTOR_ARRAY_BUFFER, ArrayBufferConstructor, dtConst, True);

SharedArrayBufferConstructor := TGocciaSharedArrayBufferClassValue.Create(CONSTRUCTOR_SHARED_ARRAY_BUFFER, nil);
TGocciaSharedArrayBufferValue.ExposePrototype(SharedArrayBufferConstructor);
SharedArrayBufferConstructor.Prototype.Prototype := ObjectConstructor.Prototype;
FInterpreter.GlobalScope.DefineLexicalBinding(CONSTRUCTOR_SHARED_ARRAY_BUFFER, SharedArrayBufferConstructor, dtConst);
FInterpreter.GlobalScope.DefineLexicalBinding(CONSTRUCTOR_SHARED_ARRAY_BUFFER, SharedArrayBufferConstructor, dtConst, True);

// Create %TypedArray% intrinsic (not globally exposed per spec §23.2.1)
FTypedArrayIntrinsic := TGocciaClassValue.Create('TypedArray', nil);
Expand Down Expand Up @@ -992,7 +992,7 @@ procedure TGocciaEngine.RegisterBuiltinConstructors;
TGocciaClassValue.PatchDefaultPrototype(NumberConstructor);
TGocciaClassValue.PatchDefaultPrototype(BooleanConstructor);
TGocciaClassValue.PatchDefaultPrototype(FunctionConstructor);
FInterpreter.GlobalScope.DefineLexicalBinding('Function', FunctionConstructor, dtConst);
FInterpreter.GlobalScope.DefineLexicalBinding('Function', FunctionConstructor, dtConst, True);

// ES2026 §20.4.3: Symbol.prototype's [[Prototype]] is %Object.prototype%
if Assigned(TGocciaSymbolValue.SharedPrototype) then
Expand Down Expand Up @@ -1048,7 +1048,7 @@ procedure TGocciaEngine.RegisterTypedArrayConstructor(const AName: string; const
TGocciaTypedArrayValue.SetUint8Prototype(TAConstructor.Prototype);
end;

FInterpreter.GlobalScope.DefineLexicalBinding(AName, TAConstructor, dtConst);
FInterpreter.GlobalScope.DefineLexicalBinding(AName, TAConstructor, dtConst, True);
end;

procedure TGocciaEngine.RegisterGlobalThis;
Expand Down Expand Up @@ -1084,7 +1084,7 @@ procedure TGocciaEngine.RegisterGlobalThis;
if Scope.ContainsOwnLexicalBinding('globalThis') then
Scope.ForceUpdateBinding('globalThis', GlobalThisObj)
else
Scope.DefineLexicalBinding('globalThis', GlobalThisObj, dtConst);
Scope.DefineLexicalBinding('globalThis', GlobalThisObj, dtConst, True);

// ES2026 §9.1.2.5 NewGlobalEnvironment: a global Environment Record's
// [[GlobalThisValue]] is the global object. Top-level `this` resolves
Expand Down Expand Up @@ -1150,7 +1150,7 @@ procedure TGocciaEngine.RegisterGocciaScriptGlobal;
GocciaObj.AssignProperty('gc', GCFunc);

FGocciaGlobal := GocciaObj;
FInterpreter.GlobalScope.DefineLexicalBinding('Goccia', FGocciaGlobal, dtConst);
FInterpreter.GlobalScope.DefineLexicalBinding('Goccia', FGocciaGlobal, dtConst, True);
end;

function TGocciaEngine.GetResolver: TGocciaModuleResolver;
Expand Down
2 changes: 1 addition & 1 deletion source/units/Goccia.ObjectModel.Engine.pas
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ procedure RegisterTypeDefinition(const AScope: TGocciaScope;
ASpeciesGetter, 'get [Symbol.species]', 0),
nil, [pfConfigurable]));

AScope.DefineLexicalBinding(ATypeDefinition.ConstructorName, AConstructor, dtConst);
AScope.DefineLexicalBinding(ATypeDefinition.ConstructorName, AConstructor, dtConst, True);
end;

end.
2 changes: 1 addition & 1 deletion source/units/Goccia.Runtime.pas
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ procedure TGocciaRuntimeExtension.RegisterRuntimeConstructors;
begin
PerformanceConstructor := TGocciaPerformance.CreateInterfaceObject;
FEngine.Interpreter.GlobalScope.DefineLexicalBinding(
CONSTRUCTOR_PERFORMANCE, PerformanceConstructor, dtConst);
CONSTRUCTOR_PERFORMANCE, PerformanceConstructor, dtConst, True);
end;
end;

Expand Down
1 change: 1 addition & 0 deletions source/units/Goccia.Scope.BindingMap.pas
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ TLexicalBinding = record
Value: TGocciaValue;
DeclarationType: TGocciaDeclarationType;
Initialized: Boolean;
BuiltIn: Boolean;
{ Strict-types annotation enforced on every assignment. Default
sltUntyped means no enforcement (typical untyped binding). }
TypeHint: TGocciaLocalType;
Expand Down
Loading
Loading