summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorClay Sweetser <clay.sweetser@gmail.com>2014-05-26 10:12:46 -0400
committerClay Sweetser <clay.sweetser@gmail.com>2014-05-26 10:12:46 -0400
commit6608fcc60f2a47983eac28d878f090522976a20a (patch)
tree6ab17bcbb0026e6f85f932caa08fd6fb37bca7e4
parent97fa3391f2e7e8fefe247117bc2da9a848c4fd15 (diff)
downloadNim-6608fcc60f2a47983eac28d878f090522976a20a.tar.gz
Update 'isCastable' and 'semCast' doc-comments
-rw-r--r--compiler/semexprs.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 9ea93a15e..b7b5b30ce 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -176,13 +176,16 @@ proc checkConvertible(c: PContext, castDest, src: PType): TConvStatus =
     else:
       discard
 
-proc isCastable(dst, src: PType): bool = 
+proc isCastable(dst, src: PType): bool =
+  ## Checks whether the source type can be casted to the destination type.
+  ## Casting is very unrestrictive; casts are allowed as long as 
+  ## castDest.size >= src.size, and typeAllowed(dst, skParam)
   #const
   #  castableTypeKinds = {tyInt, tyPtr, tyRef, tyCstring, tyString, 
   #                       tySequence, tyPointer, tyNil, tyOpenArray,
   #                       tyProc, tySet, tyEnum, tyBool, tyChar}
   var ds, ss: BiggestInt
-  # this is very unrestrictive; cast is allowed if castDest.size >= src.size
+
   ds = computeSize(dst)
   ss = computeSize(src)
   if ds < 0: 
@@ -254,6 +257,7 @@ proc semConv(c: PContext, n: PNode): PNode =
     localError(n.info, errUseQualifier, op.sons[0].sym.name.s)
 
 proc semCast(c: PContext, n: PNode): PNode = 
+  ## Semantically analyze a casting ("cast[type](param)")
   if optSafeCode in gGlobalOptions: localError(n.info, errCastNotInSafeMode)
   #incl(c.p.owner.flags, sfSideEffect)
   checkSonsLen(n, 2)