/// <summary> /// Creates a new BVE5 AST resolver. /// Use this overload if you are resolving within a complete BVE5 file. /// </summary> /// <param name="compilation">The current compilation.</param> /// <param name="syntaxTree">The syntax tree to be resolved.</param> /// <param name="unresolvedFile"> /// Optional: Result of <see cref="SyntaxTree.ToTypeSystem()"/> for the file being resolved. /// <para> /// This is used for setting up the context on the resolver. The unresolved file must be registered in the compilation. /// </para> /// <para> /// When a unresolvedFile is specified, the resolver will use the member's StartLocation/EndLocation to identify /// member declarations in the AST with members in the type system. /// When no unresolvedFile is specified (<c>null</c> value for this parameter), the resolver will instead compare the /// member's signature in the AST with the signature in the type system. /// </para> /// </param> public BVE5AstResolver(ICompilation compilation, SyntaxTree syntaxTree, BVE5UnresolvedFile unresolvedFile = null) { if(compilation == null) throw new ArgumentNullException("compilation"); if(syntaxTree == null) throw new ArgumentNullException("syntaxTree"); initial_resolver_state = new BVE5Resolver(compilation); root_node = syntaxTree; unresolved_file = unresolvedFile; resolve_visitor = new ResolveVisitor(initial_resolver_state, unresolvedFile); }
/// <summary> /// Creates a new BVE5 AST resolver. /// Use this overload if you are resolving code snippets (not necessarily complete files). /// </summary> /// <param name="resolver">The resolver state at the root node (to be more precise: just outside the root node).</param> /// <param name="rootNode">The root node of the tree to be resolved.</param> /// <param name="unresolvedFile"> /// Optional: Result of <see cref="SyntaxTree.ToTypeSystem()"/> for the file being resolved. /// <para> /// This is used for setting up the context on the resolver. The unresolved file must be registered in the compilation. /// </para> /// <para> /// When a unresolvedFile is specified, the resolver will use the member's StartLocation/EndLocation to identify /// member declarations in the AST with members in the type system. /// When no unresolvedFile is specified (<c>null</c> value for this parameter), the resolver will instead compare the /// member's signature in the AST with the signature in the type system. /// </para> /// </param> public BVE5AstResolver(BVE5Resolver resolver, AstNode rootNode, BVE5UnresolvedFile unresolvedFile = null) { if(resolver == null) throw new ArgumentNullException("resolver"); if(rootNode == null) throw new ArgumentNullException("rootNode"); initial_resolver_state = resolver; root_node = rootNode; unresolved_file = unresolvedFile; resolve_visitor = new ResolveVisitor(initial_resolver_state, unresolvedFile); }
/// <summary> /// Creates a new BVE5 AST resolver. /// Use this overload if you are resolving within a complete BVE5 file. /// </summary> /// <param name="compilation">The current compilation.</param> /// <param name="syntaxTree">The syntax tree to be resolved.</param> /// <param name="unresolvedFile"> /// Optional: Result of <see cref="SyntaxTree.ToTypeSystem()"/> for the file being resolved. /// <para> /// This is used for setting up the context on the resolver. The unresolved file must be registered in the compilation. /// </para> /// <para> /// When the unresolvedFile is specified, the resolver will use the member's StartLocation/EndLocation to identify /// member declarations in the AST with members in the type system. /// When no unresolvedFile is specified (<c>null</c> value for this parameter), the resolver will instead compare the /// member's signature in the AST with the signature in the type system. /// </para> /// </param> public BVE5AstResolver(BVE5Compilation compilation, SyntaxTree syntaxTree, BVE5UnresolvedFile unresolvedFile = null) { if(compilation == null) throw new ArgumentNullException("compilation"); if(syntaxTree == null) throw new ArgumentNullException("syntaxTree"); initial_resolver_state = new BVE5Resolver(compilation); root_node = syntaxTree; unresolved_file = unresolvedFile; resolve_visitor = new ResolveVisitor(initial_resolver_state, unresolvedFile, FileKindHelper.GetTypeNameFromFileKind(syntaxTree.Kind)); }