Skip to content

Commit 94a54a1

Browse files
ondrejmirtesclaude
andcommitted
Register ScopeOps by its generated signatures
ScopeOps spelled its arginfo by hand: class-typed parameters were erased to object, no method declared a return type, and the optional parameters of invalidateExpressionEntries() and shouldInvalidateExpression() carried no default value — so a named-argument call skipping one (`keepPropertyFetches: true`) failed with an ArgumentCountError natively while the twin accepted it. The methods now register by the generated sig:: declarations, which carry the twin's types and defaults. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Fdg8n3eEi4ZoXa4dA2k4A
1 parent 1f4b925 commit 94a54a1

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

‎turbo-ext/src/ScopeOps.cpp‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include "support.h"
1616
#include "generated/ScopeOps.h"
17+
18+
namespace sigs = ptdecl::ScopeOps::sig;
1719
#include "zv.h"
1820
#include "TypeOps.h"
1921

@@ -1817,7 +1819,7 @@ void pt_register_scope_ops()
18171819
ptdecl::ScopeOps::declareClass(cls);
18181820
ptdecl::ScopeOps::declareProperties(cls);
18191821

1820-
cls.method("mergeVariableHolders", reg::PublicStatic, 2, { reg::arrayArg("ourVariableTypeHolders"), reg::arrayArg("theirVariableTypeHolders"), reg::any("differingKeys", true) }, [](INTERNAL_FUNCTION_PARAMETERS) {
1822+
cls.method(sigs::mergeVariableHolders, [](INTERNAL_FUNCTION_PARAMETERS) {
18211823
HashTable *ours, *theirs;
18221824
zval *differing_zv = NULL;
18231825
if (!zp::parse<zp::Ht, zp::Ht, zp::Opt<zp::Zval>>(execute_data, ours, theirs, differing_zv)) RETURN_THROWS();
@@ -1837,21 +1839,21 @@ void pt_register_scope_ops()
18371839
result.intoReturnValue(return_value);
18381840
});
18391841

1840-
cls.method("finishMerge", reg::PublicStatic, 5, { reg::arrayArg("mergedExpressionTypes"), reg::arrayArg("ourExpressionTypes"), reg::arrayArg("theirExpressionTypes"), reg::arrayArg("ourNativeExpressionTypes"), reg::arrayArg("theirNativeExpressionTypes") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1842+
cls.method(sigs::finishMerge, [](INTERNAL_FUNCTION_PARAMETERS) {
18411843
HashTable *merged, *ours_expr, *theirs_expr, *ours_native, *theirs_native;
18421844
if (!zp::parse<zp::Ht, zp::Ht, zp::Ht, zp::Ht, zp::Ht>(execute_data, merged, ours_expr, theirs_expr, ours_native, theirs_native)) RETURN_THROWS();
18431845
zv::Val result = ScopeOps::finishMerge(zv::TableRef(merged), zv::TableRef(ours_expr), zv::TableRef(theirs_expr), zv::TableRef(ours_native), zv::TableRef(theirs_native));
18441846
if (UNEXPECTED(result.isUndef())) RETURN_THROWS();
18451847
result.intoReturnValue(return_value);
18461848
});
18471849

1848-
cls.method("intersectConditionalExpressions", reg::PublicStatic, 2, { reg::arrayArg("ourConditionalExpressions"), reg::arrayArg("theirConditionalExpressions") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1850+
cls.method(sigs::intersectConditionalExpressions, [](INTERNAL_FUNCTION_PARAMETERS) {
18491851
HashTable *ours, *theirs;
18501852
if (!zp::parse<zp::Ht, zp::Ht>(execute_data, ours, theirs)) RETURN_THROWS();
18511853
ScopeOps::intersectConditionalExpressions(zv::TableRef(ours), zv::TableRef(theirs)).intoReturnValue(return_value);
18521854
});
18531855

1854-
cls.method("invalidateExpressionEntries", reg::PublicStatic, 9, { reg::objectArg("scope"), reg::objectArg("exprPrinter"), reg::stringArg("exprStringToInvalidate"), reg::objectArg("expressionToInvalidate"), reg::boolArg("requireMoreCharacters"), reg::objectArg("invalidatingClass", true), reg::arrayArg("expressionTypes"), reg::arrayArg("nativeExpressionTypes"), reg::arrayArg("conditionalExpressions"), reg::boolArg("keepPropertyFetches") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1856+
cls.method(sigs::invalidateExpressionEntries, [](INTERNAL_FUNCTION_PARAMETERS) {
18551857
zval *scope, *expr_printer, *expr_to_invalidate, *invalidating_class = NULL;
18561858
zend_string *invalidate_str;
18571859
bool require_more_characters;
@@ -1876,7 +1878,7 @@ void pt_register_scope_ops()
18761878
result.intoReturnValue(return_value);
18771879
});
18781880

1879-
cls.method("shouldInvalidateExpression", reg::PublicStatic, 6, { reg::objectArg("scope"), reg::objectArg("exprPrinter"), reg::stringArg("exprStringToInvalidate"), reg::objectArg("exprToInvalidate"), reg::objectArg("expr"), reg::stringArg("exprString"), reg::boolArg("requireMoreCharacters"), reg::objectArg("invalidatingClass", true), reg::boolArg("keepPropertyFetches") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1881+
cls.method(sigs::shouldInvalidateExpression, [](INTERNAL_FUNCTION_PARAMETERS) {
18801882
zval *scope, *expr_printer, *expr_to_invalidate, *expr, *invalidating_class = NULL;
18811883
zend_string *invalidate_str, *expr_string;
18821884
bool require_more_characters = false;
@@ -1900,39 +1902,39 @@ void pt_register_scope_ops()
19001902
RETURN_BOOL(result);
19011903
});
19021904

1903-
cls.method("getIntertwinedRefRootVariableName", reg::PublicStatic, 1, { reg::objectArg("expr") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1905+
cls.method(sigs::getIntertwinedRefRootVariableName, [](INTERNAL_FUNCTION_PARAMETERS) {
19041906
zval *expr;
19051907
if (!zp::parse<zp::Obj>(execute_data, expr)) RETURN_THROWS();
19061908
zv::Val result = ScopeOps::getIntertwinedRefRootVariableName(Z_OBJ_P(expr));
19071909
if (UNEXPECTED(result.isUndef())) RETURN_THROWS();
19081910
result.intoReturnValue(return_value);
19091911
});
19101912

1911-
cls.method("matchConditionalExpressions", reg::PublicStatic, 2, { reg::arrayArg("conditionalExpressions"), reg::arrayArg("specifiedExpressions") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1913+
cls.method(sigs::matchConditionalExpressions, [](INTERNAL_FUNCTION_PARAMETERS) {
19121914
HashTable *conditional, *specified_input;
19131915
if (!zp::parse<zp::Ht, zp::Ht>(execute_data, conditional, specified_input)) RETURN_THROWS();
19141916
zv::Val result = ScopeOps::matchConditionalExpressions(zv::TableRef(conditional), zv::TableRef(specified_input));
19151917
if (UNEXPECTED(result.isUndef())) RETURN_THROWS();
19161918
result.intoReturnValue(return_value);
19171919
});
19181920

1919-
cls.method("createConditionalExpressions", reg::PublicStatic, 5, { reg::arrayArg("conditionalExpressions"), reg::arrayArg("ourExpressionTypes"), reg::arrayArg("theirExpressionTypes"), reg::arrayArg("mergedExpressionTypes"), reg::arrayArg("differingKeys") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1921+
cls.method(sigs::createConditionalExpressions, [](INTERNAL_FUNCTION_PARAMETERS) {
19201922
HashTable *conditional, *ours, *theirs, *merged, *differing_keys;
19211923
if (!zp::parse<zp::Ht, zp::Ht, zp::Ht, zp::Ht, zp::Ht>(execute_data, conditional, ours, theirs, merged, differing_keys)) RETURN_THROWS();
19221924
zv::Val result = ScopeOps::createConditionalExpressions(zv::TableRef(conditional), zv::TableRef(ours), zv::TableRef(theirs), zv::TableRef(merged), zv::TableRef(differing_keys));
19231925
if (UNEXPECTED(result.isUndef())) RETURN_THROWS();
19241926
result.intoReturnValue(return_value);
19251927
});
19261928

1927-
cls.method("nodeKey", reg::PublicStatic, 2, { reg::objectArg("node"), reg::objectArg("exprPrinter") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1929+
cls.method(sigs::nodeKey, [](INTERNAL_FUNCTION_PARAMETERS) {
19281930
zval *node, *expr_printer;
19291931
if (!zp::parse<zp::Obj, zp::Obj>(execute_data, node, expr_printer)) RETURN_THROWS();
19301932
zv::Val result = ScopeOps::nodeKey(Z_OBJ_P(node), expr_printer);
19311933
if (UNEXPECTED(result.isUndef())) RETURN_THROWS();
19321934
result.intoReturnValue(return_value);
19331935
});
19341936

1935-
cls.method("getTypeFromCache", reg::PublicStatic, 3, { reg::objectArg("scope"), reg::objectArg("node"), reg::any("key", true) }, [](INTERNAL_FUNCTION_PARAMETERS) {
1937+
cls.method(sigs::getTypeFromCache, [](INTERNAL_FUNCTION_PARAMETERS) {
19361938
zval *scope, *node, *key_out;
19371939
if (!zp::parse<zp::Obj, zp::Obj, zp::Zval>(execute_data, scope, node, key_out)) RETURN_THROWS();
19381940
zend_string *key = NULL;
@@ -1949,7 +1951,7 @@ void pt_register_scope_ops()
19491951
result.intoReturnValue(return_value);
19501952
});
19511953

1952-
cls.method("hasVariableType", reg::PublicStatic, 2, { reg::objectArg("scope"), reg::stringArg("variableName") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1954+
cls.method(sigs::hasVariableType, [](INTERNAL_FUNCTION_PARAMETERS) {
19531955
zval *scope;
19541956
zend_string *variable_name;
19551957
if (!zp::parse<zp::Obj, zp::Str>(execute_data, scope, variable_name)) RETURN_THROWS();
@@ -1958,7 +1960,7 @@ void pt_register_scope_ops()
19581960
result.intoReturnValue(return_value);
19591961
});
19601962

1961-
cls.method("scopeWith", reg::PublicStatic, 9, { reg::objectArg("scope"), reg::arrayArg("expressionTypes"), reg::arrayArg("nativeExpressionTypes"), reg::arrayArg("conditionalExpressions"), reg::arrayArg("currentlyAssignedExpressions"), reg::arrayArg("currentlyAllowedUndefinedExpressions"), reg::arrayArg("inFunctionCallsStack"), reg::boolArg("inFirstLevelStatement"), reg::boolArg("afterExtractCall") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1963+
cls.method(sigs::scopeWith, [](INTERNAL_FUNCTION_PARAMETERS) {
19621964
zval *scope;
19631965
HashTable *expression_types, *native_expression_types, *conditional_expressions;
19641966
HashTable *currently_assigned, *currently_allowed_undefined, *in_function_calls_stack;
@@ -1979,7 +1981,7 @@ void pt_register_scope_ops()
19791981
result.intoReturnValue(return_value);
19801982
});
19811983

1982-
cls.method("invalidateMethodsOnExpression", reg::PublicStatic, 4, { reg::objectArg("exprPrinter"), reg::stringArg("exprStringToInvalidate"), reg::arrayArg("expressionTypes"), reg::arrayArg("nativeExpressionTypes") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1984+
cls.method(sigs::invalidateMethodsOnExpression, [](INTERNAL_FUNCTION_PARAMETERS) {
19831985
zval *expr_printer;
19841986
zend_string *invalidate_str;
19851987
HashTable *expression_types, *native_expression_types;
@@ -1990,7 +1992,7 @@ void pt_register_scope_ops()
19901992
result.intoReturnValue(return_value);
19911993
});
19921994

1993-
cls.method("expressionTypeByKey", reg::PublicStatic, 3, { reg::objectArg("scope"), reg::objectArg("node"), reg::stringArg("exprString") }, [](INTERNAL_FUNCTION_PARAMETERS) {
1995+
cls.method(sigs::expressionTypeByKey, [](INTERNAL_FUNCTION_PARAMETERS) {
19941996
zval *scope, *node;
19951997
zend_string *expr_string;
19961998
if (!zp::parse<zp::Obj, zp::Obj, zp::Str>(execute_data, scope, node, expr_string)) RETURN_THROWS();
@@ -1999,7 +2001,7 @@ void pt_register_scope_ops()
19992001
result.intoReturnValue(return_value);
20002002
});
20012003

2002-
cls.method("hasExpressionType", reg::PublicStatic, 3, { reg::objectArg("scope"), reg::objectArg("node"), reg::objectArg("exprPrinter") }, [](INTERNAL_FUNCTION_PARAMETERS) {
2004+
cls.method(sigs::hasExpressionType, [](INTERNAL_FUNCTION_PARAMETERS) {
20032005
zval *scope, *node, *expr_printer;
20042006
if (!zp::parse<zp::Obj, zp::Obj, zp::Obj>(execute_data, scope, node, expr_printer)) RETURN_THROWS();
20052007
zv::Val result = ScopeOps::hasExpressionType(scope, Z_OBJ_P(node), expr_printer);

0 commit comments

Comments
 (0)