diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-07-27 02:45:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-26 20:45:52 +0200 |
commit | 39629a1adcbcc822508acc3983f444328f90dd85 (patch) | |
tree | d60cad7a004aee263a9e3dfd6b1e183ca95f0ad9 | |
parent | bd063113ec3c00d80fc32a5581ac9552682f6b43 (diff) | |
download | Nim-39629a1adcbcc822508acc3983f444328f90dd85.tar.gz |
fixes JS semicolon omissions (#23896)
-rw-r--r-- | lib/js/asyncjs.nim | 4 | ||||
-rw-r--r-- | lib/pure/hashes.nim | 2 | ||||
-rw-r--r-- | lib/pure/json.nim | 2 | ||||
-rw-r--r-- | lib/pure/math.nim | 2 | ||||
-rw-r--r-- | lib/std/formatfloat.nim | 6 | ||||
-rw-r--r-- | lib/system/comparisons.nim | 2 | ||||
-rw-r--r-- | lib/system/reprjs.nim | 4 |
7 files changed, 11 insertions, 11 deletions
diff --git a/lib/js/asyncjs.nim b/lib/js/asyncjs.nim index b7ebc905f..9b043f3e5 100644 --- a/lib/js/asyncjs.nim +++ b/lib/js/asyncjs.nim @@ -243,7 +243,7 @@ since (1, 5, 1): else: type A = impl(onSuccess(default(T))) var ret: A - {.emit: "`ret` = `future`.then(`onSuccess`, `onReject`)".} + {.emit: "`ret` = `future`.then(`onSuccess`, `onReject`);".} return ret proc catch*[T](future: Future[T], onReject: OnReject): Future[void] = @@ -266,4 +266,4 @@ since (1, 5, 1): discard main() - {.emit: "`result` = `future`.catch(`onReject`)".} + {.emit: "`result` = `future`.catch(`onReject`);".} diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim index 14d027107..1038d55a1 100644 --- a/lib/pure/hashes.nim +++ b/lib/pure/hashes.nim @@ -190,7 +190,7 @@ proc hashData*(data: pointer, size: int): Hash = var h: Hash = 0 when defined(js): var p: cstring - {.emit: """`p` = `Data`""".} + {.emit: """`p` = `Data`;""".} else: var p = cast[cstring](data) var i = 0 diff --git a/lib/pure/json.nim b/lib/pure/json.nim index 485b8918c..53fa7553a 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -1007,7 +1007,7 @@ when defined(js): {.emit: """for (var property in `x`) { if (`x`.hasOwnProperty(property)) { """.} - + var nimProperty: cstring var nimValue: JsObject {.emit: "`nimProperty` = property; `nimValue` = `x`[property];".} diff --git a/lib/pure/math.nim b/lib/pure/math.nim index c9b2162e9..0cff1491c 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -225,7 +225,7 @@ when defined(js): return (num & ~(1 << bitPos)) | (bitVal << bitPos); } `b`[1] = updateBit(`b`[1], 31, `sgn`); - `result` = `a`[0] + `result` = `a`[0]; """.} proc signbit*(x: SomeFloat): bool {.inline, since: (1, 5, 1).} = diff --git a/lib/std/formatfloat.nim b/lib/std/formatfloat.nim index 63d344215..9258245f6 100644 --- a/lib/std/formatfloat.nim +++ b/lib/std/formatfloat.nim @@ -109,11 +109,11 @@ when defined(js): return n.toString().match(/^-?\d+$/); } if (Number.isSafeInteger(`a`)) - `result` = `a` === 0 && 1 / `a` < 0 ? "-0.0" : `a`+".0" + `result` = `a` === 0 && 1 / `a` < 0 ? "-0.0" : `a`+".0"; else { - `result` = `a`+"" + `result` = `a`+""; if(nimOnlyDigitsOrMinus(`result`)){ - `result` = `a`+".0" + `result` = `a`+".0"; } } """.} diff --git a/lib/system/comparisons.nim b/lib/system/comparisons.nim index ce5e486f7..a8d78bb93 100644 --- a/lib/system/comparisons.nim +++ b/lib/system/comparisons.nim @@ -324,7 +324,7 @@ proc `==`*[T](x, y: seq[T]): bool {.noSideEffect.} = return true else: var sameObject = false - {.emit: """`sameObject` = `x` === `y`""".} + {.emit: """`sameObject` = `x` === `y`;""".} if sameObject: return true if x.len != y.len: diff --git a/lib/system/reprjs.nim b/lib/system/reprjs.nim index 30e84ebee..761d66aec 100644 --- a/lib/system/reprjs.nim +++ b/lib/system/reprjs.nim @@ -29,7 +29,7 @@ proc reprBool(x: bool): string {.compilerRtl.} = proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} = var tmp: bool let item = typ.node.sons[e] - {.emit: "`tmp` = `item` !== undefined".} + {.emit: "`tmp` = `item` !== undefined;".} if tmp: result = makeNimstrLit(item.name) else: @@ -136,7 +136,7 @@ proc reprArray(a: pointer, typ: PNimType, add(result, "]") proc isPointedToNil(p: pointer): bool = - {. emit: "if (`p` === null) {`result` = true};\n" .} + {. emit: "if (`p` === null) {`result` = true;}\n" .} proc reprRef(result: var string, p: pointer, typ: PNimType, cl: var ReprClosure) = |