summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-03-07 22:25:05 +0100
committerAraq <rumpf_a@web.de>2014-03-07 22:25:05 +0100
commit91d842e1ec070a9ab7f883820bd6244526f5d622 (patch)
tree820f09d7ddb69b01ef6a27b43ea9de5ff0df2b0a /compiler/pragmas.nim
parent7904446c47f952a026d408f04431dbaf6d887b37 (diff)
downloadNim-91d842e1ec070a9ab7f883820bd6244526f5d622.tar.gz
implements strongSpaces parsing mode
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 bf3564016..f5d69a01c 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) =