summary refs log tree commit diff stats
path: root/compiler/lookups.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2012-06-02 19:52:06 +0300
committerZahary Karadjov <zahary@gmail.com>2012-06-02 19:52:06 +0300
commit88f7b7bc500325cc7399022c3dc137539d0f2640 (patch)
treed9e0d97895dc413b52c3eb9f9b523618fe76bfdc /compiler/lookups.nim
parenta1da1f987b28ed041c3f3ad2317e756e2125aa30 (diff)
parent232ab71f208e341da327e54afa8a6d287141836b (diff)
downloadNim-88f7b7bc500325cc7399022c3dc137539d0f2640.tar.gz
Merge branch 'master' of github.com:Araq/Nimrod into upstream
Diffstat (limited to 'compiler/lookups.nim')
-rwxr-xr-xcompiler/lookups.nim21
1 files changed, 11 insertions, 10 deletions
diff --git a/compiler/lookups.nim b/compiler/lookups.nim
index 62f4a3391..d9725eedf 100755
--- a/compiler/lookups.nim
+++ b/compiler/lookups.nim
@@ -21,18 +21,19 @@ proc considerAcc*(n: PNode): PIdent =
     case n.len
     of 0: GlobalError(n.info, errIdentifierExpected, renderTree(n))
     of 1: result = considerAcc(n.sons[0])
-    of 2:
-      if n[0].ident.id == ord(wStar):
+    else:
+      if n.len == 2 and n[0].kind == nkIdent and n[0].ident.id == ord(wStar):
+        # XXX find a better way instead of `*x` for 'genSym'
         result = genSym(n[1].ident.s)
       else:
-        result = getIdent(n[0].ident.s & n[1].ident.s)
-    else:
-      var id = ""
-      for i in 0.. <n.len:
-        if n.sons[i].kind != nkIdent:
-          GlobalError(n.info, errIdentifierExpected, renderTree(n))
-        id.add(n.sons[i].ident.s)
-      result = getIdent(id)
+        var id = ""
+        for i in 0.. <n.len:
+          let x = n.sons[i]
+          case x.kind
+          of nkIdent: id.add(x.ident.s)
+          of nkSym: id.add(x.sym.name.s)
+          else: GlobalError(n.info, errIdentifierExpected, renderTree(n))
+        result = getIdent(id)
   else:
     GlobalError(n.info, errIdentifierExpected, renderTree(n))