private IBoundExpression ResolveOtherModuleInEnclosingProject(string name) { /* * Other Procedural Module in Enclosing Project namespace: An accessible function, * subroutine or property with a Property Get defined in a procedural module within the enclosing * project other than the enclosing module. */ var function = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, name, DeclarationType.Function); if (function != null) { return(new SimpleNameExpression(function, ExpressionClassification.Function, _expression)); } var subroutine = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, name, DeclarationType.Procedure); if (subroutine != null) { return(new SimpleNameExpression(subroutine, ExpressionClassification.Subroutine, _expression)); } var propertyGet = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, name, DeclarationType.PropertyGet); if (propertyGet != null) { return(new SimpleNameExpression(propertyGet, ExpressionClassification.Property, _expression)); } return(null); }
private IBoundExpression ResolveMemberInReferencedProject(bool lExpressionIsEnclosingProject, IBoundExpression lExpression, string name, Declaration referencedProject, DeclarationType memberType) { /* * The project does not have an accessible module named <unrestricted-name> and exactly one of * the procedural modules within the project contains a UDT or Enum definition named * <unrestricted-name>. In this case, the member access expression is classified as a type and * refers to the specified UDT or enum. */ if (lExpressionIsEnclosingProject) { var foundType = _declarationFinder.FindMemberEnclosingModule(_module, _parent, name, memberType); if (foundType != null) { return(new MemberAccessExpression(foundType, ExpressionClassification.Type, _expression, _unrestrictedNameContext, lExpression)); } var accessibleType = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, name, memberType); if (accessibleType != null) { return(new MemberAccessExpression(accessibleType, ExpressionClassification.Type, _expression, _unrestrictedNameContext, lExpression)); } } else { var referencedProjectType = _declarationFinder.FindMemberReferencedProject(_project, _module, _parent, referencedProject, name, memberType); if (referencedProjectType != null) { return(new MemberAccessExpression(referencedProjectType, ExpressionClassification.Type, _expression, _unrestrictedNameContext, lExpression)); } } return(null); }
private IBoundExpression ResolveMemberInReferencedProject(bool lExpressionIsEnclosingProject, Declaration referencedProject, DeclarationType memberType, ExpressionClassification classification) { if (lExpressionIsEnclosingProject) { var foundType = _declarationFinder.FindMemberEnclosingModule(_module, _parent, _name, memberType); if (foundType != null) { return(new MemberAccessExpression(foundType, classification, _context, _unrestrictedNameContext, _lExpression)); } var accessibleType = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, memberType); if (accessibleType != null) { return(new MemberAccessExpression(accessibleType, classification, _context, _unrestrictedNameContext, _lExpression)); } } else { var referencedProjectType = _declarationFinder.FindMemberReferencedProject(_project, _module, _parent, referencedProject, _name, memberType); if (referencedProjectType != null) { return(new MemberAccessExpression(referencedProjectType, classification, _context, _unrestrictedNameContext, _lExpression)); } } return(null); }
private IBoundExpression ResolveOtherModuleInEnclosingProject(string name) { /* Namespace tier 3: * Other Module in Enclosing Project namespace: An accessible UDT or Enum type defined in a * procedural module or class module within the enclosing project other than the enclosing module. */ var accessibleUdt = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, name, DeclarationType.UserDefinedType); if (accessibleUdt != null) { return(new SimpleNameExpression(accessibleUdt, ExpressionClassification.Type, _expression)); } var accessibleType = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, name, DeclarationType.Enumeration); if (accessibleType != null) { return(new SimpleNameExpression(accessibleType, ExpressionClassification.Type, _expression)); } return(null); }
private IBoundExpression ResolveOtherProceduralModuleEnclosingProjectNamespace() { /* Namespace tier 4: * Other Procedural Module in Enclosing Project namespace: An accessible variable, constant, * Enum type, Enum member, property, function or subroutine defined in a procedural module * within the enclosing project other than the enclosing module. */ var accessibleVariable = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.Variable); if (IsValidMatch(accessibleVariable, _name)) { return(new SimpleNameExpression(accessibleVariable, ExpressionClassification.Variable, _context)); } var accessibleConstant = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.Constant); if (IsValidMatch(accessibleConstant, _name)) { return(new SimpleNameExpression(accessibleConstant, ExpressionClassification.Variable, _context)); } var accessibleType = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.EnumerationMember); if (IsValidMatch(accessibleType, _name)) { return(new SimpleNameExpression(accessibleType, ExpressionClassification.Type, _context)); } var accessibleMember = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.Enumeration); if (IsValidMatch(accessibleMember, _name)) { return(new SimpleNameExpression(accessibleMember, ExpressionClassification.Value, _context)); } var accessibleProperty = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, _propertySearchType); if (IsValidMatch(accessibleProperty, _name)) { return(new SimpleNameExpression(accessibleProperty, ExpressionClassification.Property, _context)); } var accessibleFunction = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.Function); if (IsValidMatch(accessibleFunction, _name)) { return(new SimpleNameExpression(accessibleFunction, ExpressionClassification.Function, _context)); } var accessibleSubroutine = _declarationFinder.FindMemberEnclosedProjectWithoutEnclosingModule(_project, _module, _parent, _name, DeclarationType.Procedure); if (IsValidMatch(accessibleSubroutine, _name)) { return(new SimpleNameExpression(accessibleSubroutine, ExpressionClassification.Subroutine, _context)); } return(null); }