Closed frankeld closed 2 years ago
Wow. Wonder if this is a PHP-ism.
// The keyword namespace before a name should be parsed as
// "the current namespace we are in", essentially a no op.
// example:
// namespace\f1(); should be parsed as a call to the function f1 in
// the current namespace.
a\namespace\b();
namespace\a\b();
{
"kind": "script",
"script_declarations": [
{
"kind": "expression_statement",
"expression_statement_expression": {
"kind": "function_call_expression",
"function_call_receiver": {
"kind": "qualified_name",
"qualified_name_parts": [
{
"name": "a"
},
{
"name": "namespace"
},
{
"name": "b"
}
]
}
}
},
{
"kind": "expression_statement",
"expression_statement_expression": {
"kind": "function_call_expression",
"function_call_receiver": {
"kind": "qualified_name",
"qualified_name_parts": [
"namespace",
{
"name": "a"
},
{
"name": "b"
}
]
}
}
}
]
}
It's indeed a PHP-ism 🙁
Relative names always resolve to the name with namespace replaced by the current namespace. If the name occurs in the global namespace, the namespace\ prefix is stripped. For example namespace\A inside namespace X\Y resolves to X\Y\A. The same name inside the global namespace resolves to A.
Case:
Expected Output:
Actual Output: