address the comments
This commit is contained in:
parent
def6234903
commit
329e169e96
3 changed files with 4 additions and 7 deletions
|
|
@ -444,6 +444,7 @@ proc semAfterMacroCall(c: PContext, call, macroResult: PNode,
|
||||||
|
|
||||||
const
|
const
|
||||||
errMissingGenericParamsForTemplate = "'$1' has unspecified generic parameters"
|
errMissingGenericParamsForTemplate = "'$1' has unspecified generic parameters"
|
||||||
|
errFloatToString = "cannot convert '$1' to '$2'"
|
||||||
|
|
||||||
proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym,
|
proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym,
|
||||||
flags: TExprFlags = {}): PNode =
|
flags: TExprFlags = {}): PNode =
|
||||||
|
|
|
||||||
|
|
@ -514,11 +514,8 @@ proc changeType(c: PContext; n: PNode, newType: PType, check: bool) =
|
||||||
localError(c.config, n.info, "cannot convert " & $value &
|
localError(c.config, n.info, "cannot convert " & $value &
|
||||||
" to " & typeToString(newType))
|
" to " & typeToString(newType))
|
||||||
of nkFloatLit..nkFloat64Lit:
|
of nkFloatLit..nkFloat64Lit:
|
||||||
if check:
|
if check and not floatRangeCheck(n.floatVal, newType):
|
||||||
echo newType.kind
|
localError(c.config, n.info, errFloatToString % [$n.floatVal, typeToString(newType)])
|
||||||
if not floatRangeCheck(n.floatVal, newType):
|
|
||||||
localError(c.config, n.info, "cannot convert " & $n.floatVal &
|
|
||||||
" to " & typeToString(newType))
|
|
||||||
else: discard
|
else: discard
|
||||||
n.typ = newType
|
n.typ = newType
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,8 +293,7 @@ proc fitRemoveHiddenConv(c: PContext, typ: PType, n: PNode): PNode =
|
||||||
result.info = n.info
|
result.info = n.info
|
||||||
result.typ = typ
|
result.typ = typ
|
||||||
if not floatRangeCheck(result.floatVal, typ):
|
if not floatRangeCheck(result.floatVal, typ):
|
||||||
localError(c.config, n.info, "cannot convert " & $result.floatVal &
|
localError(c.config, n.info, errFloatToString % [$n.floatVal, typeToString(typ)])
|
||||||
" to " & typeToString(typ))
|
|
||||||
else:
|
else:
|
||||||
changeType(c, r1, typ, check=true)
|
changeType(c, r1, typ, check=true)
|
||||||
result = r1
|
result = r1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue