From 03e211d6eeb3f8f3c6f0b22f77c2074e81443952 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 6 Sep 2015 18:08:38 +0800 Subject: Rough span support --- src/convert/resolve.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/convert/resolve.cpp') diff --git a/src/convert/resolve.cpp b/src/convert/resolve.cpp index 9725549c..bdbf1854 100644 --- a/src/convert/resolve.cpp +++ b/src/convert/resolve.cpp @@ -865,8 +865,11 @@ void CPathResolver::handle_type(TypeRef& type) else if( name == "Self" ) { // If the name was "Self", but Self isn't already defined... then we need to make it an arg? - throw CompileError::Generic( FMT("CPathResolver::handle_type - Unexpected 'Self'") ); - type = TypeRef(TypeRef::TagArg(), "Self"); + ERROR(type.path().span(), E0000, "Unexpected 'Self'"); + + TypeRef nt = TypeRef(TypeRef::TagArg(), "Self"); + nt.set_span(type.span()); + type = nt; } else { @@ -930,8 +933,7 @@ void CPathResolver::handle_pattern(AST::Pattern& pat, const TypeRef& type_hint) ::std::string name = pat.binding(); // Locate a _constant_ within the current namespace which matches this name // - Variables don't count - AST::Path newpath = AST::Path(AST::Path::TagRelative()); - newpath.append(name); + AST::Path newpath = AST::Path(AST::Path::TagRelative(), { AST::PathNode(name) }); handle_path(newpath, CASTIterator::MODE_BIND); if( newpath.is_relative() ) { @@ -1096,12 +1098,12 @@ void ResolvePaths(AST::Crate& crate) // Handle 'use' statements in an initial parss DEBUG(" --- Use Statements"); INDENT(); - ResolvePaths_HandleModule_Use(crate, AST::Path(AST::Path::TagAbsolute()), crate.root_module()); + ResolvePaths_HandleModule_Use(crate, AST::Path("", {}), crate.root_module()); UNINDENT(); // Then do path resolution on all other items CPathResolver pr(crate); DEBUG(" ---"); - pr.handle_module(AST::Path(AST::Path::TagAbsolute()), crate.root_module()); + pr.handle_module(AST::Path("", {}), crate.root_module()); DEBUG(" <<<"); } -- cgit v1.2.3