Просмотр исходного кода

HPCC-18970 Clean up existing remote scope file resolution

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 7 лет назад
Родитель
Сommit
a57f66b84a
4 измененных файлов с 19 добавлено и 7 удалено
  1. 2 0
      ecl/hql/hql.hpp
  2. 2 1
      ecl/hql/hqlcollect.cpp
  3. 1 1
      ecl/hql/hqlexpr.cpp
  4. 14 5
      ecl/hql/hqlrepository.cpp

+ 2 - 0
ecl/hql/hql.hpp

@@ -177,6 +177,7 @@ public:
 };
 
 interface IFileContents;
+interface IEclSource;
 interface IEclRepository: public IInterface
 {
     virtual IHqlScope * queryRootScope() = 0;
@@ -188,6 +189,7 @@ interface IEclRepositoryCallback : public IEclRepository
 //Should only be called and implemented for concrete repositories
     virtual bool loadModule(IHqlRemoteScope * rScope, IErrorReceiver * errs, bool forceAll) = 0;
     virtual IHqlExpression * loadSymbol(IHqlRemoteScope *scope, IIdAtom * searchName) = 0;
+    virtual IEclSource * getSource(IHqlRemoteScope *scope, IIdAtom * searchName) = 0;
 };
 
 interface ICodegenContextCallback : public IInterface

+ 2 - 1
ecl/hql/hqlcollect.cpp

@@ -104,7 +104,8 @@ protected:
 IEclSource * CEclCollection::getSource(IIdAtom * searchName)
 {
     ensureChildren();
-    return find(searchName);
+    IEclSource * match = find(searchName);
+    return LINK(match);
 }
 
 IEclSourceIterator * CEclCollection::getContained()

+ 1 - 1
ecl/hql/hqlexpr.cpp

@@ -8723,7 +8723,7 @@ IHqlExpression * CHqlRemoteScope::repositoryLoadSymbol(IIdAtom * attrName)
         return NULL;
 
     OwnedHqlExpr symbol = ownerRepository->loadSymbol(this, attrName);
-    if(!symbol || !symbol->hasText())
+    if(!symbol || ((symbol->getOperator() == no_nobody) && !symbol->hasText()))
         return NULL;
 
     return symbol.getClear();

+ 14 - 5
ecl/hql/hqlrepository.cpp

@@ -238,9 +238,10 @@ public:
     }
     IMPLEMENT_IINTERFACE
 
-    virtual IHqlScope * queryRootScope() { return rootScope->queryScope(); }
-    virtual bool loadModule(IHqlRemoteScope *scope, IErrorReceiver *errs, bool forceAll);
-    virtual IHqlExpression * loadSymbol(IHqlRemoteScope *scope, IIdAtom * searchName);
+    virtual IHqlScope * queryRootScope() override { return rootScope->queryScope(); }
+    virtual bool loadModule(IHqlRemoteScope *scope, IErrorReceiver *errs, bool forceAll) override;
+    virtual IHqlExpression * loadSymbol(IHqlRemoteScope *scope, IIdAtom * searchName) override;
+    virtual IEclSource * getSource(IHqlRemoteScope *scope, IIdAtom * searchName) override; // possibly change to IEclSource * parent
 
 protected:
     IHqlExpression * createSymbol(IHqlRemoteScope * rScope, IEclSource * source);
@@ -270,10 +271,18 @@ bool CNewEclRepository::loadModule(IHqlRemoteScope * rScope, IErrorReceiver *err
     return true;
 }
 
-IHqlExpression * CNewEclRepository::loadSymbol(IHqlRemoteScope * rScope, IIdAtom * searchName)
+IEclSource * CNewEclRepository::getSource(IHqlRemoteScope * rScope, IIdAtom * searchName)
 {
     IEclSource * parent = rScope->queryEclSource();
-    Owned<IEclSource> source = collection->getSource(parent, searchName);
+    return collection->getSource(parent, searchName);
+}
+
+
+IHqlExpression * CNewEclRepository::loadSymbol(IHqlRemoteScope * rScope, IIdAtom * searchName)
+{
+    Owned<IEclSource> source = getSource(rScope, searchName);
+    if (!source)
+        return nullptr;
     return createSymbol(rScope, source);
 }