name in unset error

zend does this, we should too
Esse commit está contido em:
Paul Tarjan
2013-05-15 11:39:10 -07:00
commit de Sara Golemon
commit c0694a2ae9
4 arquivos alterados com 21 adições e 9 exclusões
+13 -8
Ver Arquivo
@@ -2491,8 +2491,7 @@ bool EmitterVisitor::visitImpl(ConstructPtr node) {
ExpressionListPtr exps(
static_pointer_cast<UnsetStatement>(node)->getExps());
for (int i = 0, n = exps->getCount(); i < n; i++) {
visit((*exps)[i]);
emitUnset(e);
emitVisitAndUnset(e, (*exps)[i]);
}
return false;
}
@@ -2598,15 +2597,13 @@ bool EmitterVisitor::visitImpl(ConstructPtr node) {
static_pointer_cast<ExpressionList>(exp));
if (exps->getListKind() == ExpressionList::ListKindParam) {
for (int i = 0, n = exps->getCount(); i < n; i++) {
visit((*exps)[i]);
emitUnset(e);
emitVisitAndUnset(e, (*exps)[i]);
}
e.Null();
return true;
}
}
visit(exp);
emitUnset(e);
emitVisitAndUnset(e, exp);
e.Null();
return true;
}
@@ -4509,7 +4506,8 @@ void EmitterVisitor::emitEmpty(Emitter& e) {
}
}
void EmitterVisitor::emitUnset(Emitter& e) {
void EmitterVisitor::emitUnset(Emitter& e,
ExpressionPtr exp /* = ExpressionPtr() */) {
if (checkIfStackEmpty("Unset*")) return;
emitClsIfSPropBase(e);
@@ -4527,8 +4525,10 @@ void EmitterVisitor::emitUnset(Emitter& e) {
case StackSym::CG: e.UnsetG(); break;
case StackSym::LS: // fall through
case StackSym::CS:
assert(exp);
e.String(
StringData::GetStaticString("Attempt to unset static property")
StringData::GetStaticString("Attempt to unset static property " +
exp->getText())
);
e.Fatal(0);
break;
@@ -4545,6 +4545,11 @@ void EmitterVisitor::emitUnset(Emitter& e) {
}
}
void EmitterVisitor::emitVisitAndUnset(Emitter& e, ExpressionPtr exp) {
visit(exp);
emitUnset(e, exp);
}
void EmitterVisitor::emitSet(Emitter& e) {
if (checkIfStackEmpty("Set*")) return;
+2 -1
Ver Arquivo
@@ -564,7 +564,8 @@ public:
void emitIsDouble(Emitter& e);
void emitIsBool(Emitter& e);
void emitEmpty(Emitter& e);
void emitUnset(Emitter& e);
void emitUnset(Emitter& e, ExpressionPtr exp = ExpressionPtr());
void emitVisitAndUnset(Emitter& e, ExpressionPtr exp);
void emitSet(Emitter& e);
void emitSetOp(Emitter& e, int op);
void emitBind(Emitter& e);
+5
Ver Arquivo
@@ -0,0 +1,5 @@
<?php
class Foo {
static $baz = 32;
}
unset(Foo::$baz);
+1
Ver Arquivo
@@ -0,0 +1 @@
HipHop Fatal error: Attempt to unset static property Foo::$baz in %s on line 5