public override AstType CreateShortType(IType fullType) { AlResolver csResolver; lock (resolver) { csResolver = resolver.GetResolverStateBefore(GetNode()); } var builder = new TypeSystemAstBuilder(csResolver); return(builder.ConvertType(fullType)); }
public ICodeContext ResolveContext(ParseInformation parseInfo, TextLocation location, ICompilation compilation, CancellationToken cancellationToken) { var csParseInfo = parseInfo as AlFullParseInformation; if (csParseInfo == null) throw new ArgumentException("Parse info does not have SyntaxTree"); AlUnresolvedFile unresolvedFile = csParseInfo.UnresolvedFile; var projectContents = compilation.Assemblies.Select(asm => asm.UnresolvedAssembly).OfType<IProjectContent>().ToList(); if (projectContents.All(pc => pc.GetFile(unresolvedFile.FileName) != unresolvedFile)) unresolvedFile = null; var syntaxTree = csParseInfo.SyntaxTree; var node = syntaxTree.GetNodeAt(location); if (node == null) return null; // null result is allowed; the parser service will substitute a dummy context var resolver = new AlAstResolver(compilation, syntaxTree, unresolvedFile); return resolver.GetResolverStateBefore(node); }
void HandleConstructorOrDestructor(AstNode constructorDeclaration) { Identifier nameToken = constructorDeclaration.GetChildByRole(Roles.Identifier); VisitChildrenUntil(constructorDeclaration, nameToken); var currentTypeDef = resolver.GetResolverStateBefore(constructorDeclaration).CurrentTypeDefinition; if (currentTypeDef != null && nameToken.Name == currentTypeDef.Name) { TColor color; if (TryGetTypeHighlighting(currentTypeDef.Kind, out color)) { Colorize(nameToken, color); } } VisitChildrenAfter(constructorDeclaration, nameToken); }