/* position <= 0 means we don't really care about it */ public IdentifierInfo LookupIdentifierInfo(string identifier, int scopeId, int position, bool isConstant = false) { IdentifierInfo identifierInfo; ScopeInfo scopeInfo; var identLocation = new IdentifierLocation { identifierName = identifier, scopeId = scopeId }; while (!IdentInfoDictionary.TryGetValue(identLocation, out identifierInfo) || (isConstant == true && identifierInfo.isConstant != isConstant) || (!identifierInfo.isFunctionType && position > 0 && identifierInfo.position > position)) { var scopeExists = ScopeInfoDictionary. TryGetValue(identLocation.scopeId, out scopeInfo); if (!scopeExists || scopeInfo.parent == null) { return(null); } identLocation.scopeId = scopeInfo.parent.id; } return(identifierInfo); }
public IdentifierInfo LookupFunctionInfo(string identifier, int scopeId, List <TypeAST> argsType) { IdentifierInfo identifierInfo; ScopeInfo scopeInfo; var identLocation = new IdentifierLocation { identifierName = identifier, scopeId = scopeId }; while (!IdentInfoDictionary.TryGetValue(identLocation, out identifierInfo) || identifierInfo.isFunctionType == false || InvalidArgs(identifierInfo, argsType)) { var scopeExists = ScopeInfoDictionary. TryGetValue(identLocation.scopeId, out scopeInfo); if (!scopeExists || scopeInfo.parent == null) { return(null); } identLocation.scopeId = scopeInfo.parent.id; } return(identifierInfo); }