public ContextMetaData GetContextInfo(string contextName)
        {
            // try self-originated protected types first
            ContextMetaData localContext = locals.Contexts.Get(contextName);
            if (localContext != null) {
                return localContext;
            }

            try {
                Pair<ContextMetaData, string> pair = path.GetAnyModuleExpectSingle(contextName, moduleUses);
                if (pair != null) {
                    if (!isFireAndForget &&
                        !NameAccessModifierExtensions.Visible(
                            pair.First.ContextVisibility,
                            pair.First.ContextModuleName,
                            moduleName)) {
                        return null;
                    }

                    moduleDependencies.AddPathContext(contextName, pair.Second);
                    return pair.First;
                }
            }
            catch (PathException e) {
                throw CompileTimeResolverUtil.MakePathAmbiguous(PathRegistryObjectType.CONTEXT, contextName, e);
            }

            return null;
        }
Example #2
0
        public void NewContext(ContextMetaData detail)
        {
            if (!detail.ContextVisibility.IsModuleProvidedAccessModifier()) {
                throw new IllegalStateException("Invalid visibility for contexts");
            }

            string name = detail.ContextName;
            var existing = Contexts.Get(name);
            if (existing != null) {
                throw new IllegalStateException(
                    "A duplicate definition of contexts was detected for name '" + name + "'");
            }

            Contexts.Put(name, detail);
        }
Example #3
0
 public void RegisterContext(
     string contextName,
     ContextMetaData contextDetail)
 {
     moduleContexts.Put(contextName, contextDetail);
 }