summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2014-03-09 14:02:16 +0200
committerZahary Karadjov <zahary@gmail.com>2014-03-09 14:02:16 +0200
commit5820093e58bd975d5d0de7be2df6af3a84418fb5 (patch)
tree205531868276b3369ae46542f39dae437e56d8fe /compiler/pragmas.nim
parent4b09a897583a38bea144e86b8b99b1347b525280 (diff)
parent7704cdc90ec187ef22f259f0e0f89ceeb5c13431 (diff)
downloadNim-5820093e58bd975d5d0de7be2df6af3a84418fb5.tar.gz
Merge branch 'devel' of github.com:Araq/Nimrod into devel
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim10
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index 076e99924..fba4e7657 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -97,8 +97,6 @@ proc makeExternImport(s: PSym, extname: string) =
   incl(s.flags, sfImportc)
   excl(s.flags, sfForward)
 
-const invalidIdentChars = AllChars - IdentChars
-
 proc validateExternCName(s: PSym, info: TLineInfo) =
   ## Validates that the symbol name in s.loc.r is a valid C identifier.
   ##
@@ -106,16 +104,14 @@ proc validateExternCName(s: PSym, info: TLineInfo) =
   ## starting with a number. If the check fails, a generic error will be
   ## displayed to the user.
   let target = ropeToStr(s.loc.r)
-  if target.len < 1 or (not (target[0] in IdentStartChars)) or
-      (not target.allCharsInSet(IdentChars)):
+  if target.len < 1 or target[0] notin IdentStartChars or
+      not target.allCharsInSet(IdentChars):
     localError(info, errGenerated, "invalid exported symbol")
 
 proc makeExternExport(s: PSym, extname: string, info: TLineInfo) =
   setExternName(s, extname)
-  case gCmd
-  of cmdCompileToC, cmdCompileToCpp, cmdCompileToOC:
+  if gCmd in {cmdCompileToC, cmdCompileToCpp, cmdCompileToOC}:
     validateExternCName(s, info)
-  else: discard
   incl(s.flags, sfExportc)
 
 proc processImportCompilerProc(s: PSym, extname: string) =