| 942 | } |
| 943 | |
| 944 | Namespace *Namespace::find(StringTableEntry name, StringTableEntry package) |
| 945 | { |
| 946 | if (name == NULL && package == NULL) |
| 947 | return mGlobalNamespace; |
| 948 | |
| 949 | auto pair = std::make_pair(name, package); |
| 950 | auto pos = gNamespaceCache.find(pair); |
| 951 | if (pos != gNamespaceCache.end()) |
| 952 | return pos->second; |
| 953 | |
| 954 | Namespace *ret = (Namespace *)mAllocator.alloc(sizeof(Namespace)); |
| 955 | constructInPlace(ret); |
| 956 | ret->mPackage = package; |
| 957 | ret->mName = name; |
| 958 | ret->mNext = mNamespaceList; |
| 959 | mNamespaceList = ret; |
| 960 | |
| 961 | // insert into namespace cache. |
| 962 | gNamespaceCache[pair] = ret; |
| 963 | |
| 964 | return ret; |
| 965 | } |
| 966 | |
| 967 | bool Namespace::unlinkClass(Namespace *parent) |
| 968 | { |
no test coverage detected