Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
This commit is contained in:
commit
5979d35ab2
5 changed files with 41 additions and 8 deletions
|
|
@ -1431,7 +1431,7 @@ proc genObjConstr(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
r.res = toRope("{")
|
r.res = toRope("{")
|
||||||
r.kind = resExpr
|
r.kind = resExpr
|
||||||
for i in countup(1, sonsLen(n) - 1):
|
for i in countup(1, sonsLen(n) - 1):
|
||||||
if i > 0: app(r.res, ", ")
|
if i > 1: app(r.res, ", ")
|
||||||
var it = n.sons[i]
|
var it = n.sons[i]
|
||||||
internalAssert it.kind == nkExprColonExpr
|
internalAssert it.kind == nkExprColonExpr
|
||||||
gen(p, it.sons[1], a)
|
gen(p, it.sons[1], a)
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ type
|
||||||
seenIndexTerms: Table[string, int] ## \
|
seenIndexTerms: Table[string, int] ## \
|
||||||
## Keeps count of same text index terms to generate different identifiers
|
## Keeps count of same text index terms to generate different identifiers
|
||||||
## for hyperlinks. See renderIndexTerm proc for details.
|
## for hyperlinks. See renderIndexTerm proc for details.
|
||||||
smileyFrmt: string ## How to massage the smiley filename.
|
|
||||||
|
|
||||||
PDoc = var TRstGenerator ## Alias to type less.
|
PDoc = var TRstGenerator ## Alias to type less.
|
||||||
|
|
||||||
|
|
@ -81,8 +80,7 @@ proc initRstGenerator*(g: var TRstGenerator, target: TOutputTarget,
|
||||||
config: StringTableRef, filename: string,
|
config: StringTableRef, filename: string,
|
||||||
options: TRstParseOptions,
|
options: TRstParseOptions,
|
||||||
findFile: TFindFileHandler=nil,
|
findFile: TFindFileHandler=nil,
|
||||||
msgHandler: TMsgHandler=nil,
|
msgHandler: TMsgHandler=nil) =
|
||||||
smileyFrmt = "/images/smilies/$1.gif") =
|
|
||||||
## Initializes a ``TRstGenerator``.
|
## Initializes a ``TRstGenerator``.
|
||||||
##
|
##
|
||||||
## You need to call this before using a ``TRstGenerator`` with any other
|
## You need to call this before using a ``TRstGenerator`` with any other
|
||||||
|
|
@ -142,7 +140,6 @@ proc initRstGenerator*(g: var TRstGenerator, target: TOutputTarget,
|
||||||
let s = config["split.item.toc"]
|
let s = config["split.item.toc"]
|
||||||
if s != "": g.splitAfter = parseInt(s)
|
if s != "": g.splitAfter = parseInt(s)
|
||||||
for i in low(g.meta)..high(g.meta): g.meta[i] = ""
|
for i in low(g.meta)..high(g.meta): g.meta[i] = ""
|
||||||
g.smileyFrmt = smileyFrmt
|
|
||||||
|
|
||||||
proc writeIndexFile*(g: var TRstGenerator, outfile: string) =
|
proc writeIndexFile*(g: var TRstGenerator, outfile: string) =
|
||||||
## Writes the current index buffer to the specified output file.
|
## Writes the current index buffer to the specified output file.
|
||||||
|
|
@ -778,7 +775,7 @@ proc renderSmiley(d: PDoc, n: PRstNode, result: var string) =
|
||||||
dispA(d.target, result,
|
dispA(d.target, result,
|
||||||
"""<img src="$1" width="15"
|
"""<img src="$1" width="15"
|
||||||
height="17" hspace="2" vspace="2" class="smiley" />""",
|
height="17" hspace="2" vspace="2" class="smiley" />""",
|
||||||
"\\includegraphics{$1}", [d.smileyFrmt % n.text])
|
"\\includegraphics{$1}", [d.config["doc.smiley_format"] % n.text])
|
||||||
|
|
||||||
proc parseCodeBlockField(d: PDoc, n: PRstNode, params: var CodeBlockParams) =
|
proc parseCodeBlockField(d: PDoc, n: PRstNode, params: var CodeBlockParams) =
|
||||||
## Parses useful fields which can appear before a code block.
|
## Parses useful fields which can appear before a code block.
|
||||||
|
|
@ -1204,6 +1201,7 @@ $content
|
||||||
""")
|
""")
|
||||||
setConfigVar("doc.body_no_toc", "$moduledesc $content")
|
setConfigVar("doc.body_no_toc", "$moduledesc $content")
|
||||||
setConfigVar("doc.file", "$content")
|
setConfigVar("doc.file", "$content")
|
||||||
|
setConfigVar("doc.smiley_format", "/images/smilies/$1.gif")
|
||||||
|
|
||||||
# ---------- forum ---------------------------------------------------------
|
# ---------- forum ---------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,8 @@ else:
|
||||||
|
|
||||||
# Note: The enumerations are mapped to Window's constants.
|
# Note: The enumerations are mapped to Window's constants.
|
||||||
|
|
||||||
when defined(ssl):
|
when defined(ssl):
|
||||||
|
|
||||||
type
|
type
|
||||||
SSLError* = object of Exception
|
SSLError* = object of Exception
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ elif defined(macosx):
|
||||||
ttfLibName = "libSDL_ttf-2.0.0.dylib"
|
ttfLibName = "libSDL_ttf-2.0.0.dylib"
|
||||||
else:
|
else:
|
||||||
const
|
const
|
||||||
ttfLibName = "libSDL_ttf.so(|.1|.0)"
|
ttfLibName = "libSDL_ttf(|-2.0).so(|.1|.0)"
|
||||||
const
|
const
|
||||||
MAJOR_VERSION* = 2
|
MAJOR_VERSION* = 2
|
||||||
MINOR_VERSION* = 0
|
MINOR_VERSION* = 0
|
||||||
|
|
|
||||||
34
tests/js/testobjs.nim
Normal file
34
tests/js/testobjs.nim
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
## Tests javascript object generation
|
||||||
|
|
||||||
|
type
|
||||||
|
Kg = distinct float
|
||||||
|
Price = int
|
||||||
|
Item = object of RootObj
|
||||||
|
weight: Kg
|
||||||
|
price: Price
|
||||||
|
desc: cstring
|
||||||
|
Person = object of RootObj
|
||||||
|
name: cstring
|
||||||
|
age: int
|
||||||
|
item: Item
|
||||||
|
Test = object
|
||||||
|
name: cstring
|
||||||
|
Recurse[T] = object
|
||||||
|
data: T
|
||||||
|
next: ref Recurse[T]
|
||||||
|
|
||||||
|
var
|
||||||
|
test = Test(name: "Jorden")
|
||||||
|
sword = Item(desc: "pointy", weight: Kg(10.0),
|
||||||
|
price: Price(50))
|
||||||
|
knight = Person(name: "robert", age: 19, item: sword)
|
||||||
|
recurse4 = (ref Recurse[int])(data: 4, next: nil)
|
||||||
|
recurse3 = (ref Recurse[int])(data: 3, next: recurse4)
|
||||||
|
recurse2 = (ref Recurse[int])(data: 2, next: recurse3)
|
||||||
|
recurse1 = Recurse[int](data: 1, next: recurse2)
|
||||||
|
|
||||||
|
|
||||||
|
assert(test.name == "Jorden")
|
||||||
|
assert(knight.age == 19)
|
||||||
|
assert(knight.item.price == 50)
|
||||||
|
assert(recurse1.next.next.data == 3)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue