Created
January 30, 2015 16:46
-
-
Save adsr/8117371588b70ce9f712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/hphp/runtime/vm/unit-inl.h b/hphp/runtime/vm/unit-inl.h | |
| index a678af3..5ce8ef6 100644 | |
| --- a/hphp/runtime/vm/unit-inl.h | |
| +++ b/hphp/runtime/vm/unit-inl.h | |
| @@ -48,20 +48,24 @@ inline void SourceLoc::setLoc(const Location* l) { | |
| inline bool SourceLoc::same(const SourceLoc* l) const { | |
| return (this == l) || | |
| (line0 == l->line0 && char0 == l->char0 && | |
| line1 == l->line1 && char1 == l->char1); | |
| } | |
| inline bool SourceLoc::operator==(const SourceLoc& l) const { | |
| return same(&l); | |
| } | |
| +inline bool SourceLoc::operator!=(const SourceLoc& l) const { | |
| + return !same(&l); | |
| +} | |
| + | |
| /////////////////////////////////////////////////////////////////////////////// | |
| // Location tables. | |
| template<typename T> | |
| Offset TableEntry<T>::pastOffset() const { | |
| return m_pastOffset; | |
| } | |
| template<typename T> | |
| T TableEntry<T>::val() const { | |
| diff --git a/hphp/runtime/vm/unit.cpp b/hphp/runtime/vm/unit.cpp | |
| index 3a4edb5..51206c9 100644 | |
| --- a/hphp/runtime/vm/unit.cpp | |
| +++ b/hphp/runtime/vm/unit.cpp | |
| @@ -599,21 +599,21 @@ Class* Unit::defClass(const PreClass* preClass, | |
| if (auto current = nameList->getCachedTypeAlias()) { | |
| FrameRestore fr(preClass); | |
| raise_error("Cannot declare class with the same name (%s) as an " | |
| "existing type", current->name->data()); | |
| return nullptr; | |
| } | |
| // If there was already a class declared with DefClass, check if | |
| // it's compatible. | |
| if (Class* cls = nameList->getCachedClass()) { | |
| - if (cls->preClass() != preClass) { | |
| + if (cls->preClass() != preClass) { // This? | |
| if (failIsFatal) { | |
| FrameRestore fr(preClass); | |
| raise_error("Class already declared: %s", preClass->name()->data()); | |
| } | |
| return nullptr; | |
| } | |
| return cls; | |
| } | |
| // Get a compatible Class, and add it to the list of defined classes. | |
| diff --git a/hphp/runtime/vm/unit.h b/hphp/runtime/vm/unit.h | |
| index 0b86083..61eab83 100644 | |
| --- a/hphp/runtime/vm/unit.h | |
| +++ b/hphp/runtime/vm/unit.h | |
| @@ -84,20 +84,21 @@ struct SourceLoc { | |
| /* | |
| * Set to a parser Location. | |
| */ | |
| void setLoc(const Location* l); | |
| /* | |
| * Equality. | |
| */ | |
| bool same(const SourceLoc* l) const; | |
| bool operator==(const SourceLoc& l) const; | |
| + bool operator!=(const SourceLoc& l) const; | |
| /* | |
| * Start and end lines and characters. | |
| * | |
| * The default {1, 1, 1, 1} is an invalid sentinel value. | |
| */ | |
| int line0{1}; | |
| int char0{1}; | |
| int line1{1}; | |
| int char1{1}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment