fix the error "only proc headers can feature pragmas" when compiling in JS mode

This commit is contained in:
Zahary Karadjov 2014-01-23 00:02:57 +02:00
commit 3c840102bc
3 changed files with 33 additions and 33 deletions

View file

@ -447,6 +447,7 @@ proc chr*(u: range[0..255]): char {.magic: "Chr", noSideEffect.}
# --------------------------------------------------------------------------
# built-in operators
when not defined(JS):
proc ze*(x: int8): int {.magic: "Ze8ToI", noSideEffect.}
## zero extends a smaller integer type to ``int``. This treats `x` as
## unsigned.
@ -479,7 +480,6 @@ proc toU32*(x: int64): int32 {.magic: "ToU32", noSideEffect.}
## treats `x` as unsigned and converts it to an ``int32`` by taking the
## last 32 bits from `x`.
# integer calculations:
proc `+` *(x: int): int {.magic: "UnaryPlusI", noSideEffect.}
proc `+` *(x: int8): int8 {.magic: "UnaryPlusI", noSideEffect.}

View file

@ -472,17 +472,17 @@ proc Ze(a: int): int {.compilerproc.} =
proc Ze64(a: int64): int64 {.compilerproc.} =
result = a
proc toU8(a: int): int8 {.noStackFrame, compilerproc.} =
proc ToU8(a: int): int8 {.noStackFrame, compilerproc.} =
asm """
return `a`;
"""
proc toU16(a: int): int16 {.noStackFrame, compilerproc.} =
proc ToU16(a: int): int16 {.noStackFrame, compilerproc.} =
asm """
return `a`;
"""
proc toU32(a: int): int32 {.noStackFrame, compilerproc.} =
proc ToU32(a: int): int32 {.noStackFrame, compilerproc.} =
asm """
return `a`;
"""

View file

@ -3,7 +3,7 @@ discard """
WARNING: false first asseertion from bar
ERROR: false second assertion from bar
-1
tests/run/tfailedassert.nim:27 false assertion from foo
tests/assert/tfailedassert.nim:27 false assertion from foo
'''
"""