summary refs log tree commit diff stats
path: root/compiler/modulepaths.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/modulepaths.nim')
-rw-r--r--compiler/modulepaths.nim28
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler/modulepaths.nim b/compiler/modulepaths.nim
index 1318b67a7..daa55c2ba 100644
--- a/compiler/modulepaths.nim
+++ b/compiler/modulepaths.nim
@@ -113,16 +113,16 @@ when false:
       localError(pkg.info, "package name must be an identifier or string literal")
       result = ""
 
-proc getModuleName*(n: PNode): string =
+proc getModuleName*(conf: ConfigRef; n: PNode): string =
   # This returns a short relative module name without the nim extension
   # e.g. like "system", "importer" or "somepath/module"
   # The proc won't perform any checks that the path is actually valid
   case n.kind
   of nkStrLit, nkRStrLit, nkTripleStrLit:
     try:
-      result = pathSubs(n.strVal, n.info.toFullPath().splitFile().dir)
+      result = pathSubs(conf, n.strVal, n.info.toFullPath().splitFile().dir)
     except ValueError:
-      localError(n.info, "invalid path: " & n.strVal)
+      localError(conf, n.info, "invalid path: " & n.strVal)
       result = n.strVal
   of nkIdent:
     result = n.ident.s
@@ -137,7 +137,7 @@ proc getModuleName*(n: PNode): string =
       n.sons[0] = n.sons[1]
       n.sons[1] = n.sons[2]
       n.sons.setLen(2)
-      return getModuleName(n.sons[0])
+      return getModuleName(conf, n.sons[0])
     when false:
       if n1.kind == nkPrefix and n1[0].kind == nkIdent and n1[0].ident.s == "$":
         if n0.kind == nkIdent and n0.ident.s == "/":
@@ -146,16 +146,16 @@ proc getModuleName*(n: PNode): string =
           localError(n.info, "only '/' supported with $package notation")
           result = ""
     else:
-      let modname = getModuleName(n[2])
+      let modname = getModuleName(conf, n[2])
       if $n1 == "std":
         template attempt(a) =
           let x = addFileExt(a, "nim")
           if fileExists(x): return x
         for candidate in stdlibDirs:
-          attempt(options.libpath / candidate / modname)
+          attempt(conf.libpath / candidate / modname)
 
       # hacky way to implement 'x / y /../ z':
-      result = getModuleName(n1)
+      result = getModuleName(conf, n1)
       result.add renderTree(n0, {renderNoComments})
       result.add modname
   of nkPrefix:
@@ -169,19 +169,19 @@ proc getModuleName*(n: PNode): string =
   of nkDotExpr:
     result = renderTree(n, {renderNoComments}).replace(".", "/")
   of nkImportAs:
-    result = getModuleName(n.sons[0])
+    result = getModuleName(conf, n.sons[0])
   else:
-    localError(n.info, errGenerated, "invalid module name: '$1'" % n.renderTree)
+    localError(conf, n.info, "invalid module name: '$1'" % n.renderTree)
     result = ""
 
-proc checkModuleName*(n: PNode; doLocalError=true): FileIndex =
+proc checkModuleName*(conf: ConfigRef; n: PNode; doLocalError=true): FileIndex =
   # This returns the full canonical path for a given module import
-  let modulename = n.getModuleName
-  let fullPath = findModule(modulename, n.info.toFullPath)
+  let modulename = getModuleName(conf, n)
+  let fullPath = findModule(conf, modulename, n.info.toFullPath)
   if fullPath.len == 0:
     if doLocalError:
       let m = if modulename.len > 0: modulename else: $n
-      localError(n.info, errCannotOpenFile, m)
+      localError(conf, n.info, "cannot open file: " & m)
     result = InvalidFileIDX
   else:
-    result = fullPath.fileInfoIdx
+    result = fileInfoIdx(conf, fullPath)
48663275e'>7e747d11c ^
e25474154 ^
d68181246 ^
7e747d11c ^
e25474154 ^


5bf31fcab ^
02b1503e1 ^

d5a5c2291 ^
7e747d11c ^

674c05f42 ^
7e747d11c ^
674c05f42 ^

7e747d11c ^
674c05f42 ^
e25474154 ^

5bf31fcab ^
e25474154 ^
5bf31fcab ^
674c05f42 ^
5bf31fcab ^
674c05f42 ^
7e747d11c ^



e25474154 ^
d68181246 ^
e25474154 ^
7e747d11c ^
e25474154 ^


da29222f8 ^
afbcd1b33 ^
7e747d11c ^
da29222f8 ^
7e747d11c ^



da29222f8 ^
e25474154 ^
d68181246 ^
da29222f8 ^
d68181246 ^
a4e2b0c15 ^
d68181246 ^
e25474154 ^


7e747d11c ^
afbcd1b33 ^
e25474154 ^



7e747d11c ^
d68181246 ^
e25474154 ^

d68181246 ^
92b8fac94 ^
7e747d11c ^
92b8fac94 ^
afbcd1b33 ^
f92f00b02 ^
d68181246 ^
7e747d11c ^
d68181246 ^
e25474154 ^

7e747d11c ^
afbcd1b33 ^
f92f00b02 ^
7e747d11c ^

e25474154 ^
92b8fac94 ^
e25474154 ^
39ebe2175 ^
da29222f8 ^

6f1fc1b5b ^
a4e2b0c15 ^
e25474154 ^
a4e2b0c15 ^



e25474154 ^
a4e2b0c15 ^
da29222f8 ^

e25474154 ^

a4e2b0c15 ^
da29222f8 ^

e25474154 ^

a4e2b0c15 ^
da29222f8 ^
7e747d11c ^
a4e2b0c15 ^
009730595 ^
a4e2b0c15 ^
da29222f8 ^
a4e2b0c15 ^
e4515f304 ^
a4e2b0c15 ^
da29222f8 ^
427490a84 ^
d68181246 ^
5bf31fcab ^

674c05f42 ^
674c05f42 ^
7e747d11c ^

e25474154 ^


5bf31fcab ^
e25474154 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155