]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/noder/import.go
[dev.typeparams] all: merge dev.regabi (063c72f) into dev.typeparams
[gostls13.git] / src / cmd / compile / internal / noder / import.go
index aa02c01cff9acdf39e98aec2e510ad40aa2ef041..89a2598833f47e13d515c2464b17d21badc6ebf0 100644 (file)
@@ -176,6 +176,11 @@ func resolveImportPath(path string) (string, error) {
 
 // TODO(mdempsky): Return an error instead.
 func importfile(decl *syntax.ImportDecl) *types.Pkg {
+       if decl.Path.Kind != syntax.StringLit {
+               base.Errorf("import path must be a string")
+               return nil
+       }
+
        path, err := strconv.Unquote(decl.Path.Value)
        if err != nil {
                base.Errorf("import path must be a string")