private IBoundExpression ResolveEnclosingProjectNamespace() { /* Namespace tier 3: * Enclosing Project namespace: The enclosing project itself, a referenced project, or a * procedural module contained in the enclosing project. */ if (_declarationFinder.IsMatch(_project.ProjectName, _name)) { return(new SimpleNameExpression(_project, ExpressionClassification.Project, _context)); } var referencedProject = _declarationFinder.FindReferencedProject(_project, _name); if (referencedProject != null) { return(new SimpleNameExpression(referencedProject, ExpressionClassification.Project, _context)); } if (_module.DeclarationType == DeclarationType.ProceduralModule && _declarationFinder.IsMatch(_module.IdentifierName, _name)) { return(new SimpleNameExpression(_module, ExpressionClassification.ProceduralModule, _context)); } var proceduralModuleEnclosingProject = _declarationFinder.FindModuleEnclosingProjectWithoutEnclosingModule(_project, _module, _name, DeclarationType.ProceduralModule); if (proceduralModuleEnclosingProject != null) { return(new SimpleNameExpression(proceduralModuleEnclosingProject, ExpressionClassification.ProceduralModule, _context)); } var defaultInstanceVariableClass = _declarationFinder.FindDefaultInstanceVariableClassEnclosingProject(_project, _module, _name); if (defaultInstanceVariableClass != null) { return(new SimpleNameExpression(defaultInstanceVariableClass, ExpressionClassification.Type, _context)); } return(null); }
private IBoundExpression ResolveDefaultInstanceVariableClass(bool lExpressionIsEnclosingProject, Declaration referencedProject) { if (lExpressionIsEnclosingProject) { var defaultInstanceVariableClass = _declarationFinder.FindDefaultInstanceVariableClassEnclosingProject(_project, _module, _name); if (defaultInstanceVariableClass != null) { return(new MemberAccessExpression(defaultInstanceVariableClass, ExpressionClassification.Type, _context, _unrestrictedNameContext, _lExpression)); } } else { var defaultInstanceVariableClass = _declarationFinder.FindDefaultInstanceVariableClassReferencedProject(_project, _module, referencedProject, _name); if (defaultInstanceVariableClass != null) { return(new MemberAccessExpression(defaultInstanceVariableClass, ExpressionClassification.Type, _context, _unrestrictedNameContext, _lExpression)); } } return(null); }