The containerContextDependent property specifies that references inside a standalone function (see Functions) are to be resolved with respect to the container (the generatable part) in which the function ultimately (after generation) resides. This means that the declarations and imports of the container are used to resolve references during the generation process. The standalone function itself, even though a top-level part, does not have to import all the packages that are necessary to resolve references as long as the final container does so. For example, you can use this property when the function is used in more than one program, and variable names are resolved differently depending on the program that calls the function.
Use the containerContextDependent property with standalone functions only. EGL supports standalone functions for compatibility with programs like those created in VisualAge® Generator, where the language does not support libraries. Do not use standalone functions or the containerContextDependent property when writing new code.
package p; Program pgm {includeReferencedFunctions = yes} function main() standaloneFunc1(); end function functionInPgm() end end DataItem intInP int end
package p2; function standaloneFunc1 { containerContextDependent=yes } // reference to function resolves // because of containerContextDependent functionInPgm(); // reference to part resolves // because of containerContextDependent myVar intInP; end function standaloneFunc2 functionInPgm(); // reference cannot be resolved myVar intInP; // reference cannot be resolved end function standaloneFunc3 // reference to part resolves because // it is qualified by the package name myVar p.intInP; end
Platform | Issue |
---|---|
JavaScript generation | The property containerContextDependent is not supported. |