fix nemo for namespaces
This code was using the old assumption that namespaced functions always started with a ##\##. Instead, lets do the same thing we do in the emitter. Closes #771
Esse commit está contido em:
@@ -14,8 +14,8 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "hphp/compiler/analysis/file_scope.h"
|
||||
#include "hphp/compiler/expression/constant_expression.h"
|
||||
#include "hphp/compiler/analysis/file_scope.h"
|
||||
#include "hphp/compiler/analysis/block_scope.h"
|
||||
#include "hphp/compiler/analysis/class_scope.h"
|
||||
#include "hphp/compiler/analysis/function_scope.h"
|
||||
@@ -117,11 +117,9 @@ bool ConstantExpression::canonCompare(ExpressionPtr e) const {
|
||||
// static analysis functions
|
||||
|
||||
Symbol *ConstantExpression::resolveNS(AnalysisResultConstPtr ar) {
|
||||
bool ns = m_name[0] == '\\';
|
||||
if (ns) m_name = m_name.substr(1);
|
||||
BlockScopeConstPtr block = ar->findConstantDeclarer(m_name);
|
||||
if (!block) {
|
||||
if (ns) {
|
||||
if (hadBackslash()) {
|
||||
int pos = m_name.rfind('\\');
|
||||
m_name = m_name.substr(pos + 1);
|
||||
block = ar->findConstantDeclarer(m_name);
|
||||
|
||||
@@ -247,12 +247,8 @@ void SimpleFunctionCall::setupScopes(AnalysisResultConstPtr ar) {
|
||||
FunctionScopePtr func;
|
||||
if (!m_class && m_className.empty()) {
|
||||
if (!m_dynamicInvoke) {
|
||||
bool namespaced = (m_name[0] == '\\');
|
||||
if (namespaced) {
|
||||
m_name = m_name.substr(1);
|
||||
}
|
||||
func = ar->findFunction(m_name);
|
||||
if (!func && namespaced) {
|
||||
if (!func && hadBackslash()) {
|
||||
int pos = m_name.rfind('\\');
|
||||
m_name = m_name.substr(pos + 1);
|
||||
func = ar->findFunction(m_name);
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário