Skip to content

Commit

Permalink
[HPHPi] Use ParserBase::IsClosureName to check closure name
Browse files Browse the repository at this point in the history
Summary:
Two places in HPHPi are changed to use ParserBase::IsClosureName to
check closure name to avoid ad-hoc code.

Test Plan: make fast_tests

Reviewers: mwilliams, qigao

Reviewed By: mwilliams

CC: hphp-diffs@lists, ps, mwilliams

Differential Revision: 351791
  • Loading branch information
myang authored and macvicar committed Nov 29, 2011
1 parent 87d42ed commit b33e07f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/runtime/eval/ast/function_statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int UserFunctionIdTable::getUserFunctionId(CStrRef func) {

int UserFunctionIdTable::GetUserFunctionId(CStrRef func) {
if (s_id >= RuntimeOption::MaxUserFunctionId) return -1;
if (func.data()[0] == '0') return -1; // closure
if (ParserBase::IsClosureName(func.data())) return -1;
if (strncmp(func.data(), "lambda_", 7) == 0) return -1; // create_function
return s_userFunctionIdTable->getUserFunctionId(func);
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/eval/parser/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ void Parser::onScalar(Token &out, int type, Token &scalar) {
if (type == T_FUNC_C) subtype = T_FUNC_C;
type = T_STRING;
stext = haveFunc() ? peekFunc()->name() : "";
if (stext[0] == '0') {
if (ParserBase::IsClosureName(stext)) {
stext = "{closure}";
}
break;
Expand Down

0 comments on commit b33e07f

Please sign in to comment.