mirror of
https://github.com/nim-lang/Nim.git
synced 2026-09-01 03:13:41 +00:00
Compare commits
1 Commits
pr_recursi
...
pr_discard
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4ac3def9c |
@@ -36,7 +36,6 @@ slots when enlarging a sequence.
|
||||
- ORC: To be enabled via `nimOrcStats` there is a new API called `GC_orcStats` that can be used to query how many
|
||||
objects the cyclic collector did free. If the number is zero that is a strong indicator that you can use `--mm:arc`
|
||||
instead of `--mm:orc`.
|
||||
- A `$` template is provided for `Path` in `std/paths`.
|
||||
|
||||
[//]: # "Deprecations:"
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ type
|
||||
nfOpenSym # node is a captured sym but can be overriden by local symbols
|
||||
|
||||
TNodeFlags* = set[TNodeFlag]
|
||||
TTypeFlag* = enum # keep below 32 for efficiency reasons (now: 48)
|
||||
TTypeFlag* = enum # keep below 32 for efficiency reasons (now: 47)
|
||||
tfVarargs, # procedure has C styled varargs
|
||||
# tyArray type represeting a varargs list
|
||||
tfNoSideEffect, # procedure type does not allow side effects
|
||||
@@ -403,7 +403,6 @@ type
|
||||
tfIsOutParam
|
||||
tfSendable
|
||||
tfImplicitStatic
|
||||
tfTrackedProc # used for delayedEffects
|
||||
|
||||
TTypeFlags* = set[TTypeFlag]
|
||||
|
||||
@@ -505,7 +504,7 @@ type
|
||||
mSwap, mIsNil, mArrToSeq, mOpenArrayToSeq,
|
||||
mNewString, mNewStringOfCap, mParseBiggestFloat,
|
||||
mMove, mEnsureMove, mWasMoved, mDup, mDestroy, mTrace,
|
||||
mDefault, mUnown, mFinished, mIsolate, mAccessEnv, mAccessTypeField,
|
||||
mDefault, mUnown, mFinished, mIsolate, mAccessEnv, mAccessTypeField, mReset,
|
||||
mArray, mOpenArray, mRange, mSet, mSeq, mVarargs,
|
||||
mRef, mPtr, mVar, mDistinct, mVoid, mTuple,
|
||||
mOrdinal, mIterableType,
|
||||
|
||||
@@ -150,14 +150,8 @@ proc genBoundsCheck(p: BProc; arr, a, b: TLoc)
|
||||
|
||||
proc reifiedOpenArray(n: PNode): bool {.inline.} =
|
||||
var x = n
|
||||
while true:
|
||||
case x.kind
|
||||
of {nkAddr, nkHiddenAddr, nkHiddenDeref}:
|
||||
x = x[0]
|
||||
of nkHiddenStdConv:
|
||||
x = x[1]
|
||||
else:
|
||||
break
|
||||
while x.kind in {nkAddr, nkHiddenAddr, nkHiddenStdConv, nkHiddenDeref}:
|
||||
x = x[0]
|
||||
if x.kind == nkSym and x.sym.kind == skParam:
|
||||
result = false
|
||||
else:
|
||||
@@ -172,10 +166,7 @@ proc genOpenArraySlice(p: BProc; q: PNode; formalType, destType: PType; prepareF
|
||||
genBoundsCheck(p, a, b, c)
|
||||
if prepareForMutation:
|
||||
linefmt(p, cpsStmts, "#nimPrepareStrMutationV2($1);$n", [byRefLoc(p, a)])
|
||||
# bug #23321: In the function mapType, ptrs (tyPtr, tyVar, tyLent, tyRef)
|
||||
# are mapped into ctPtrToArray, the dereference of which is skipped
|
||||
# in the `genref`. We need to skip these ptrs here
|
||||
let ty = skipTypes(a.t, abstractVar+{tyPtr, tyRef})
|
||||
let ty = skipTypes(a.t, abstractVar+{tyPtr})
|
||||
let dest = getTypeDesc(p.module, destType)
|
||||
let lengthExpr = "($1)-($2)+1" % [rdLoc(c), rdLoc(b)]
|
||||
case ty.kind
|
||||
@@ -319,11 +310,6 @@ proc genArg(p: BProc, n: PNode, param: PSym; call: PNode; result: var Rope; need
|
||||
addRdLoc(a, result)
|
||||
else:
|
||||
a = initLocExprSingleUse(p, n)
|
||||
if param.typ.kind in abstractPtrs:
|
||||
let typ = skipTypes(param.typ, abstractPtrs)
|
||||
if typ.sym != nil and sfImportc in typ.sym.flags:
|
||||
a.r = "(($1) ($2))" %
|
||||
[getTypeDesc(p.module, param.typ), rdCharLoc(a)]
|
||||
addRdLoc(withTmpIfNeeded(p, a, needsTmp), result)
|
||||
#assert result != nil
|
||||
|
||||
@@ -368,7 +354,7 @@ proc getPotentialWrites(n: PNode; mutate: bool; result: var seq[PNode]) =
|
||||
of nkCallKinds:
|
||||
case n.getMagic:
|
||||
of mIncl, mExcl, mInc, mDec, mAppendStrCh, mAppendStrStr, mAppendSeqElem,
|
||||
mAddr, mNew, mNewFinalize, mWasMoved, mDestroy:
|
||||
mAddr, mNew, mNewFinalize, mWasMoved, mDestroy, mReset:
|
||||
getPotentialWrites(n[1], true, result)
|
||||
for i in 2..<n.len:
|
||||
getPotentialWrites(n[i], mutate, result)
|
||||
|
||||
@@ -1352,6 +1352,14 @@ proc genSeqElemAppend(p: BProc, e: PNode, d: var TLoc) =
|
||||
genAssignment(p, dest, b, {needToCopy})
|
||||
gcUsage(p.config, e)
|
||||
|
||||
proc genReset(p: BProc, n: PNode) =
|
||||
var a: TLoc = initLocExpr(p, n[1])
|
||||
specializeReset(p, a)
|
||||
when false:
|
||||
linefmt(p, cpsStmts, "#genericReset((void*)$1, $2);$n",
|
||||
[addrLoc(p.config, a),
|
||||
genTypeInfoV1(p.module, skipTypes(a.t, {tyVar}), n.info)])
|
||||
|
||||
proc genDefault(p: BProc; n: PNode; d: var TLoc) =
|
||||
if d.k == locNone: d = getTemp(p, n.typ, needsInit=true)
|
||||
else: resetLoc(p, d)
|
||||
@@ -1484,13 +1492,9 @@ proc rawConstExpr(p: BProc, n: PNode; d: var TLoc) =
|
||||
if id == p.module.labels:
|
||||
# expression not found in the cache:
|
||||
inc(p.module.labels)
|
||||
var data = "static NIM_CONST $1 $2 = " % [getTypeDesc(p.module, t), d.r]
|
||||
# bug #23627; when generating const object fields, it's likely that
|
||||
# we need to generate type infos for the object, which may be an object with
|
||||
# custom hooks. We need to generate potential consts in the hooks first.
|
||||
genBracedInit(p, n, isConst = true, t, data)
|
||||
data.addf(";$n", [])
|
||||
p.module.s[cfsData].add data
|
||||
p.module.s[cfsData].addf("static NIM_CONST $1 $2 = ", [getTypeDesc(p.module, t), d.r])
|
||||
genBracedInit(p, n, isConst = true, t, p.module.s[cfsData])
|
||||
p.module.s[cfsData].addf(";$n", [])
|
||||
|
||||
proc handleConstExpr(p: BProc, n: PNode, d: var TLoc): bool =
|
||||
if d.k == locNone and n.len > ord(n.kind == nkObjConstr) and n.isDeepConstExpr:
|
||||
@@ -1501,7 +1505,8 @@ proc handleConstExpr(p: BProc, n: PNode, d: var TLoc): bool =
|
||||
|
||||
|
||||
proc genFieldObjConstr(p: BProc; ty: PType; useTemp, isRef: bool; nField, val, check: PNode; d: var TLoc; r: Rope; info: TLineInfo) =
|
||||
var tmp2 = TLoc(r: r)
|
||||
var tmp2: TLoc = default(TLoc)
|
||||
tmp2.r = r
|
||||
let field = lookupFieldAgain(p, ty, nField.sym, tmp2.r)
|
||||
if field.loc.r == "": fillObjectFields(p.module, ty)
|
||||
if field.loc.r == "": internalError(p.config, info, "genFieldObjConstr")
|
||||
@@ -1516,12 +1521,7 @@ proc genFieldObjConstr(p: BProc; ty: PType; useTemp, isRef: bool; nField, val, c
|
||||
tmp2.k = d.k
|
||||
tmp2.storage = if isRef: OnHeap else: d.storage
|
||||
tmp2.lode = val
|
||||
if nField.typ.skipTypes(abstractVar).kind in {tyOpenArray, tyVarargs}:
|
||||
var tmp3 = getTemp(p, val.typ)
|
||||
expr(p, val, tmp3)
|
||||
genOpenArrayConv(p, tmp2, tmp3, {})
|
||||
else:
|
||||
expr(p, val, tmp2)
|
||||
expr(p, val, tmp2)
|
||||
|
||||
proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
||||
# inheritance in C++ does not allow struct initialization so
|
||||
@@ -2562,6 +2562,7 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
||||
[mangleDynLibProc(prc), getTypeDesc(p.module, prc.loc.t), getModuleDllPath(p.module, prc)])
|
||||
genCall(p, e, d)
|
||||
of mDefault, mZeroDefault: genDefault(p, e, d)
|
||||
of mReset: genReset(p, e)
|
||||
of mEcho: genEcho(p, e[1].skipConv)
|
||||
of mArrToSeq: genArrToSeq(p, e, d)
|
||||
of mNLen..mNError, mSlurp..mQuoteAst:
|
||||
|
||||
@@ -289,7 +289,7 @@ proc potentialValueInit(p: BProc; v: PSym; value: PNode; result: var Rope) =
|
||||
#echo "New code produced for ", v.name.s, " ", p.config $ value.info
|
||||
genBracedInit(p, value, isConst = false, v.typ, result)
|
||||
|
||||
proc genCppParamsForCtor(p: BProc; call: PNode; didGenTemp: var bool): string =
|
||||
proc genCppParamsForCtor(p: BProc; call: PNode): string =
|
||||
result = ""
|
||||
var argsCounter = 0
|
||||
let typ = skipTypes(call[0].typ, abstractInst)
|
||||
@@ -298,23 +298,12 @@ proc genCppParamsForCtor(p: BProc; call: PNode; didGenTemp: var bool): string =
|
||||
#if it's a type we can just generate here another initializer as we are in an initializer context
|
||||
if call[i].kind == nkCall and call[i][0].kind == nkSym and call[i][0].sym.kind == skType:
|
||||
if argsCounter > 0: result.add ","
|
||||
result.add genCppInitializer(p.module, p, call[i][0].sym.typ, didGenTemp)
|
||||
result.add genCppInitializer(p.module, p, call[i][0].sym.typ)
|
||||
else:
|
||||
#We need to test for temp in globals, see: #23657
|
||||
let param =
|
||||
if typ[i].kind in {tyVar} and call[i].kind == nkHiddenAddr:
|
||||
call[i][0]
|
||||
else:
|
||||
call[i]
|
||||
if param.kind != nkBracketExpr or param.typ.kind in
|
||||
{tyRef, tyPtr, tyUncheckedArray, tyArray, tyOpenArray,
|
||||
tyVarargs, tySequence, tyString, tyCstring, tyTuple}:
|
||||
let tempLoc = initLocExprSingleUse(p, param)
|
||||
didGenTemp = didGenTemp or tempLoc.k == locTemp
|
||||
genOtherArg(p, call, i, typ, result, argsCounter)
|
||||
|
||||
proc genCppVarForCtor(p: BProc; call: PNode; decl: var Rope, didGenTemp: var bool) =
|
||||
let params = genCppParamsForCtor(p, call, didGenTemp)
|
||||
proc genCppVarForCtor(p: BProc; call: PNode; decl: var Rope) =
|
||||
let params = genCppParamsForCtor(p, call)
|
||||
if params.len == 0:
|
||||
decl = runtimeFormat("$#;\n", [decl])
|
||||
else:
|
||||
@@ -341,14 +330,7 @@ proc genSingleVar(p: BProc, v: PSym; vn, value: PNode) =
|
||||
# v.owner.kind != skModule:
|
||||
targetProc = p.module.preInitProc
|
||||
if isCppCtorCall and not containsHiddenPointer(v.typ):
|
||||
var didGenTemp = false
|
||||
callGlobalVarCppCtor(targetProc, v, vn, value, didGenTemp)
|
||||
if didGenTemp:
|
||||
message(p.config, vn.info, warnGlobalVarConstructorTemporary, vn.sym.name.s)
|
||||
#We fail to call the constructor in the global scope so we do the call inside the main proc
|
||||
assignGlobalVar(targetProc, vn, valueAsRope)
|
||||
var loc = initLocExprSingleUse(targetProc, value)
|
||||
genAssignment(targetProc, v.loc, loc, {})
|
||||
callGlobalVarCppCtor(targetProc, v, vn, value)
|
||||
else:
|
||||
assignGlobalVar(targetProc, vn, valueAsRope)
|
||||
|
||||
@@ -383,8 +365,7 @@ proc genSingleVar(p: BProc, v: PSym; vn, value: PNode) =
|
||||
var decl = localVarDecl(p, vn)
|
||||
var tmp: TLoc
|
||||
if isCppCtorCall:
|
||||
var didGenTemp = false
|
||||
genCppVarForCtor(p, value, decl, didGenTemp)
|
||||
genCppVarForCtor(p, value, decl)
|
||||
line(p, cpsStmts, decl)
|
||||
else:
|
||||
tmp = initLocExprSingleUse(p, value)
|
||||
|
||||
@@ -55,14 +55,14 @@ proc mangleField(m: BModule; name: PIdent): string =
|
||||
if isKeyword(name):
|
||||
result.add "_0"
|
||||
|
||||
proc mangleProc(m: BModule; s: PSym; makeUnique: bool): string =
|
||||
proc mangleProc(m: BModule; s: PSym; makeUnique: bool): string =
|
||||
result = "_Z" # Common prefix in Itanium ABI
|
||||
result.add encodeSym(m, s, makeUnique)
|
||||
if s.typ.len > 1: #we dont care about the return param
|
||||
for i in 1..<s.typ.len:
|
||||
for i in 1..<s.typ.len:
|
||||
if s.typ[i].isNil: continue
|
||||
result.add encodeType(m, s.typ[i])
|
||||
|
||||
|
||||
if result in m.g.mangledPrcs:
|
||||
result = mangleProc(m, s, true)
|
||||
else:
|
||||
@@ -72,7 +72,7 @@ proc fillBackendName(m: BModule; s: PSym) =
|
||||
if s.loc.r == "":
|
||||
var result: Rope
|
||||
if not m.compileToCpp and s.kind in routineKinds and optCDebug in m.g.config.globalOptions and
|
||||
m.g.config.symbolFiles == disabledSf:
|
||||
m.g.config.symbolFiles == disabledSf:
|
||||
result = mangleProc(m, s, false).rope
|
||||
else:
|
||||
result = s.name.s.mangle.rope
|
||||
@@ -189,7 +189,7 @@ proc mapType(conf: ConfigRef; typ: PType; isParam: bool): TCTypeKind =
|
||||
of tyObject, tyTuple: result = ctStruct
|
||||
of tyUserTypeClasses:
|
||||
doAssert typ.isResolvedUserTypeClass
|
||||
result = mapType(conf, typ.skipModifier, isParam)
|
||||
return mapType(conf, typ.skipModifier, isParam)
|
||||
of tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal,
|
||||
tyTypeDesc, tyAlias, tySink, tyInferred, tyOwned:
|
||||
result = mapType(conf, skipModifier(typ), isParam)
|
||||
@@ -245,9 +245,6 @@ proc isImportedCppType(t: PType): bool =
|
||||
proc isOrHasImportedCppType(typ: PType): bool =
|
||||
searchTypeFor(typ.skipTypes({tyRef}), isImportedCppType)
|
||||
|
||||
proc hasNoInit(t: PType): bool =
|
||||
result = t.sym != nil and sfNoInit in t.sym.flags
|
||||
|
||||
proc getTypeDescAux(m: BModule; origTyp: PType, check: var IntSet; kind: TypeDescKind): Rope
|
||||
|
||||
proc isObjLackingTypeField(typ: PType): bool {.inline.} =
|
||||
@@ -287,7 +284,7 @@ const
|
||||
"N_STDCALL", "N_CDECL", "N_SAFECALL",
|
||||
"N_SYSCALL", # this is probably not correct for all platforms,
|
||||
# but one can #define it to what one wants
|
||||
"N_INLINE", "N_NOINLINE", "N_FASTCALL", "N_THISCALL", "N_CLOSURE", "N_NOCONV",
|
||||
"N_INLINE", "N_NOINLINE", "N_FASTCALL", "N_THISCALL", "N_CLOSURE", "N_NOCONV",
|
||||
"N_NOCONV" #ccMember is N_NOCONV
|
||||
]
|
||||
|
||||
@@ -374,9 +371,11 @@ proc getTypePre(m: BModule; typ: PType; sig: SigHash): Rope =
|
||||
if result == "": result = cacheGetType(m.typeCache, sig)
|
||||
|
||||
proc structOrUnion(t: PType): Rope =
|
||||
let cachedUnion = rope("union")
|
||||
let cachedStruct = rope("struct")
|
||||
let t = t.skipTypes({tyAlias, tySink})
|
||||
if tfUnion in t.flags: "union"
|
||||
else: "struct"
|
||||
if tfUnion in t.flags: cachedUnion
|
||||
else: cachedStruct
|
||||
|
||||
proc addForwardStructFormat(m: BModule; structOrUnion: Rope, typename: Rope) =
|
||||
if m.compileToCpp:
|
||||
@@ -476,8 +475,8 @@ macro unrollChars(x: static openArray[char], name, body: untyped) =
|
||||
copy body
|
||||
)))
|
||||
|
||||
proc multiFormat*(frmt: var string, chars: static openArray[char], args: openArray[seq[string]]) =
|
||||
var res: string
|
||||
proc multiFormat*(frmt: var string, chars : static openArray[char], args: openArray[seq[string]]) =
|
||||
var res : string
|
||||
unrollChars(chars, c):
|
||||
res = ""
|
||||
let arg = args[find(chars, c)]
|
||||
@@ -519,8 +518,7 @@ proc genMemberProcParams(m: BModule; prc: PSym, superCall, rettype, name, params
|
||||
weakDep=false;) =
|
||||
let t = prc.typ
|
||||
let isCtor = sfConstructor in prc.flags
|
||||
if isCtor or (name[0] == '~' and sfMember in prc.flags):
|
||||
# destructors can't have void
|
||||
if isCtor or (name[0] == '~' and sfMember in prc.flags): #destructors cant have void
|
||||
rettype = ""
|
||||
elif t.returnType == nil or isInvalidReturnType(m.config, t):
|
||||
rettype = "void"
|
||||
@@ -552,7 +550,7 @@ proc genMemberProcParams(m: BModule; prc: PSym, superCall, rettype, name, params
|
||||
descKind = dkRefGenericParam
|
||||
else:
|
||||
descKind = dkRefParam
|
||||
var typ, name: string
|
||||
var typ, name : string
|
||||
fillParamName(m, param)
|
||||
fillLoc(param.loc, locParam, t.n[i],
|
||||
param.paramStorageLoc)
|
||||
@@ -678,9 +676,9 @@ proc hasCppCtor(m: BModule; typ: PType): bool =
|
||||
if sfConstructor in prc.flags:
|
||||
return true
|
||||
|
||||
proc genCppParamsForCtor(p: BProc; call: PNode; didGenTemp: var bool): string
|
||||
proc genCppParamsForCtor(p: BProc; call: PNode): string
|
||||
|
||||
proc genCppInitializer(m: BModule, prc: BProc; typ: PType; didGenTemp: var bool): string =
|
||||
proc genCppInitializer(m: BModule, prc: BProc; typ: PType): string =
|
||||
#To avoid creating a BProc per test when called inside a struct nil BProc is allowed
|
||||
result = "{}"
|
||||
if typ.itemId in m.g.graph.initializersPerType:
|
||||
@@ -689,7 +687,7 @@ proc genCppInitializer(m: BModule, prc: BProc; typ: PType; didGenTemp: var bool)
|
||||
var p = prc
|
||||
if p == nil:
|
||||
p = BProc(module: m)
|
||||
result = "{" & genCppParamsForCtor(p, call, didGenTemp) & "}"
|
||||
result = "{" & genCppParamsForCtor(p, call) & "}"
|
||||
if prc == nil:
|
||||
assert p.blocks.len == 0, "BProc belongs to a struct doesnt have blocks"
|
||||
|
||||
@@ -759,8 +757,7 @@ proc genRecordFieldsAux(m: BModule; n: PNode,
|
||||
# tyGenericInst for C++ template support
|
||||
let noInit = sfNoInit in field.flags or (field.typ.sym != nil and sfNoInit in field.typ.sym.flags)
|
||||
if not noInit and (fieldType.isOrHasImportedCppType() or hasCppCtor(m, field.owner.typ)):
|
||||
var didGenTemp = false
|
||||
var initializer = genCppInitializer(m, nil, fieldType, didGenTemp)
|
||||
var initializer = genCppInitializer(m, nil, fieldType)
|
||||
result.addf("\t$1$3 $2$4;$n", [getTypeDescAux(m, field.loc.t, check, dkField), sname, noAlias, initializer])
|
||||
else:
|
||||
result.addf("\t$1$3 $2;$n", [getTypeDescAux(m, field.loc.t, check, dkField), sname, noAlias])
|
||||
@@ -1220,7 +1217,7 @@ proc parseVFunctionDecl(val: string; name, params, retType, superCall: var strin
|
||||
|
||||
params = "(" & params & ")"
|
||||
|
||||
proc genMemberProcHeader(m: BModule; prc: PSym; result: var Rope; asPtr: bool = false, isFwdDecl: bool = false) =
|
||||
proc genMemberProcHeader(m: BModule; prc: PSym; result: var Rope; asPtr: bool = false, isFwdDecl : bool = false) =
|
||||
assert sfCppMember * prc.flags != {}
|
||||
let isCtor = sfConstructor in prc.flags
|
||||
var check = initIntSet()
|
||||
@@ -1861,7 +1858,8 @@ proc typeToC(t: PType): string =
|
||||
## to be unique.
|
||||
let s = typeToString(t)
|
||||
result = newStringOfCap(s.len)
|
||||
for c in s:
|
||||
for i in 0..<s.len:
|
||||
let c = s[i]
|
||||
case c
|
||||
of 'a'..'z':
|
||||
result.add c
|
||||
|
||||
@@ -122,7 +122,7 @@ proc encodeSym*(m: BModule; s: PSym; makeUnique: bool = false): string =
|
||||
var name = s.name.s
|
||||
if makeUnique:
|
||||
name = makeUnique(m, s, name)
|
||||
"N" & encodeName(s.skipGenericOwner.name.s) & encodeName(name) & "E"
|
||||
"N" & encodeName(s.owner.name.s) & encodeName(name) & "E"
|
||||
|
||||
proc encodeType*(m: BModule; t: PType): string =
|
||||
result = ""
|
||||
|
||||
@@ -33,12 +33,6 @@ import std/strutils except `%`, addf # collides with ropes.`%`
|
||||
from ic / ic import ModuleBackendFlag
|
||||
import std/[dynlib, math, tables, sets, os, intsets, hashes]
|
||||
|
||||
const
|
||||
# we use some ASCII control characters to insert directives that will be converted to real code in a postprocessing pass
|
||||
postprocessDirStart = '\1'
|
||||
postprocessDirSep = '\31'
|
||||
postprocessDirEnd = '\23'
|
||||
|
||||
when not declared(dynlib.libCandidates):
|
||||
proc libCandidates(s: string, dest: var seq[string]) =
|
||||
## given a library name pattern `s` write possible library names to `dest`.
|
||||
@@ -273,28 +267,24 @@ proc safeLineNm(info: TLineInfo): int =
|
||||
result = toLinenumber(info)
|
||||
if result < 0: result = 0 # negative numbers are not allowed in #line
|
||||
|
||||
proc genPostprocessDir(field1, field2, field3: string): string =
|
||||
result = postprocessDirStart & field1 & postprocessDirSep & field2 & postprocessDirSep & field3 & postprocessDirEnd
|
||||
|
||||
proc genCLineDir(r: var Rope, fileIdx: FileIndex, line: int; conf: ConfigRef) =
|
||||
proc genCLineDir(r: var Rope, filename: string, line: int; conf: ConfigRef) =
|
||||
assert line >= 0
|
||||
if optLineDir in conf.options and line > 0:
|
||||
if fileIdx == InvalidFileIdx:
|
||||
r.add(rope("\n#line " & $line & " \"generated_not_to_break_here\"\n"))
|
||||
else:
|
||||
r.add(rope("\n#line " & $line & " FX_" & $fileIdx.int32 & "\n"))
|
||||
r.addf("\n#line $2 $1\n",
|
||||
[rope(makeSingleLineCString(filename)), rope(line)])
|
||||
|
||||
proc genCLineDir(r: var Rope, fileIdx: FileIndex, line: int; p: BProc; info: TLineInfo; lastFileIndex: FileIndex) =
|
||||
proc genCLineDir(r: var Rope, filename: string, line: int; p: BProc; info: TLineInfo; lastFileIndex: FileIndex) =
|
||||
assert line >= 0
|
||||
if optLineDir in p.config.options and line > 0:
|
||||
if fileIdx == InvalidFileIdx:
|
||||
r.add(rope("\n#line " & $line & " \"generated_not_to_break_here\"\n"))
|
||||
if lastFileIndex == info.fileIndex:
|
||||
r.addf("\n#line $1\n", [rope(line)])
|
||||
else:
|
||||
r.add(rope("\n#line " & $line & " FX_" & $fileIdx.int32 & "\n"))
|
||||
r.addf("\n#line $2 $1\n",
|
||||
[rope(makeSingleLineCString(filename)), rope(line)])
|
||||
|
||||
proc genCLineDir(r: var Rope, info: TLineInfo; conf: ConfigRef) =
|
||||
if optLineDir in conf.options:
|
||||
genCLineDir(r, info.fileIndex, info.safeLineNm, conf)
|
||||
genCLineDir(r, toFullPath(conf, info), info.safeLineNm, conf)
|
||||
|
||||
proc freshLineInfo(p: BProc; info: TLineInfo): bool =
|
||||
if p.lastLineInfo.line != info.line or
|
||||
@@ -309,7 +299,7 @@ proc genCLineDir(r: var Rope, p: BProc, info: TLineInfo; conf: ConfigRef) =
|
||||
if optLineDir in conf.options:
|
||||
let lastFileIndex = p.lastLineInfo.fileIndex
|
||||
if freshLineInfo(p, info):
|
||||
genCLineDir(r, info.fileIndex, info.safeLineNm, p, info, lastFileIndex)
|
||||
genCLineDir(r, toFullPath(conf, info), info.safeLineNm, p, info, lastFileIndex)
|
||||
|
||||
proc genLineDir(p: BProc, t: PNode) =
|
||||
if p == p.module.preInitProc: return
|
||||
@@ -320,11 +310,16 @@ proc genLineDir(p: BProc, t: PNode) =
|
||||
let lastFileIndex = p.lastLineInfo.fileIndex
|
||||
let freshLine = freshLineInfo(p, t.info)
|
||||
if freshLine:
|
||||
genCLineDir(p.s(cpsStmts), t.info.fileIndex, line, p, t.info, lastFileIndex)
|
||||
genCLineDir(p.s(cpsStmts), toFullPath(p.config, t.info), line, p, t.info, lastFileIndex)
|
||||
if ({optLineTrace, optStackTrace} * p.options == {optLineTrace, optStackTrace}) and
|
||||
(p.prc == nil or sfPure notin p.prc.flags) and t.info.fileIndex != InvalidFileIdx:
|
||||
if freshLine:
|
||||
line(p, cpsStmts, genPostprocessDir("nimln", $line, $t.info.fileIndex.int32))
|
||||
if lastFileIndex == t.info.fileIndex:
|
||||
linefmt(p, cpsStmts, "nimln_($1);",
|
||||
[line])
|
||||
else:
|
||||
linefmt(p, cpsStmts, "nimlf_($1, $2);",
|
||||
[line, quotedFilename(p.config, t.info)])
|
||||
|
||||
proc accessThreadLocalVar(p: BProc, s: PSym)
|
||||
proc emulatedThreadVars(conf: ConfigRef): bool {.inline.}
|
||||
@@ -537,7 +532,7 @@ proc constructLoc(p: BProc, loc: var TLoc, isTemp = false) =
|
||||
linefmt(p, cpsStmts, "$1 = ($2)0;$n", [rdLoc(loc),
|
||||
getTypeDesc(p.module, typ, descKindFromSymKind mapTypeChooser(loc))])
|
||||
else:
|
||||
if (not isTemp or containsGarbageCollectedRef(loc.t)) and not hasNoInit(loc.t):
|
||||
if not isTemp or containsGarbageCollectedRef(loc.t):
|
||||
# don't use nimZeroMem for temporary values for performance if we can
|
||||
# avoid it:
|
||||
if not isOrHasImportedCppType(typ):
|
||||
@@ -562,9 +557,8 @@ proc getTemp(p: BProc, t: PType, needsInit=false): TLoc =
|
||||
result = TLoc(r: "T" & rope(p.labels) & "_", k: locTemp, lode: lodeTyp t,
|
||||
storage: OnStack, flags: {})
|
||||
if p.module.compileToCpp and isOrHasImportedCppType(t):
|
||||
var didGenTemp = false
|
||||
linefmt(p, cpsLocals, "$1 $2$3;$n", [getTypeDesc(p.module, t, dkVar), result.r,
|
||||
genCppInitializer(p.module, p, t, didGenTemp)])
|
||||
genCppInitializer(p.module, p, t)])
|
||||
else:
|
||||
linefmt(p, cpsLocals, "$1 $2;$n", [getTypeDesc(p.module, t, dkVar), result.r])
|
||||
constructLoc(p, result, not needsInit)
|
||||
@@ -621,8 +615,7 @@ proc assignLocalVar(p: BProc, n: PNode) =
|
||||
let nl = if optLineDir in p.config.options: "" else: "\n"
|
||||
var decl = localVarDecl(p, n)
|
||||
if p.module.compileToCpp and isOrHasImportedCppType(n.typ):
|
||||
var didGenTemp = false
|
||||
decl.add genCppInitializer(p.module, p, n.typ, didGenTemp)
|
||||
decl.add genCppInitializer(p.module, p, n.typ)
|
||||
decl.add ";" & nl
|
||||
line(p, cpsLocals, decl)
|
||||
|
||||
@@ -657,7 +650,18 @@ proc genGlobalVarDecl(p: BProc, n: PNode; td, value: Rope; decl: var Rope) =
|
||||
else:
|
||||
decl = runtimeFormat(s.cgDeclFrmt & ";$n", [td, s.loc.r])
|
||||
|
||||
proc genCppVarForCtor(p: BProc; call: PNode; decl: var Rope; didGenTemp: var bool)
|
||||
proc genCppVarForCtor(p: BProc; call: PNode; decl: var Rope)
|
||||
|
||||
proc callGlobalVarCppCtor(p: BProc; v: PSym; vn, value: PNode) =
|
||||
let s = vn.sym
|
||||
fillBackendName(p.module, s)
|
||||
fillLoc(s.loc, locGlobalVar, vn, OnHeap)
|
||||
var decl: Rope = ""
|
||||
let td = getTypeDesc(p.module, vn.sym.typ, dkVar)
|
||||
genGlobalVarDecl(p, vn, td, "", decl)
|
||||
decl.add " " & $s.loc.r
|
||||
genCppVarForCtor(p, value, decl)
|
||||
p.module.s[cfsVars].add decl
|
||||
|
||||
proc assignGlobalVar(p: BProc, n: PNode; value: Rope) =
|
||||
let s = n.sym
|
||||
@@ -713,18 +717,6 @@ proc assignGlobalVar(p: BProc, n: PNode; value: Rope) =
|
||||
# fixes tests/run/tzeroarray:
|
||||
resetLoc(p, s.loc)
|
||||
|
||||
proc callGlobalVarCppCtor(p: BProc; v: PSym; vn, value: PNode; didGenTemp: var bool) =
|
||||
let s = vn.sym
|
||||
fillBackendName(p.module, s)
|
||||
fillLoc(s.loc, locGlobalVar, vn, OnHeap)
|
||||
var decl: Rope = ""
|
||||
let td = getTypeDesc(p.module, vn.sym.typ, dkVar)
|
||||
genGlobalVarDecl(p, vn, td, "", decl)
|
||||
decl.add " " & $s.loc.r
|
||||
genCppVarForCtor(p, value, decl, didGenTemp)
|
||||
if didGenTemp: return # generated in the caller
|
||||
p.module.s[cfsVars].add decl
|
||||
|
||||
proc assignParam(p: BProc, s: PSym, retType: PType) =
|
||||
assert(s.loc.r != "")
|
||||
scopeMangledParam(p, s)
|
||||
@@ -1073,11 +1065,7 @@ proc allPathsAsgnResult(p: BProc; n: PNode): InitResultEnum =
|
||||
if result != Unknown: return result
|
||||
of nkAsgn, nkFastAsgn, nkSinkAsgn:
|
||||
if n[0].kind == nkSym and n[0].sym.kind == skResult:
|
||||
if not containsResult(n[1]):
|
||||
if allPathsAsgnResult(p, n[1]) == InitRequired:
|
||||
result = InitRequired
|
||||
else:
|
||||
result = InitSkippable
|
||||
if not containsResult(n[1]): result = InitSkippable
|
||||
else: result = InitRequired
|
||||
elif containsResult(n):
|
||||
result = InitRequired
|
||||
@@ -1155,10 +1143,6 @@ proc allPathsAsgnResult(p: BProc; n: PNode): InitResultEnum =
|
||||
allPathsInBranch(n[i])
|
||||
of nkRaiseStmt:
|
||||
result = InitRequired
|
||||
of nkChckRangeF, nkChckRange64, nkChckRange:
|
||||
# TODO: more checks might need to be covered like overflow, indexDefect etc.
|
||||
# bug #22852
|
||||
result = InitRequired
|
||||
else:
|
||||
for i in 0..<n.safeLen:
|
||||
allPathsInBranch(n[i])
|
||||
@@ -1826,7 +1810,7 @@ proc genDatInitCode(m: BModule) =
|
||||
|
||||
# we don't want to break into such init code - could happen if a line
|
||||
# directive from a function written by the user spills after itself
|
||||
genCLineDir(prc, InvalidFileIdx, 999999, m.config)
|
||||
genCLineDir(prc, "generated_not_to_break_here", 999999, m.config)
|
||||
|
||||
for i in cfsTypeInit1..cfsDynLibInit:
|
||||
if m.s[i].len != 0:
|
||||
@@ -1867,7 +1851,7 @@ proc genInitCode(m: BModule) =
|
||||
[rope(if m.hcrOn: "N_LIB_EXPORT" else: "N_LIB_PRIVATE"), initname]
|
||||
# we don't want to break into such init code - could happen if a line
|
||||
# directive from a function written by the user spills after itself
|
||||
genCLineDir(prc, InvalidFileIdx, 999999, m.config)
|
||||
genCLineDir(prc, "generated_not_to_break_here", 999999, m.config)
|
||||
if m.typeNodes > 0:
|
||||
if m.hcrOn:
|
||||
appcg(m, m.s[cfsTypeInit1], "\t#TNimNode* $1;$N", [m.typeNodesName])
|
||||
@@ -1982,40 +1966,6 @@ proc genInitCode(m: BModule) =
|
||||
|
||||
registerModuleToMain(m.g, m)
|
||||
|
||||
proc postprocessCode(conf: ConfigRef, r: var Rope) =
|
||||
# find the first directive
|
||||
var f = r.find(postprocessDirStart)
|
||||
if f == -1:
|
||||
return
|
||||
|
||||
var
|
||||
nimlnDirLastF = ""
|
||||
|
||||
var res: Rope = r.substr(0, f - 1)
|
||||
while f != -1:
|
||||
var
|
||||
e = r.find(postprocessDirEnd, f + 1)
|
||||
dir = r.substr(f + 1, e - 1).split(postprocessDirSep)
|
||||
case dir[0]
|
||||
of "nimln":
|
||||
if dir[2] == nimlnDirLastF:
|
||||
res.add("nimln_(" & dir[1] & ");")
|
||||
else:
|
||||
res.add("nimlf_(" & dir[1] & ", " & quotedFilename(conf, dir[2].parseInt.FileIndex) & ");")
|
||||
nimlnDirLastF = dir[2]
|
||||
else:
|
||||
raiseAssert "unexpected postprocess directive"
|
||||
|
||||
# find the next directive
|
||||
f = r.find(postprocessDirStart, e + 1)
|
||||
# copy the code until the next directive
|
||||
if f != -1:
|
||||
res.add(r.substr(e + 1, f - 1))
|
||||
else:
|
||||
res.add(r.substr(e + 1))
|
||||
|
||||
r = res
|
||||
|
||||
proc genModule(m: BModule, cfile: Cfile): Rope =
|
||||
var moduleIsEmpty = true
|
||||
|
||||
@@ -2044,17 +1994,9 @@ proc genModule(m: BModule, cfile: Cfile): Rope =
|
||||
if m.config.cppCustomNamespace.len > 0:
|
||||
closeNamespaceNim(result)
|
||||
|
||||
if optLineDir in m.config.options:
|
||||
var srcFileDefs = ""
|
||||
for fi in 0..m.config.m.fileInfos.high:
|
||||
srcFileDefs.add("#define FX_" & $fi & " " & makeSingleLineCString(toFullPath(m.config, fi.FileIndex)) & "\n")
|
||||
result = srcFileDefs & result
|
||||
|
||||
if moduleIsEmpty:
|
||||
result = ""
|
||||
|
||||
postprocessCode(m.config, result)
|
||||
|
||||
proc initProcOptions(m: BModule): TOptions =
|
||||
let opts = m.config.options
|
||||
if sfSystemModule in m.module.flags: opts-{optStackTrace} else: opts
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
# dec a
|
||||
#
|
||||
# Should be transformed to:
|
||||
# case :state
|
||||
# of 0:
|
||||
# STATE0:
|
||||
# if a > 0:
|
||||
# echo "hi"
|
||||
# :state = 1 # Next state
|
||||
@@ -27,14 +26,12 @@
|
||||
# else:
|
||||
# :state = 2 # Next state
|
||||
# break :stateLoop # Proceed to the next state
|
||||
# of 1:
|
||||
# STATE1:
|
||||
# dec a
|
||||
# :state = 0 # Next state
|
||||
# break :stateLoop # Proceed to the next state
|
||||
# of 2:
|
||||
# STATE2:
|
||||
# :state = -1 # End of execution
|
||||
# else:
|
||||
# return
|
||||
|
||||
# The transformation should play well with lambdalifting, however depending
|
||||
# on situation, it can be called either before or after lambdalifting
|
||||
@@ -107,13 +104,12 @@
|
||||
# Is transformed to (yields are left in place for example simplicity,
|
||||
# in reality the code is subdivided even more, as described above):
|
||||
#
|
||||
# case :state
|
||||
# of 0: # Try
|
||||
# STATE0: # Try
|
||||
# yield 0
|
||||
# raise ...
|
||||
# :state = 2 # What would happen should we not raise
|
||||
# break :stateLoop
|
||||
# of 1: # Except
|
||||
# STATE1: # Except
|
||||
# yield 1
|
||||
# :tmpResult = 3 # Return
|
||||
# :unrollFinally = true # Return
|
||||
@@ -121,7 +117,7 @@
|
||||
# break :stateLoop
|
||||
# :state = 2 # What would happen should we not return
|
||||
# break :stateLoop
|
||||
# of 2: # Finally
|
||||
# STATE2: # Finally
|
||||
# yield 2
|
||||
# if :unrollFinally: # This node is created by `newEndFinallyNode`
|
||||
# if :curExc.isNil:
|
||||
@@ -134,8 +130,6 @@
|
||||
# raise
|
||||
# state = -1 # Goto next state. In this case we just exit
|
||||
# break :stateLoop
|
||||
# else:
|
||||
# return
|
||||
|
||||
import
|
||||
ast, msgs, idents,
|
||||
@@ -156,7 +150,7 @@ type
|
||||
unrollFinallySym: PSym # Indicates that we're unrolling finally states (either exception happened or premature return)
|
||||
curExcSym: PSym # Current exception
|
||||
|
||||
states: seq[tuple[label: int, body: PNode]] # The resulting states.
|
||||
states: seq[PNode] # The resulting states. Every state is an nkState node.
|
||||
blockLevel: int # Temp used to transform break and continue stmts
|
||||
stateLoopLabel: PSym # Label to break on, when jumping between states.
|
||||
exitStateIdx: int # index of the last state
|
||||
@@ -172,7 +166,6 @@ type
|
||||
const
|
||||
nkSkip = {nkEmpty..nkNilLit, nkTemplateDef, nkTypeSection, nkStaticStmt,
|
||||
nkCommentStmt, nkMixinStmt, nkBindStmt} + procDefs
|
||||
emptyStateLabel = -1
|
||||
|
||||
proc newStateAccess(ctx: var Ctx): PNode =
|
||||
if ctx.stateVarSym.isNil:
|
||||
@@ -194,7 +187,6 @@ proc newStateAssgn(ctx: var Ctx, stateNo: int = -2): PNode =
|
||||
proc newEnvVar(ctx: var Ctx, name: string, typ: PType): PSym =
|
||||
result = newSym(skVar, getIdent(ctx.g.cache, name), ctx.idgen, ctx.fn, ctx.fn.info)
|
||||
result.typ = typ
|
||||
result.flags.incl sfNoInit
|
||||
assert(not typ.isNil)
|
||||
|
||||
if not ctx.stateVarSym.isNil:
|
||||
@@ -236,7 +228,10 @@ proc newState(ctx: var Ctx, n, gotoOut: PNode): int =
|
||||
|
||||
result = ctx.states.len
|
||||
let resLit = ctx.g.newIntLit(n.info, result)
|
||||
ctx.states.add((result, n))
|
||||
let s = newNodeI(nkState, n.info)
|
||||
s.add(resLit)
|
||||
s.add(n)
|
||||
ctx.states.add(s)
|
||||
ctx.exceptionTable.add(ctx.curExcHandlingState)
|
||||
|
||||
if not gotoOut.isNil:
|
||||
@@ -268,8 +263,8 @@ proc hasYields(n: PNode): bool =
|
||||
result = false
|
||||
else:
|
||||
result = false
|
||||
for i in ord(n.kind == nkCast)..<n.len:
|
||||
if n[i].hasYields:
|
||||
for c in n:
|
||||
if c.hasYields:
|
||||
result = true
|
||||
break
|
||||
|
||||
@@ -453,10 +448,6 @@ proc newNotCall(g: ModuleGraph; e: PNode): PNode =
|
||||
result = newTree(nkCall, newSymNode(g.getSysMagic(e.info, "not", mNot), e.info), e)
|
||||
result.typ = g.getSysType(e.info, tyBool)
|
||||
|
||||
proc boolLit(g: ModuleGraph; info: TLineInfo; value: bool): PNode =
|
||||
result = newIntLit(g, info, ord value)
|
||||
result.typ = getSysType(g, info, tyBool)
|
||||
|
||||
proc lowerStmtListExprs(ctx: var Ctx, n: PNode, needsSplit: var bool): PNode =
|
||||
result = n
|
||||
case n.kind
|
||||
@@ -788,7 +779,7 @@ proc lowerStmtListExprs(ctx: var Ctx, n: PNode, needsSplit: var bool): PNode =
|
||||
let check = newTree(nkIfStmt, branch)
|
||||
let newBody = newTree(nkStmtList, st, check, n[1])
|
||||
|
||||
n[0] = ctx.g.boolLit(n[0].info, true)
|
||||
n[0] = newSymNode(ctx.g.getSysSym(n[0].info, "true"))
|
||||
n[1] = newBody
|
||||
|
||||
of nkDotExpr, nkCheckedFieldExpr:
|
||||
@@ -1142,10 +1133,10 @@ proc skipEmptyStates(ctx: Ctx, stateIdx: int): int =
|
||||
let label = stateIdx
|
||||
if label == ctx.exitStateIdx: break
|
||||
var newLabel = label
|
||||
if label == emptyStateLabel:
|
||||
if label == -1:
|
||||
newLabel = ctx.exitStateIdx
|
||||
else:
|
||||
let fs = skipStmtList(ctx, ctx.states[label].body)
|
||||
let fs = skipStmtList(ctx, ctx.states[label][1])
|
||||
if fs.kind == nkGotoState:
|
||||
newLabel = fs[0].intVal.int
|
||||
if label == newLabel: break
|
||||
@@ -1154,7 +1145,7 @@ proc skipEmptyStates(ctx: Ctx, stateIdx: int): int =
|
||||
if maxJumps == 0:
|
||||
assert(false, "Internal error")
|
||||
|
||||
result = ctx.states[stateIdx].label
|
||||
result = ctx.states[stateIdx][0].intVal.int
|
||||
|
||||
proc skipThroughEmptyStates(ctx: var Ctx, n: PNode): PNode=
|
||||
result = n
|
||||
@@ -1272,10 +1263,11 @@ proc wrapIntoTryExcept(ctx: var Ctx, n: PNode): PNode {.inline.} =
|
||||
proc wrapIntoStateLoop(ctx: var Ctx, n: PNode): PNode =
|
||||
# while true:
|
||||
# block :stateLoop:
|
||||
# gotoState :state
|
||||
# local vars decl (if needed)
|
||||
# body # Might get wrapped in try-except
|
||||
let loopBody = newNodeI(nkStmtList, n.info)
|
||||
result = newTree(nkWhileStmt, ctx.g.boolLit(n.info, true), loopBody)
|
||||
result = newTree(nkWhileStmt, newSymNode(ctx.g.getSysSym(n.info, "true")), loopBody)
|
||||
result.info = n.info
|
||||
|
||||
let localVars = newNodeI(nkStmtList, n.info)
|
||||
@@ -1290,7 +1282,11 @@ proc wrapIntoStateLoop(ctx: var Ctx, n: PNode): PNode =
|
||||
let blockStmt = newNodeI(nkBlockStmt, n.info)
|
||||
blockStmt.add(newSymNode(ctx.stateLoopLabel))
|
||||
|
||||
var blockBody = newTree(nkStmtList, localVars, n)
|
||||
let gs = newNodeI(nkGotoState, n.info)
|
||||
gs.add(ctx.newStateAccess())
|
||||
gs.add(ctx.g.newIntLit(n.info, ctx.states.len - 1))
|
||||
|
||||
var blockBody = newTree(nkStmtList, gs, localVars, n)
|
||||
if ctx.hasExceptions:
|
||||
blockBody = ctx.wrapIntoTryExcept(blockBody)
|
||||
|
||||
@@ -1303,28 +1299,29 @@ proc deleteEmptyStates(ctx: var Ctx) =
|
||||
|
||||
# Apply new state indexes and mark unused states with -1
|
||||
var iValid = 0
|
||||
for i, s in ctx.states.mpairs:
|
||||
let body = skipStmtList(ctx, s.body)
|
||||
for i, s in ctx.states:
|
||||
let body = skipStmtList(ctx, s[1])
|
||||
if body.kind == nkGotoState and i != ctx.states.len - 1 and i != 0:
|
||||
# This is an empty state. Mark with -1.
|
||||
s.label = emptyStateLabel
|
||||
s[0].intVal = -1
|
||||
else:
|
||||
s.label = iValid
|
||||
s[0].intVal = iValid
|
||||
inc iValid
|
||||
|
||||
for i, s in ctx.states:
|
||||
let body = skipStmtList(ctx, s.body)
|
||||
let body = skipStmtList(ctx, s[1])
|
||||
if body.kind != nkGotoState or i == 0:
|
||||
discard ctx.skipThroughEmptyStates(s.body)
|
||||
discard ctx.skipThroughEmptyStates(s)
|
||||
let excHandlState = ctx.exceptionTable[i]
|
||||
if excHandlState < 0:
|
||||
ctx.exceptionTable[i] = -ctx.skipEmptyStates(-excHandlState)
|
||||
elif excHandlState != 0:
|
||||
ctx.exceptionTable[i] = ctx.skipEmptyStates(excHandlState)
|
||||
|
||||
var i = 1 # ignore the entry and the exit
|
||||
var i = 0
|
||||
while i < ctx.states.len - 1:
|
||||
if ctx.states[i].label == emptyStateLabel:
|
||||
let fs = skipStmtList(ctx, ctx.states[i][1])
|
||||
if fs.kind == nkGotoState and i != 0:
|
||||
ctx.states.delete(i)
|
||||
ctx.exceptionTable.delete(i)
|
||||
else:
|
||||
@@ -1463,16 +1460,17 @@ proc transformClosureIterator*(g: ModuleGraph; idgen: IdGenerator; fn: PSym, n:
|
||||
# Optimize empty states away
|
||||
ctx.deleteEmptyStates()
|
||||
|
||||
let caseDispatcher = newTreeI(nkCaseStmt, n.info,
|
||||
ctx.newStateAccess())
|
||||
|
||||
# Make new body by concatenating the list of states
|
||||
result = newNodeI(nkStmtList, n.info)
|
||||
for s in ctx.states:
|
||||
let body = ctx.transformStateAssignments(s.body)
|
||||
caseDispatcher.add newTreeI(nkOfBranch, body.info, g.newIntLit(body.info, s.label), body)
|
||||
assert(s.len == 2)
|
||||
let body = s[1]
|
||||
s.sons.del(1)
|
||||
result.add(s)
|
||||
result.add(body)
|
||||
|
||||
caseDispatcher.add newTreeI(nkElse, n.info, newTreeI(nkReturnStmt, n.info, g.emptyNode))
|
||||
|
||||
result = wrapIntoStateLoop(ctx, caseDispatcher)
|
||||
result = ctx.transformStateAssignments(result)
|
||||
result = ctx.wrapIntoStateLoop(result)
|
||||
|
||||
when false:
|
||||
echo "TRANSFORM TO STATES: "
|
||||
|
||||
@@ -46,10 +46,10 @@ type
|
||||
case isTryBlock: bool
|
||||
of false:
|
||||
label: PSym
|
||||
breakFixups: seq[(TPosition, seq[PNode])] # Contains the gotos for the breaks along with their pending finales
|
||||
breakFixups: seq[(TPosition, seq[PNode])] #Contains the gotos for the breaks along with their pending finales
|
||||
of true:
|
||||
finale: PNode
|
||||
raiseFixups: seq[TPosition] # Contains the gotos for the raises
|
||||
raiseFixups: seq[TPosition] #Contains the gotos for the raises
|
||||
|
||||
Con = object
|
||||
code: ControlFlowGraph
|
||||
@@ -181,6 +181,14 @@ proc genIf(c: var Con, n: PNode) =
|
||||
goto Lend3
|
||||
L3:
|
||||
D
|
||||
goto Lend3 # not eliminated to simplify the join generation
|
||||
Lend3:
|
||||
join F3
|
||||
Lend2:
|
||||
join F2
|
||||
Lend:
|
||||
join F1
|
||||
|
||||
]#
|
||||
var endings: seq[TPosition] = @[]
|
||||
let oldInteresting = c.interestingInstructions
|
||||
@@ -205,6 +213,7 @@ proc genAndOr(c: var Con; n: PNode) =
|
||||
# fork lab1
|
||||
# asgn dest, b
|
||||
# lab1:
|
||||
# join F1
|
||||
c.gen(n[1])
|
||||
forkT:
|
||||
c.gen(n[2])
|
||||
@@ -315,7 +324,7 @@ proc genRaise(c: var Con; n: PNode) =
|
||||
if c.blocks[i].isTryBlock:
|
||||
genBreakOrRaiseAux(c, i, n)
|
||||
return
|
||||
assert false # Unreachable
|
||||
assert false #Unreachable
|
||||
else:
|
||||
genNoReturn(c)
|
||||
|
||||
@@ -381,6 +390,7 @@ proc genCall(c: var Con; n: PNode) =
|
||||
# fork lab1
|
||||
# goto exceptionHandler (except or finally)
|
||||
# lab1:
|
||||
# join F1
|
||||
forkT:
|
||||
for i in countdown(c.blocks.high, 0):
|
||||
if c.blocks[i].isTryBlock:
|
||||
|
||||
@@ -412,10 +412,7 @@ proc genDefaultCall(t: PType; c: Con; info: TLineInfo): PNode =
|
||||
proc destructiveMoveVar(n: PNode; c: var Con; s: var Scope): PNode =
|
||||
# generate: (let tmp = v; reset(v); tmp)
|
||||
if (not hasDestructor(c, n.typ)) and c.inEnsureMove == 0:
|
||||
assert n.kind != nkSym or not hasDestructor(c, n.sym.typ) or
|
||||
(n.typ.kind == tyPtr and n.sym.typ.kind == tyRef)
|
||||
# bug #23505; transformed by `transf`: addr (deref ref) -> ptr
|
||||
# we know it's really a pointer; so here we assign it directly
|
||||
assert n.kind != nkSym or not hasDestructor(c, n.sym.typ)
|
||||
result = copyTree(n)
|
||||
else:
|
||||
result = newNodeIT(nkStmtListExpr, n.info, n.typ)
|
||||
@@ -1186,9 +1183,9 @@ proc moveOrCopy(dest, ri: PNode; c: var Con; s: var Scope, flags: set[MoveOrCopy
|
||||
# Rule 3: `=sink`(x, z); wasMoved(z)
|
||||
let snk = c.genSink(s, dest, ri, flags)
|
||||
result = newTree(nkStmtList, snk, c.genWasMoved(ri))
|
||||
elif ri.sym.kind != skParam and
|
||||
isAnalysableFieldAccess(ri, c.owner) and
|
||||
isLastRead(ri, c, s) and canBeMoved(c, dest.typ):
|
||||
elif ri.sym.kind != skParam and ri.sym.owner == c.owner and
|
||||
isLastRead(ri, c, s) and canBeMoved(c, dest.typ) and not isCursor(ri) and
|
||||
not ({sfGlobal, sfPure} <= ri.sym.flags):
|
||||
# Rule 3: `=sink`(x, z); wasMoved(z)
|
||||
let snk = c.genSink(s, dest, ri, flags)
|
||||
result = newTree(nkStmtList, snk, c.genWasMoved(ri))
|
||||
|
||||
@@ -6,11 +6,11 @@ Name: "Nim"
|
||||
Version: "$version"
|
||||
Platforms: """
|
||||
windows: i386;amd64
|
||||
linux: i386;hppa;ia64;alpha;amd64;powerpc64;arm;sparc;sparc64;m68k;mips;mipsel;mips64;mips64el;powerpc;powerpc64el;arm64;riscv32;riscv64;loongarch64
|
||||
linux: i386;hppa;ia64;alpha;amd64;powerpc64;arm;sparc;sparc64;m68k;mips;mipsel;mips64;mips64el;powerpc;powerpc64el;arm64;riscv32;riscv64
|
||||
macosx: i386;amd64;powerpc64;arm64
|
||||
solaris: i386;amd64;sparc;sparc64
|
||||
freebsd: i386;amd64;powerpc64;arm;arm64;riscv64;sparc64;mips;mipsel;mips64;mips64el;powerpc;powerpc64el
|
||||
netbsd: i386;amd64;arm64
|
||||
netbsd: i386;amd64
|
||||
openbsd: i386;amd64;arm;arm64
|
||||
dragonfly: i386;amd64
|
||||
crossos: amd64
|
||||
|
||||
@@ -110,6 +110,7 @@ type
|
||||
unique: int # for temp identifier generation
|
||||
blocks: seq[TBlock]
|
||||
extraIndent: int
|
||||
declaredGlobals: IntSet
|
||||
previousFileName: string # For frameInfo inside templates.
|
||||
|
||||
template config*(p: PProc): ConfigRef = p.module.config
|
||||
@@ -168,6 +169,10 @@ proc initProcOptions(module: BModule): TOptions =
|
||||
proc newInitProc(globals: PGlobals, module: BModule): PProc =
|
||||
result = newProc(globals, module, nil, initProcOptions(module))
|
||||
|
||||
proc declareGlobal(p: PProc; id: int; r: Rope) =
|
||||
if p.prc != nil and not p.declaredGlobals.containsOrIncl(id):
|
||||
p.locals.addf("global $1;$n", [r])
|
||||
|
||||
const
|
||||
MappedToObject = {tyObject, tyArray, tyTuple, tyOpenArray,
|
||||
tySet, tyVarargs}
|
||||
@@ -1018,7 +1023,7 @@ proc genCaseJS(p: PProc, n: PNode, r: var TCompRes) =
|
||||
a, b, cond, stmt: TCompRes = default(TCompRes)
|
||||
genLineDir(p, n)
|
||||
gen(p, n[0], cond)
|
||||
let typeKind = skipTypes(n[0].typ, abstractVar+{tyRange}).kind
|
||||
let typeKind = skipTypes(n[0].typ, abstractVar).kind
|
||||
var transferRange = false
|
||||
let anyString = typeKind in {tyString, tyCstring}
|
||||
case typeKind
|
||||
@@ -1241,7 +1246,7 @@ proc needsNoCopy(p: PProc; y: PNode): bool =
|
||||
return y.kind in nodeKindsNeedNoCopy or
|
||||
((mapType(y.typ) != etyBaseIndex) and
|
||||
(skipTypes(y.typ, abstractInst).kind in
|
||||
{tyRef, tyPtr, tyLent, tyVar, tyCstring, tyProc, tyOwned, tyOpenArray} + IntegralTypes))
|
||||
{tyRef, tyPtr, tyLent, tyVar, tyCstring, tyProc, tyOwned} + IntegralTypes))
|
||||
|
||||
proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) =
|
||||
var a, b: TCompRes = default(TCompRes)
|
||||
@@ -1268,7 +1273,7 @@ proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) =
|
||||
lineF(p, "$1 = nimCopy(null, $2, $3);$n",
|
||||
[a.rdLoc, b.res, genTypeInfo(p, y.typ)])
|
||||
of etyObject:
|
||||
if x.typ.kind in {tyVar, tyLent, tyOpenArray, tyVarargs} or (needsNoCopy(p, y) and needsNoCopy(p, x)) or noCopyNeeded:
|
||||
if x.typ.kind in {tyVar, tyLent} or (needsNoCopy(p, y) and needsNoCopy(p, x)) or noCopyNeeded:
|
||||
lineF(p, "$1 = $2;$n", [a.rdLoc, b.rdLoc])
|
||||
else:
|
||||
useMagic(p, "nimCopy")
|
||||
@@ -1456,7 +1461,7 @@ proc genArrayAddr(p: PProc, n: PNode, r: var TCompRes) =
|
||||
r.kind = resExpr
|
||||
|
||||
proc genArrayAccess(p: PProc, n: PNode, r: var TCompRes) =
|
||||
var ty = skipTypes(n[0].typ, abstractVarRange+tyUserTypeClasses)
|
||||
var ty = skipTypes(n[0].typ, abstractVarRange)
|
||||
if ty.kind in {tyRef, tyPtr, tyLent, tyOwned}: ty = skipTypes(ty.elementType, abstractVarRange)
|
||||
case ty.kind
|
||||
of tyArray, tyOpenArray, tySequence, tyString, tyCstring, tyVarargs:
|
||||
@@ -1966,7 +1971,7 @@ proc createVar(p: PProc, typ: PType, indirect: bool): Rope =
|
||||
result = putToSeq("null", indirect)
|
||||
of tySequence, tyString:
|
||||
result = putToSeq("[]", indirect)
|
||||
of tyCstring, tyProc, tyOpenArray:
|
||||
of tyCstring, tyProc:
|
||||
result = putToSeq("null", indirect)
|
||||
of tyStatic:
|
||||
if t.n != nil:
|
||||
@@ -2018,7 +2023,7 @@ proc genVarInit(p: PProc, v: PSym, n: PNode) =
|
||||
gen(p, n, a)
|
||||
case mapType(p, v.typ)
|
||||
of etyObject, etySeq:
|
||||
if v.typ.kind in {tyOpenArray, tyVarargs} or needsNoCopy(p, n):
|
||||
if needsNoCopy(p, n):
|
||||
s = a.res
|
||||
else:
|
||||
useMagic(p, "nimCopy")
|
||||
@@ -2132,20 +2137,20 @@ proc genConStrStr(p: PProc, n: PNode, r: var TCompRes) =
|
||||
if skipTypes(n[1].typ, abstractVarRange).kind == tyChar:
|
||||
r.res.add("[$1].concat(" % [a.res])
|
||||
else:
|
||||
r.res.add("($1).concat(" % [a.res])
|
||||
r.res.add("($1 || []).concat(" % [a.res])
|
||||
|
||||
for i in 2..<n.len - 1:
|
||||
gen(p, n[i], a)
|
||||
if skipTypes(n[i].typ, abstractVarRange).kind == tyChar:
|
||||
r.res.add("[$1]," % [a.res])
|
||||
else:
|
||||
r.res.add("$1," % [a.res])
|
||||
r.res.add("$1 || []," % [a.res])
|
||||
|
||||
gen(p, n[^1], a)
|
||||
if skipTypes(n[^1].typ, abstractVarRange).kind == tyChar:
|
||||
r.res.add("[$1])" % [a.res])
|
||||
else:
|
||||
r.res.add("$1)" % [a.res])
|
||||
r.res.add("$1 || [])" % [a.res])
|
||||
|
||||
proc genReprAux(p: PProc, n: PNode, r: var TCompRes, magic: string, typ: Rope = "") =
|
||||
useMagic(p, magic)
|
||||
@@ -2212,17 +2217,16 @@ proc genDefault(p: PProc, n: PNode; r: var TCompRes) =
|
||||
r.res = createVar(p, n.typ, indirect = false)
|
||||
r.kind = resExpr
|
||||
|
||||
proc genWasMoved(p: PProc, n: PNode) =
|
||||
# TODO: it should be done by nir
|
||||
proc genReset(p: PProc, n: PNode) =
|
||||
var x: TCompRes = default(TCompRes)
|
||||
useMagic(p, "genericReset")
|
||||
gen(p, n[1], x)
|
||||
if x.typ == etyBaseIndex:
|
||||
lineF(p, "$1 = null, $2 = 0;$n", [x.address, x.res])
|
||||
else:
|
||||
var y: TCompRes = default(TCompRes)
|
||||
genDefault(p, n[1], y)
|
||||
let (a, _) = maybeMakeTempAssignable(p, n[1], x)
|
||||
lineF(p, "$1 = $2;$n", [a, y.rdLoc])
|
||||
let (a, tmp) = maybeMakeTempAssignable(p, n[1], x)
|
||||
lineF(p, "$1 = genericReset($3, $2);$n", [a,
|
||||
genTypeInfo(p, n[1].typ), tmp])
|
||||
|
||||
proc genMove(p: PProc; n: PNode; r: var TCompRes) =
|
||||
var a: TCompRes = default(TCompRes)
|
||||
@@ -2230,7 +2234,7 @@ proc genMove(p: PProc; n: PNode; r: var TCompRes) =
|
||||
r.res = p.getTemp()
|
||||
gen(p, n[1], a)
|
||||
lineF(p, "$1 = $2;$n", [r.rdLoc, a.rdLoc])
|
||||
genWasMoved(p, n)
|
||||
genReset(p, n)
|
||||
#lineF(p, "$1 = $2;$n", [dest.rdLoc, src.rdLoc])
|
||||
|
||||
proc genDup(p: PProc; n: PNode; r: var TCompRes) =
|
||||
@@ -2411,7 +2415,7 @@ proc genMagic(p: PProc, n: PNode, r: var TCompRes) =
|
||||
of mNewSeqOfCap: unaryExpr(p, n, r, "", "[]")
|
||||
of mOf: genOf(p, n, r)
|
||||
of mDefault, mZeroDefault: genDefault(p, n, r)
|
||||
of mWasMoved: genWasMoved(p, n)
|
||||
of mReset, mWasMoved: genReset(p, n)
|
||||
of mEcho: genEcho(p, n, r)
|
||||
of mNLen..mNError, mSlurp, mStaticExec:
|
||||
localError(p.config, n.info, errXMustBeCompileTime % n[0].sym.name.s)
|
||||
@@ -2989,8 +2993,11 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) =
|
||||
of nkRaiseStmt: genRaiseStmt(p, n)
|
||||
of nkTypeSection, nkCommentStmt, nkIncludeStmt,
|
||||
nkImportStmt, nkImportExceptStmt, nkExportStmt, nkExportExceptStmt,
|
||||
nkFromStmt, nkTemplateDef, nkMacroDef, nkIteratorDef, nkStaticStmt,
|
||||
nkFromStmt, nkTemplateDef, nkMacroDef, nkStaticStmt,
|
||||
nkMixinStmt, nkBindStmt: discard
|
||||
of nkIteratorDef:
|
||||
if n[0].sym.typ.callConv == TCallingConvention.ccClosure:
|
||||
globalError(p.config, n.info, "Closure iterators are not supported by JS backend!")
|
||||
of nkPragma: genPragma(p, n)
|
||||
of nkProcDef, nkFuncDef, nkMethodDef, nkConverterDef:
|
||||
var s = n[namePos].sym
|
||||
@@ -2998,18 +3005,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) =
|
||||
genSym(p, n[namePos], r)
|
||||
r.res = ""
|
||||
of nkGotoState, nkState:
|
||||
globalError(p.config, n.info, "not implemented")
|
||||
of nkBreakState:
|
||||
var a: TCompRes = default(TCompRes)
|
||||
if n[0].kind == nkClosure:
|
||||
gen(p, n[0][1], a)
|
||||
let sym = n[0][1].typ[0].n[0].sym
|
||||
r.res = "(($1).$2 < 0)" % [rdLoc(a), mangleName(p.module, sym)]
|
||||
else:
|
||||
gen(p, n[0], a)
|
||||
let sym = n[0].typ[0].n[0].sym
|
||||
r.res = "((($1.ClE_0).$2) < 0)" % [rdLoc(a), mangleName(p.module, sym)]
|
||||
r.kind = resExpr
|
||||
globalError(p.config, n.info, "First class iterators not implemented")
|
||||
of nkPragmaBlock: gen(p, n.lastSon, r)
|
||||
of nkComesFrom:
|
||||
discard "XXX to implement for better stack traces"
|
||||
@@ -3116,6 +3112,15 @@ proc wholeCode(graph: ModuleGraph; m: BModule): Rope =
|
||||
|
||||
result = globals.typeInfo & globals.constants & globals.code
|
||||
|
||||
proc getClassName(t: PType): Rope =
|
||||
var s = t.sym
|
||||
if s.isNil or sfAnon in s.flags:
|
||||
s = skipTypes(t, abstractPtrs).sym
|
||||
if s.isNil or sfAnon in s.flags:
|
||||
doAssert(false, "cannot retrieve class name")
|
||||
if s.loc.r != "": result = s.loc.r
|
||||
else: result = rope(s.name.s)
|
||||
|
||||
proc finalJSCodeGen*(graph: ModuleGraph; b: PPassContext, n: PNode): PNode =
|
||||
## Finalize JS code generation of a Nim module.
|
||||
## Param `n` may contain nodes returned from the last module close call.
|
||||
|
||||
@@ -258,7 +258,8 @@ proc liftIterSym*(g: ModuleGraph; n: PNode; idgen: IdGenerator; owner: PSym): PN
|
||||
let iter = n.sym
|
||||
assert iter.isIterator
|
||||
|
||||
result = newNodeIT(nkStmtListExpr, n.info, iter.typ)
|
||||
result = newNodeIT(nkStmtListExpr, n.info, n.typ)
|
||||
|
||||
let hp = getHiddenParam(g, iter)
|
||||
var env: PNode
|
||||
if owner.isIterator:
|
||||
@@ -460,7 +461,6 @@ proc detectCapturedVars(n: PNode; owner: PSym; c: var DetectionPass) =
|
||||
#let obj = c.getEnvTypeForOwner(s.owner).skipTypes({tyOwned, tyRef, tyPtr})
|
||||
|
||||
if s.name.id == getIdent(c.graph.cache, ":state").id:
|
||||
obj.n[0].sym.flags.incl sfNoInit
|
||||
obj.n[0].sym.itemId = ItemId(module: s.itemId.module, item: -s.itemId.item)
|
||||
else:
|
||||
discard addField(obj, s, c.graph.cache, c.idgen)
|
||||
|
||||
@@ -40,7 +40,7 @@ template asink*(t: PType): PSym = getAttachedOp(c.g, t, attachedSink)
|
||||
|
||||
proc fillBody(c: var TLiftCtx; t: PType; body, x, y: PNode)
|
||||
proc produceSym(g: ModuleGraph; c: PContext; typ: PType; kind: TTypeAttachedOp;
|
||||
info: TLineInfo; idgen: IdGenerator; isDistinct = false): PSym
|
||||
info: TLineInfo; idgen: IdGenerator): PSym
|
||||
|
||||
proc createTypeBoundOps*(g: ModuleGraph; c: PContext; orig: PType; info: TLineInfo;
|
||||
idgen: IdGenerator)
|
||||
@@ -222,10 +222,7 @@ proc fillBodyObj(c: var TLiftCtx; n, body, x, y: PNode; enforceDefaultOp: bool)
|
||||
|
||||
proc fillBodyObjTImpl(c: var TLiftCtx; t: PType, body, x, y: PNode) =
|
||||
if t.baseClass != nil:
|
||||
let obj = newNodeIT(nkHiddenSubConv, c.info, t.baseClass)
|
||||
obj.add newNodeI(nkEmpty, c.info)
|
||||
obj.add x
|
||||
fillBody(c, skipTypes(t.baseClass, abstractPtrs), body, obj, y)
|
||||
fillBody(c, skipTypes(t.baseClass, abstractPtrs), body, x, y)
|
||||
fillBodyObj(c, t.n, body, x, y, enforceDefaultOp = false)
|
||||
|
||||
proc fillBodyObjT(c: var TLiftCtx; t: PType, body, x, y: PNode) =
|
||||
@@ -1054,9 +1051,7 @@ proc produceSymDistinctType(g: ModuleGraph; c: PContext; typ: PType;
|
||||
assert typ.kind == tyDistinct
|
||||
let baseType = typ.elementType
|
||||
if getAttachedOp(g, baseType, kind) == nil:
|
||||
# TODO: fixme `isDistinct` is a fix for #23552; remove it after
|
||||
# `-d:nimPreviewNonVarDestructor` becomes the default
|
||||
discard produceSym(g, c, baseType, kind, info, idgen, isDistinct = true)
|
||||
discard produceSym(g, c, baseType, kind, info, idgen)
|
||||
result = getAttachedOp(g, baseType, kind)
|
||||
setAttachedOp(g, idgen.module, typ, kind, result)
|
||||
|
||||
@@ -1095,7 +1090,7 @@ proc symDupPrototype(g: ModuleGraph; typ: PType; owner: PSym; kind: TTypeAttache
|
||||
incl result.flags, sfGeneratedOp
|
||||
|
||||
proc symPrototype(g: ModuleGraph; typ: PType; owner: PSym; kind: TTypeAttachedOp;
|
||||
info: TLineInfo; idgen: IdGenerator; isDiscriminant = false; isDistinct = false): PSym =
|
||||
info: TLineInfo; idgen: IdGenerator; isDiscriminant = false): PSym =
|
||||
if kind == attachedDup:
|
||||
return symDupPrototype(g, typ, owner, kind, info, idgen)
|
||||
|
||||
@@ -1106,7 +1101,7 @@ proc symPrototype(g: ModuleGraph; typ: PType; owner: PSym; kind: TTypeAttachedOp
|
||||
idgen, result, info)
|
||||
|
||||
if kind == attachedDestructor and g.config.selectedGC in {gcArc, gcOrc, gcAtomicArc} and
|
||||
((g.config.isDefined("nimPreviewNonVarDestructor") and not isDiscriminant) or (typ.kind in {tyRef, tyString, tySequence} and not isDistinct)):
|
||||
((g.config.isDefined("nimPreviewNonVarDestructor") and not isDiscriminant) or typ.kind in {tyRef, tyString, tySequence}):
|
||||
dest.typ = typ
|
||||
else:
|
||||
dest.typ = makeVarType(typ.owner, typ, idgen)
|
||||
@@ -1148,13 +1143,13 @@ proc genTypeFieldCopy(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||
body.add newAsgnStmt(xx, yy)
|
||||
|
||||
proc produceSym(g: ModuleGraph; c: PContext; typ: PType; kind: TTypeAttachedOp;
|
||||
info: TLineInfo; idgen: IdGenerator; isDistinct = false): PSym =
|
||||
info: TLineInfo; idgen: IdGenerator): PSym =
|
||||
if typ.kind == tyDistinct:
|
||||
return produceSymDistinctType(g, c, typ, kind, info, idgen)
|
||||
|
||||
result = getAttachedOp(g, typ, kind)
|
||||
if result == nil:
|
||||
result = symPrototype(g, typ, typ.owner, kind, info, idgen, isDistinct = isDistinct)
|
||||
result = symPrototype(g, typ, typ.owner, kind, info, idgen)
|
||||
|
||||
var a = TLiftCtx(info: info, g: g, kind: kind, c: c, asgnForType: typ, idgen: idgen,
|
||||
fn: result)
|
||||
|
||||
@@ -95,7 +95,6 @@ type
|
||||
warnGenericsIgnoredInjection = "GenericsIgnoredInjection",
|
||||
warnStdPrefix = "StdPrefix"
|
||||
warnUser = "User",
|
||||
warnGlobalVarConstructorTemporary = "GlobalVarConstructorTemporary",
|
||||
# hints
|
||||
hintSuccess = "Success", hintSuccessX = "SuccessX",
|
||||
hintCC = "CC",
|
||||
@@ -201,7 +200,6 @@ const
|
||||
warnGenericsIgnoredInjection: "$1",
|
||||
warnStdPrefix: "$1 needs the 'std' prefix",
|
||||
warnUser: "$1",
|
||||
warnGlobalVarConstructorTemporary: "global variable '$1' initialization requires a temporary variable",
|
||||
hintSuccess: "operation successful: $#",
|
||||
# keep in sync with `testament.isSuccess`
|
||||
hintSuccessX: "$build\n$loc lines; ${sec}s; $mem; proj: $project; out: $output",
|
||||
|
||||
@@ -651,16 +651,13 @@ template lintReport*(conf: ConfigRef; info: TLineInfo, beau, got: string, extraM
|
||||
let msg = if optStyleError in conf.globalOptions: errGenerated else: hintName
|
||||
liMessage(conf, info, msg, m, doNothing, instLoc())
|
||||
|
||||
proc quotedFilename*(conf: ConfigRef; fi: FileIndex): Rope =
|
||||
if fi.int32 < 0:
|
||||
proc quotedFilename*(conf: ConfigRef; i: TLineInfo): Rope =
|
||||
if i.fileIndex.int32 < 0:
|
||||
result = makeCString "???"
|
||||
elif optExcessiveStackTrace in conf.globalOptions:
|
||||
result = conf.m.fileInfos[fi.int32].quotedFullName
|
||||
result = conf.m.fileInfos[i.fileIndex.int32].quotedFullName
|
||||
else:
|
||||
result = conf.m.fileInfos[fi.int32].quotedName
|
||||
|
||||
proc quotedFilename*(conf: ConfigRef; i: TLineInfo): Rope =
|
||||
quotedFilename(conf, i.fileIndex)
|
||||
result = conf.m.fileInfos[i.fileIndex.int32].quotedName
|
||||
|
||||
template listMsg(title, r) =
|
||||
msgWriteln(conf, title, {msgNoUnitSep})
|
||||
|
||||
@@ -1896,7 +1896,7 @@ proc genMagic(c: var ProcCon; n: PNode; d: var Value; m: TMagic) =
|
||||
of mDefault, mZeroDefault:
|
||||
genDefault c, n, d
|
||||
of mMove: genMove(c, n, d)
|
||||
of mWasMoved:
|
||||
of mWasMoved, mReset:
|
||||
unused(c, n, d)
|
||||
genWasMoved(c, n)
|
||||
of mDestroy: genDestroy(c, n)
|
||||
|
||||
@@ -88,7 +88,7 @@ const
|
||||
wGensym, wInject,
|
||||
wIntDefine, wStrDefine, wBoolDefine, wDefine,
|
||||
wCompilerProc, wCore}
|
||||
paramPragmas* = {wNoalias, wInject, wGensym, wByRef, wByCopy, wCodegenDecl, wExportc, wExportCpp}
|
||||
paramPragmas* = {wNoalias, wInject, wGensym, wByRef, wByCopy, wCodegenDecl}
|
||||
letPragmas* = varPragmas
|
||||
procTypePragmas* = {FirstCallConv..LastCallConv, wVarargs, wNoSideEffect,
|
||||
wThread, wRaises, wEffectsOf, wLocks, wTags, wForbids, wGcSafe,
|
||||
@@ -480,18 +480,6 @@ proc processOption(c: PContext, n: PNode, resOptions: var TOptions) =
|
||||
# calling conventions (boring...):
|
||||
localError(c.config, n.info, "option expected")
|
||||
|
||||
proc checkPushedPragma(c: PContext, n: PNode) =
|
||||
let keyDeep = n.kind in nkPragmaCallKinds and n.len > 1
|
||||
var key = if keyDeep: n[0] else: n
|
||||
if key.kind in nkIdentKinds:
|
||||
let ident = considerQuotedIdent(c, key)
|
||||
var userPragma = strTableGet(c.userPragmas, ident)
|
||||
if userPragma == nil:
|
||||
let k = whichKeyword(ident)
|
||||
# TODO: might as well make a list which is not accepted by `push`: emit, cast etc.
|
||||
if k == wEmit:
|
||||
localError(c.config, n.info, "an 'emit' pragma cannot be pushed")
|
||||
|
||||
proc processPush(c: PContext, n: PNode, start: int) =
|
||||
if n[start-1].kind in nkPragmaCallKinds:
|
||||
localError(c.config, n.info, "'push' cannot have arguments")
|
||||
@@ -499,7 +487,6 @@ proc processPush(c: PContext, n: PNode, start: int) =
|
||||
for i in start..<n.len:
|
||||
if not tryProcessOption(c, n[i], c.config.options):
|
||||
# simply store it somewhere:
|
||||
checkPushedPragma(c, n[i])
|
||||
if x.otherPragmas.isNil:
|
||||
x.otherPragmas = newNodeI(nkPragma, n.info)
|
||||
x.otherPragmas.add n[i]
|
||||
|
||||
@@ -21,7 +21,7 @@ import
|
||||
extccomp
|
||||
|
||||
import vtables
|
||||
import std/[strtabs, math, tables, intsets, strutils, packedsets]
|
||||
import std/[strtabs, math, tables, intsets, strutils]
|
||||
|
||||
when not defined(leanCompiler):
|
||||
import spawn
|
||||
|
||||
@@ -168,8 +168,6 @@ type
|
||||
inUncheckedAssignSection*: int
|
||||
importModuleLookup*: Table[int, seq[int]] # (module.ident.id, [module.id])
|
||||
skipTypes*: seq[PNode] # used to skip types between passes in type section. So far only used for inheritance, sets and generic bodies.
|
||||
delayedEffects*: Table[ItemId, seq[PSym]]
|
||||
delayedEffectsInverted*: Table[ItemId, ItemId]
|
||||
TBorrowState* = enum
|
||||
bsNone, bsReturnNotMatch, bsNoDistinct, bsGeneric, bsNotSupported, bsMatch
|
||||
|
||||
|
||||
@@ -518,9 +518,8 @@ proc isOpImpl(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
result.typ = n.typ
|
||||
|
||||
proc semIs(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
if n.len != 3 or n[2].kind == nkEmpty:
|
||||
if n.len != 3:
|
||||
localError(c.config, n.info, "'is' operator takes 2 arguments")
|
||||
return errorNode(c, n)
|
||||
|
||||
let boolType = getSysType(c.graph, n.info, tyBool)
|
||||
result = n
|
||||
@@ -815,7 +814,7 @@ proc analyseIfAddressTakenInCall(c: PContext, n: PNode, isConverter = false) =
|
||||
const
|
||||
FakeVarParams = {mNew, mNewFinalize, mInc, ast.mDec, mIncl, mExcl,
|
||||
mSetLengthStr, mSetLengthSeq, mAppendStrCh, mAppendStrStr, mSwap,
|
||||
mAppendSeqElem, mNewSeq, mShallowCopy, mDeepCopy, mMove,
|
||||
mAppendSeqElem, mNewSeq, mReset, mShallowCopy, mDeepCopy, mMove,
|
||||
mWasMoved}
|
||||
|
||||
template checkIfConverterCalled(c: PContext, n: PNode) =
|
||||
@@ -1021,14 +1020,10 @@ proc finishOperand(c: PContext, a: PNode): PNode =
|
||||
localError(c.config, a.info, err)
|
||||
considerGenSyms(c, result)
|
||||
|
||||
proc semFinishOperands(c: PContext; n: PNode; isBracketExpr = false) =
|
||||
proc semFinishOperands(c: PContext; n: PNode) =
|
||||
# this needs to be called to ensure that after overloading resolution every
|
||||
# argument has been sem'checked
|
||||
|
||||
# skip the first argument for operands of `[]` since it may be an unresolved
|
||||
# generic proc, which is handled in semMagic
|
||||
let start = 1 + ord(isBracketExpr)
|
||||
for i in start..<n.len:
|
||||
# argument has been sem'checked:
|
||||
for i in 1..<n.len:
|
||||
n[i] = finishOperand(c, n[i])
|
||||
|
||||
proc afterCallActions(c: PContext; n, orig: PNode, flags: TExprFlags; expectedType: PType = nil): PNode =
|
||||
@@ -1051,7 +1046,10 @@ proc afterCallActions(c: PContext; n, orig: PNode, flags: TExprFlags; expectedTy
|
||||
of skMacro: result = semMacroExpr(c, result, orig, callee, flags, expectedType)
|
||||
of skTemplate: result = semTemplateExpr(c, result, callee, flags, expectedType)
|
||||
else:
|
||||
semFinishOperands(c, result, isBracketExpr = callee.magic in {mArrGet, mArrPut})
|
||||
if callee.magic notin {mArrGet, mArrPut, mNBindSym}:
|
||||
# calls to `[]` can be explicit generic instantiations,
|
||||
# don't sem every operand now, leave it to semmagic
|
||||
semFinishOperands(c, result)
|
||||
activate(c, result)
|
||||
fixAbstractType(c, result)
|
||||
analyseIfAddressTakenInCall(c, result)
|
||||
@@ -1188,7 +1186,7 @@ proc semExprNoType(c: PContext, n: PNode): PNode =
|
||||
let isPush = c.config.hasHint(hintExtendedContext)
|
||||
if isPush: pushInfoContext(c.config, n.info)
|
||||
result = semExpr(c, n, {efWantStmt})
|
||||
discardCheck(c, result, {})
|
||||
result = discardCheck(c, result, {})
|
||||
if isPush: popInfoContext(c.config)
|
||||
|
||||
proc isTypeExpr(n: PNode): bool =
|
||||
@@ -2024,7 +2022,7 @@ proc semProcBody(c: PContext, n: PNode; expectedType: PType = nil): PNode =
|
||||
a[1] = result
|
||||
result = semAsgn(c, a)
|
||||
else:
|
||||
discardCheck(c, result, {})
|
||||
result = discardCheck(c, result, {})
|
||||
|
||||
if c.p.owner.kind notin {skMacro, skTemplate} and
|
||||
c.p.resultSym != nil and c.p.resultSym.typ.isMetaType:
|
||||
@@ -2944,18 +2942,6 @@ proc asBracketExpr(c: PContext; n: PNode): PNode =
|
||||
return result
|
||||
return nil
|
||||
|
||||
proc isOpenArraySym(x: PNode): bool =
|
||||
var x = x
|
||||
while true:
|
||||
case x.kind
|
||||
of {nkAddr, nkHiddenAddr}:
|
||||
x = x[0]
|
||||
of {nkHiddenStdConv, nkHiddenDeref}:
|
||||
x = x[1]
|
||||
else:
|
||||
break
|
||||
result = x.kind == nkSym
|
||||
|
||||
proc hoistParamsUsedInDefault(c: PContext, call, letSection, defExpr: var PNode) =
|
||||
# This takes care of complicated signatures such as:
|
||||
# proc foo(a: int, b = a)
|
||||
@@ -2976,10 +2962,7 @@ proc hoistParamsUsedInDefault(c: PContext, call, letSection, defExpr: var PNode)
|
||||
if defExpr.kind == nkSym and defExpr.sym.kind == skParam and defExpr.sym.owner == call[0].sym:
|
||||
let paramPos = defExpr.sym.position + 1
|
||||
|
||||
if call[paramPos].skipAddr.kind != nkSym and not (
|
||||
skipTypes(call[paramPos].typ, abstractVar).kind in {tyOpenArray, tyVarargs} and
|
||||
isOpenArraySym(call[paramPos])
|
||||
):
|
||||
if call[paramPos].skipAddr.kind != nkSym:
|
||||
let hoistedVarSym = newSym(skLet, getIdent(c.graph.cache, genPrefix), c.idgen,
|
||||
c.p.owner, letSection.info, c.p.owner.options)
|
||||
hoistedVarSym.typ = call[paramPos].typ
|
||||
@@ -3005,7 +2988,7 @@ proc getNilType(c: PContext): PType =
|
||||
result.align = c.config.target.ptrSize.int16
|
||||
c.nilTypeCache = result
|
||||
|
||||
proc enumFieldSymChoice(c: PContext, n: PNode, s: PSym; flags: TExprFlags): PNode =
|
||||
proc enumFieldSymChoice(c: PContext, n: PNode, s: PSym): PNode =
|
||||
var o: TOverloadIter = default(TOverloadIter)
|
||||
var i = 0
|
||||
var a = initOverloadIter(o, c, n)
|
||||
@@ -3018,7 +3001,7 @@ proc enumFieldSymChoice(c: PContext, n: PNode, s: PSym; flags: TExprFlags): PNod
|
||||
if i <= 1:
|
||||
if sfGenSym notin s.flags:
|
||||
result = newSymNode(s, info)
|
||||
markUsed(c, info, s, efInCall notin flags)
|
||||
markUsed(c, info, s)
|
||||
onUse(info, s)
|
||||
else:
|
||||
result = n
|
||||
@@ -3043,8 +3026,15 @@ proc resolveIdentToSym(c: PContext, n: PNode, resultNode: var PNode,
|
||||
flags: TExprFlags, expectedType: PType): PSym =
|
||||
# result is nil on error or if a node that can't produce a sym is resolved
|
||||
let ident = considerQuotedIdent(c, n)
|
||||
if expectedType != nil and (
|
||||
let expected = expectedType.skipTypes(abstractRange-{tyDistinct});
|
||||
expected.kind == tyEnum):
|
||||
let nameId = ident.id
|
||||
for f in expected.n:
|
||||
if f.kind == nkSym and f.sym.name.id == nameId:
|
||||
return f.sym
|
||||
var filter = {low(TSymKind)..high(TSymKind)}
|
||||
if efNoEvaluateGeneric in flags or expectedType != nil:
|
||||
if efNoEvaluateGeneric in flags:
|
||||
# `a[...]` where `a` is a module or package is not possible
|
||||
filter.excl {skModule, skPackage}
|
||||
let candidates = lookUpCandidates(c, ident, filter)
|
||||
@@ -3135,7 +3125,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}, expectedType: PType
|
||||
if optOwnedRefs in c.config.globalOptions:
|
||||
result.typ = makeVarType(c, result.typ, tyOwned)
|
||||
of skEnumField:
|
||||
result = enumFieldSymChoice(c, n, s, flags)
|
||||
result = enumFieldSymChoice(c, n, s)
|
||||
else:
|
||||
result = semSym(c, n, s, flags)
|
||||
if isSymChoice(result):
|
||||
|
||||
@@ -237,7 +237,7 @@ proc evalTypeTrait(c: PContext; traitCall: PNode, operand: PType, context: PSym)
|
||||
proc semTypeTraits(c: PContext, n: PNode): PNode =
|
||||
checkMinSonsLen(n, 2, c.config)
|
||||
let t = n[1].typ
|
||||
internalAssert c.config, t != nil and t.skipTypes({tyAlias}).kind == tyTypeDesc
|
||||
internalAssert c.config, t != nil and t.kind == tyTypeDesc
|
||||
if t.len > 0:
|
||||
# This is either a type known to sem or a typedesc
|
||||
# param to a regular proc (again, known at instantiation)
|
||||
|
||||
@@ -1024,14 +1024,7 @@ proc trackCall(tracked: PEffects; n: PNode) =
|
||||
else:
|
||||
if laxEffects notin tracked.c.config.legacyFeatures and a.kind == nkSym and
|
||||
a.sym.kind in routineKinds:
|
||||
if tfTrackedProc in a.sym.typ.flags:
|
||||
propagateEffects(tracked, n, a.sym)
|
||||
else:
|
||||
if a.sym.typ.itemId notin tracked.c.delayedEffects:
|
||||
tracked.c.delayedEffects[a.sym.typ.itemId] = @[tracked.owner]
|
||||
else:
|
||||
tracked.c.delayedEffects[a.sym.typ.itemId].add tracked.owner
|
||||
tracked.c.delayedEffectsInverted[tracked.owner.typ.itemId] = a.sym.typ.itemId
|
||||
propagateEffects(tracked, n, a.sym)
|
||||
else:
|
||||
mergeRaises(tracked, effectList[exceptionEffects], n)
|
||||
mergeTags(tracked, effectList[tagEffects], n)
|
||||
@@ -1735,14 +1728,6 @@ proc trackProc*(c: PContext; s: PSym, body: PNode) =
|
||||
if strictNotNil in c.features and s.kind in {skProc, skFunc, skMethod, skConverter}:
|
||||
checkNil(s, body, g.config, c.idgen)
|
||||
|
||||
if s.typ.itemId notin c.delayedEffectsInverted:
|
||||
s.typ.flags.incl tfTrackedProc
|
||||
|
||||
if s.typ.itemId in c.delayedEffects:
|
||||
for sym in c.delayedEffects[s.typ.itemId]:
|
||||
trackProc(c, sym, sym.ast[bodyPos])
|
||||
# todo call track delayedEffects recursively
|
||||
|
||||
proc trackStmt*(c: PContext; module: PSym; n: PNode, isTopLevel: bool) =
|
||||
case n.kind
|
||||
of {nkPragma, nkMacroDef, nkTemplateDef, nkProcDef, nkFuncDef,
|
||||
|
||||
@@ -137,12 +137,25 @@ const
|
||||
nkElifBranch, nkElifExpr, nkElseExpr, nkBlockStmt, nkBlockExpr,
|
||||
nkHiddenStdConv, nkHiddenDeref}
|
||||
|
||||
proc implicitlyDiscardable(n: PNode): bool =
|
||||
const skipForDiscardableStmt = skipForDiscardable - {nkHiddenStdConv, nkHiddenDeref}
|
||||
|
||||
type
|
||||
DiscardableKind = enum
|
||||
No, LastBlock, Discardable
|
||||
|
||||
proc implicitlyDiscardableClassifier(n: PNode): DiscardableKind =
|
||||
var n = n
|
||||
while n.kind in skipForDiscardable: n = n.lastSon
|
||||
result = n.kind in nkLastBlockStmts or
|
||||
(isCallExpr(n) and n[0].kind == nkSym and
|
||||
sfDiscardable in n[0].sym.flags)
|
||||
if n.kind in nkLastBlockStmts:
|
||||
result = LastBlock
|
||||
elif isCallExpr(n) and n[0].kind == nkSym and
|
||||
sfDiscardable in n[0].sym.flags:
|
||||
result = Discardable
|
||||
else:
|
||||
result = No
|
||||
|
||||
proc implicitlyDiscardable(n: PNode): bool =
|
||||
result = implicitlyDiscardableClassifier(n) in {LastBlock, Discardable}
|
||||
|
||||
proc fixNilType(c: PContext; n: PNode) =
|
||||
if isAtom(n):
|
||||
@@ -153,13 +166,31 @@ proc fixNilType(c: PContext; n: PNode) =
|
||||
for it in n: fixNilType(c, it)
|
||||
n.typ = nil
|
||||
|
||||
proc discardCheck(c: PContext, result: PNode, flags: TExprFlags) =
|
||||
proc wrapDiscardableExpr(n: PNode): PNode =
|
||||
result = n
|
||||
var n = n
|
||||
var parent = n
|
||||
var hasWork = false
|
||||
while n.kind in skipForDiscardableStmt:
|
||||
parent = n
|
||||
n = n.lastSon
|
||||
if n.kind notin skipForDiscardableStmt:
|
||||
parent[^1] = newTreeI(nkDiscardStmt, n.info, n)
|
||||
hasWork = true
|
||||
break
|
||||
if not hasWork:
|
||||
result = newTreeI(nkDiscardStmt, result.info, result)
|
||||
|
||||
proc discardCheck(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
result = n
|
||||
if c.matchedConcept != nil or efInTypeof in flags: return
|
||||
|
||||
if result.typ != nil and result.typ.kind notin {tyTyped, tyVoid}:
|
||||
if implicitlyDiscardable(result):
|
||||
var n = newNodeI(nkDiscardStmt, result.info, 1)
|
||||
n[0] = result
|
||||
let kind = implicitlyDiscardableClassifier(result)
|
||||
if kind == Discardable:
|
||||
result = wrapDiscardableExpr(result)
|
||||
elif kind == LastBlock:
|
||||
discard
|
||||
elif result.typ.kind != tyError and c.config.cmd != cmdInteractive:
|
||||
if result.typ.kind == tyNone:
|
||||
localError(c.config, result.info, "expression has no type: " &
|
||||
@@ -207,7 +238,8 @@ proc semIf(c: PContext, n: PNode; flags: TExprFlags; expectedType: PType = nil):
|
||||
else: illFormedAst(it, c.config)
|
||||
if isEmptyType(typ) or typ.kind in {tyNil, tyUntyped} or
|
||||
(not hasElse and efInTypeof notin flags):
|
||||
for it in n: discardCheck(c, it.lastSon, flags)
|
||||
for it in n:
|
||||
it[^1] = discardCheck(c, it[^1], flags)
|
||||
result.transitionSonsKind(nkIfStmt)
|
||||
# propagate any enforced VoidContext:
|
||||
if typ == c.enforceVoidContext: result.typ = c.enforceVoidContext
|
||||
@@ -314,12 +346,14 @@ proc semTry(c: PContext, n: PNode; flags: TExprFlags; expectedType: PType = nil)
|
||||
closeScope(c)
|
||||
|
||||
if isEmptyType(typ) or typ.kind in {tyNil, tyUntyped}:
|
||||
discardCheck(c, n[0], flags)
|
||||
for i in 1..<n.len: discardCheck(c, n[i].lastSon, flags)
|
||||
n[0] = discardCheck(c, n[0], flags)
|
||||
for i in 1..<n.len:
|
||||
n[i][^1] = discardCheck(c, n[i][^1], flags)
|
||||
if typ == c.enforceVoidContext:
|
||||
result.typ = c.enforceVoidContext
|
||||
else:
|
||||
if n.lastSon.kind == nkFinally: discardCheck(c, n.lastSon.lastSon, flags)
|
||||
if n.lastSon.kind == nkFinally:
|
||||
n[^1][^1] = discardCheck(c, n[^1][^1], flags)
|
||||
if not endsInNoReturn(n[0]):
|
||||
n[0] = fitNode(c, typ, n[0], n[0].info)
|
||||
for i in 1..last:
|
||||
@@ -1035,7 +1069,7 @@ proc semForVars(c: PContext, n: PNode; flags: TExprFlags): PNode =
|
||||
openScope(c)
|
||||
n[^1] = semExprBranch(c, n[^1], flags)
|
||||
if efInTypeof notin flags:
|
||||
discardCheck(c, n[^1], flags)
|
||||
n[^1] = discardCheck(c, n[^1], flags)
|
||||
closeScope(c)
|
||||
c.p.breakInLoop = oldBreakInLoop
|
||||
dec(c.p.nestedLoopCounter)
|
||||
@@ -1244,7 +1278,8 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags; expectedType: PType = nil
|
||||
closeScope(c)
|
||||
if isEmptyType(typ) or typ.kind in {tyNil, tyUntyped} or
|
||||
(not hasElse and efInTypeof notin flags):
|
||||
for i in 1..<n.len: discardCheck(c, n[i].lastSon, flags)
|
||||
for i in 1..<n.len:
|
||||
n[i][^1] = discardCheck(c, n[i][^1], flags)
|
||||
# propagate any enforced VoidContext:
|
||||
if typ == c.enforceVoidContext:
|
||||
result.typ = c.enforceVoidContext
|
||||
@@ -1589,27 +1624,21 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) =
|
||||
for sk in c.skipTypes:
|
||||
discard semTypeNode(c, sk, nil)
|
||||
c.skipTypes = @[]
|
||||
|
||||
proc checkForMetaFields(c: PContext; n: PNode; hasError: var bool) =
|
||||
proc checkMeta(c: PContext; n: PNode; t: PType; hasError: var bool; parent: PType) =
|
||||
if t != nil and (t.isMetaType or t.kind == tyNone) and tfGenericTypeParam notin t.flags:
|
||||
proc checkForMetaFields(c: PContext; n: PNode) =
|
||||
proc checkMeta(c: PContext; n: PNode; t: PType) =
|
||||
if t != nil and t.isMetaType and tfGenericTypeParam notin t.flags:
|
||||
if t.kind == tyBuiltInTypeClass and t.len == 1 and t.elementType.kind == tyProc:
|
||||
localError(c.config, n.info, ("'$1' is not a concrete type; " &
|
||||
"for a callback without parameters use 'proc()'") % t.typeToString)
|
||||
elif t.kind == tyNone and parent != nil:
|
||||
# TODO: openarray has the `tfGenericTypeParam` flag & generics
|
||||
# TODO: handle special cases (sink etc.) and views
|
||||
localError(c.config, n.info, errTIsNotAConcreteType % parent.typeToString)
|
||||
else:
|
||||
localError(c.config, n.info, errTIsNotAConcreteType % t.typeToString)
|
||||
hasError = true
|
||||
|
||||
if n.isNil: return
|
||||
case n.kind
|
||||
of nkRecList, nkRecCase:
|
||||
for s in n: checkForMetaFields(c, s, hasError)
|
||||
for s in n: checkForMetaFields(c, s)
|
||||
of nkOfBranch, nkElse:
|
||||
checkForMetaFields(c, n.lastSon, hasError)
|
||||
checkForMetaFields(c, n.lastSon)
|
||||
of nkSym:
|
||||
let t = n.sym.typ
|
||||
case t.kind
|
||||
@@ -1617,9 +1646,9 @@ proc checkForMetaFields(c: PContext; n: PNode; hasError: var bool) =
|
||||
tyProc, tyGenericInvocation, tyGenericInst, tyAlias, tySink, tyOwned:
|
||||
let start = ord(t.kind in {tyGenericInvocation, tyGenericInst})
|
||||
for i in start..<t.len:
|
||||
checkMeta(c, n, t[i], hasError, t)
|
||||
checkMeta(c, n, t[i])
|
||||
else:
|
||||
checkMeta(c, n, t, hasError, nil)
|
||||
checkMeta(c, n, t)
|
||||
else:
|
||||
internalAssert c.config, false
|
||||
|
||||
@@ -1654,11 +1683,9 @@ proc typeSectionFinalPass(c: PContext, n: PNode) =
|
||||
assert s.typ != nil
|
||||
assignType(s.typ, t)
|
||||
s.typ.itemId = t.itemId # same id
|
||||
var hasError = false
|
||||
checkConstructedType(c.config, s.info, s.typ)
|
||||
if s.typ.kind in {tyObject, tyTuple} and not s.typ.n.isNil:
|
||||
checkForMetaFields(c, s.typ.n, hasError)
|
||||
if not hasError:
|
||||
checkConstructedType(c.config, s.info, s.typ)
|
||||
checkForMetaFields(c, s.typ.n)
|
||||
|
||||
# fix bug #5170, bug #17162, bug #15526: ensure locally scoped types get a unique name:
|
||||
if s.typ.kind in {tyEnum, tyRef, tyObject} and not isTopLevel(c):
|
||||
@@ -2410,7 +2437,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
|
||||
if sfBorrow in s.flags and c.config.cmd notin cmdDocLike:
|
||||
result[bodyPos] = c.graph.emptyNode
|
||||
|
||||
if sfCppMember * s.flags != {} and sfWasForwarded notin s.flags:
|
||||
if sfCppMember * s.flags != {}:
|
||||
semCppMember(c, s, n)
|
||||
|
||||
if n[bodyPos].kind != nkEmpty and sfError notin s.flags:
|
||||
@@ -2741,7 +2768,7 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags, expectedType: PType =
|
||||
n.typ = n[i].typ
|
||||
if not isEmptyType(n.typ): n.transitionSonsKind(nkStmtListExpr)
|
||||
elif i != last or voidContext:
|
||||
discardCheck(c, n[i], flags)
|
||||
n[i] = discardCheck(c, n[i], flags)
|
||||
else:
|
||||
n.typ = n[i].typ
|
||||
if not isEmptyType(n.typ): n.transitionSonsKind(nkStmtListExpr)
|
||||
|
||||
@@ -15,7 +15,7 @@ const
|
||||
errStringLiteralExpected = "string literal expected"
|
||||
errIntLiteralExpected = "integer literal expected"
|
||||
errWrongNumberOfVariables = "wrong number of variables"
|
||||
errDuplicateAliasInEnumX = "duplicate value in enum '$1'"
|
||||
errInvalidOrderInEnumX = "invalid order in enum '$1'"
|
||||
errOverflowInEnumX = "The enum '$1' exceeds its maximum value ($2)"
|
||||
errOrdinalTypeExpected = "ordinal type expected; given: $1"
|
||||
errSetTooBig = "set is too large; use `std/sets` for ordinal types with more than 2^16 elements"
|
||||
@@ -69,7 +69,6 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||
e: PSym = nil
|
||||
base: PType = nil
|
||||
identToReplace: ptr PNode = nil
|
||||
counterSet = initPackedSet[BiggestInt]()
|
||||
counter = 0
|
||||
base = nil
|
||||
result = newOrPrevType(tyEnum, prev, c)
|
||||
@@ -86,7 +85,6 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||
var hasNull = false
|
||||
for i in 1..<n.len:
|
||||
if n[i].kind == nkEmpty: continue
|
||||
var useAutoCounter = false
|
||||
case n[i].kind
|
||||
of nkEnumFieldDef:
|
||||
if n[i][0].kind == nkPragmaExpr:
|
||||
@@ -114,7 +112,6 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||
of tyString, tyCstring:
|
||||
strVal = v
|
||||
x = counter
|
||||
useAutoCounter = true
|
||||
else:
|
||||
if isOrdinalType(v.typ, allowEnumWithHoles=true):
|
||||
x = toInt64(getOrdValue(v))
|
||||
@@ -123,30 +120,22 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||
localError(c.config, v.info, errOrdinalTypeExpected % typeToString(v.typ, preferDesc))
|
||||
if i != 1:
|
||||
if x != counter: incl(result.flags, tfEnumHasHoles)
|
||||
if x < counter:
|
||||
localError(c.config, n[i].info, errInvalidOrderInEnumX % e.name.s)
|
||||
x = counter
|
||||
e.ast = strVal # might be nil
|
||||
counter = x
|
||||
of nkSym:
|
||||
e = n[i].sym
|
||||
useAutoCounter = true
|
||||
of nkIdent, nkAccQuoted:
|
||||
e = newSymS(skEnumField, n[i], c)
|
||||
identToReplace = addr n[i]
|
||||
useAutoCounter = true
|
||||
of nkPragmaExpr:
|
||||
e = newSymS(skEnumField, n[i][0], c)
|
||||
pragma(c, e, n[i][1], enumFieldPragmas)
|
||||
identToReplace = addr n[i][0]
|
||||
useAutoCounter = true
|
||||
else:
|
||||
illFormedAst(n[i], c.config)
|
||||
|
||||
if useAutoCounter:
|
||||
while counter in counterSet and counter != high(typeof(counter)):
|
||||
inc counter
|
||||
counterSet.incl counter
|
||||
elif counterSet.containsOrIncl(counter):
|
||||
localError(c.config, n[i].info, errDuplicateAliasInEnumX % e.name.s)
|
||||
|
||||
e.typ = result
|
||||
e.position = int(counter)
|
||||
let symNode = newSymNode(e)
|
||||
|
||||
@@ -96,7 +96,7 @@ type
|
||||
const
|
||||
isNilConversion = isConvertible # maybe 'isIntConv' fits better?
|
||||
|
||||
proc markUsed*(c: PContext; info: TLineInfo, s: PSym; checkStyle = true)
|
||||
proc markUsed*(c: PContext; info: TLineInfo, s: PSym)
|
||||
proc markOwnerModuleAsUsed*(c: PContext; s: PSym)
|
||||
|
||||
template hasFauxMatch*(c: TCandidate): bool = c.fauxMatch != tyNone
|
||||
|
||||
@@ -109,16 +109,6 @@ stmtList:
|
||||
|
||||
"""
|
||||
|
||||
proc castToVoidPointer(g: ModuleGraph, n: PNode, fvField: PNode): PNode =
|
||||
if g.config.backend == backendCpp:
|
||||
result = fvField
|
||||
else:
|
||||
let ptrType = getSysType(g, n.info, tyPointer)
|
||||
result = newNodeI(nkCast, fvField.info)
|
||||
result.add newNodeI(nkEmpty, fvField.info)
|
||||
result.add fvField
|
||||
result.typ = ptrType
|
||||
|
||||
proc createWrapperProc(g: ModuleGraph; f: PNode; threadParam, argsParam: PSym;
|
||||
varSection, varInit, call, barrier, fv: PNode;
|
||||
idgen: IdGenerator;
|
||||
@@ -166,9 +156,8 @@ proc createWrapperProc(g: ModuleGraph; f: PNode; threadParam, argsParam: PSym;
|
||||
if barrier == nil:
|
||||
# by now 'fv' is shared and thus might have beeen overwritten! we need
|
||||
# to use the thread-local view instead:
|
||||
let castExpr = castToVoidPointer(g, f, threadLocalProm.newSymNode)
|
||||
body.add callCodegenProc(g, "nimFlowVarSignal", threadLocalProm.info,
|
||||
castExpr)
|
||||
threadLocalProm.newSymNode)
|
||||
else:
|
||||
body.add call
|
||||
if barrier != nil:
|
||||
@@ -424,8 +413,7 @@ proc wrapProcForSpawn*(g: ModuleGraph; idgen: IdGenerator; owner: PSym; spawnExp
|
||||
# create flowVar:
|
||||
result.add newFastAsgnStmt(fvField, callProc(spawnExpr[^1]))
|
||||
if barrier == nil:
|
||||
let castExpr = castToVoidPointer(g, n, fvField)
|
||||
result.add callCodegenProc(g, "nimFlowVarCreateSemaphore", fvField.info, castExpr)
|
||||
result.add callCodegenProc(g, "nimFlowVarCreateSemaphore", fvField.info, fvField)
|
||||
|
||||
elif spawnKind == srByVar:
|
||||
var field = newSym(skField, getIdent(g.cache, "fv"), idgen, owner, n.info, g.config.options)
|
||||
|
||||
@@ -696,7 +696,7 @@ proc markOwnerModuleAsUsed(c: PContext; s: PSym) =
|
||||
else:
|
||||
inc i
|
||||
|
||||
proc markUsed(c: PContext; info: TLineInfo; s: PSym; checkStyle = true) =
|
||||
proc markUsed(c: PContext; info: TLineInfo; s: PSym) =
|
||||
let conf = c.config
|
||||
incl(s.flags, sfUsed)
|
||||
if s.kind == skEnumField and s.owner != nil:
|
||||
@@ -713,8 +713,7 @@ proc markUsed(c: PContext; info: TLineInfo; s: PSym; checkStyle = true) =
|
||||
if sfError in s.flags: userError(conf, info, s)
|
||||
when defined(nimsuggest):
|
||||
suggestSym(c.graph, info, s, c.graph.usageSym, false)
|
||||
if checkStyle:
|
||||
styleCheckUse(c, info, s)
|
||||
styleCheckUse(c, info, s)
|
||||
markOwnerModuleAsUsed(c, s)
|
||||
|
||||
proc safeSemExpr*(c: PContext, n: PNode): PNode =
|
||||
|
||||
@@ -456,14 +456,6 @@ proc transformYield(c: PTransf, n: PNode): PNode =
|
||||
let rhs = transform(c, e)
|
||||
result.add(asgnTo(lhs, rhs))
|
||||
|
||||
|
||||
# bug #23536; note that the info of forLoopBody should't change
|
||||
for idx in 0 ..< result.len:
|
||||
var changeNode = result[idx]
|
||||
changeNode.info = c.transCon.forStmt.info
|
||||
for i, child in changeNode:
|
||||
child.info = changeNode.info
|
||||
|
||||
inc(c.transCon.yieldStmts)
|
||||
if c.transCon.yieldStmts <= 1:
|
||||
# common case
|
||||
@@ -474,6 +466,12 @@ proc transformYield(c: PTransf, n: PNode): PNode =
|
||||
result.add(introduceNewLocalVars(c, c.transCon.forLoopBody))
|
||||
c.isIntroducingNewLocalVars = false
|
||||
|
||||
for idx in 0 ..< result.len:
|
||||
var changeNode = result[idx]
|
||||
changeNode.info = c.transCon.forStmt.info
|
||||
for i, child in changeNode:
|
||||
child.info = changeNode.info
|
||||
|
||||
proc transformAddrDeref(c: PTransf, n: PNode, kinds: TNodeKinds): PNode =
|
||||
result = transformSons(c, n)
|
||||
# inlining of 'var openarray' iterators; bug #19977
|
||||
|
||||
@@ -27,7 +27,6 @@ type
|
||||
taProcContextIsNotMacro
|
||||
taIsCastable
|
||||
taIsDefaultField
|
||||
taVoid # only allow direct void fields of objects/tuples
|
||||
|
||||
TTypeAllowedFlags* = set[TTypeAllowedFlag]
|
||||
|
||||
@@ -61,8 +60,6 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
|
||||
if typ == nil: return nil
|
||||
if containsOrIncl(marker, typ.id): return nil
|
||||
var t = skipTypes(typ, abstractInst-{tyTypeDesc, tySink})
|
||||
|
||||
let flags = if t.kind == tyVoid: flags else: flags-{taVoid}
|
||||
case t.kind
|
||||
of tyVar, tyLent:
|
||||
if kind in {skProc, skFunc, skConst} and (views notin c.features):
|
||||
@@ -118,7 +115,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
|
||||
of tyStatic:
|
||||
if kind notin {skParam}: result = t
|
||||
of tyVoid:
|
||||
if taVoid notin flags: result = t
|
||||
if taField notin flags: result = t
|
||||
of tyTypeClasses:
|
||||
if tfGenericTypeParam in t.flags or taConcept in flags: #or taField notin flags:
|
||||
discard
|
||||
@@ -187,12 +184,12 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
|
||||
t.baseClass != nil and taIsDefaultField notin flags:
|
||||
result = t
|
||||
else:
|
||||
let flags = flags+{taField, taVoid}
|
||||
let flags = flags+{taField}
|
||||
result = typeAllowedAux(marker, t.baseClass, kind, c, flags)
|
||||
if result.isNil and t.n != nil:
|
||||
result = typeAllowedNode(marker, t.n, kind, c, flags)
|
||||
of tyTuple:
|
||||
let flags = flags+{taField, taVoid}
|
||||
let flags = flags+{taField}
|
||||
for a in t.kids:
|
||||
result = typeAllowedAux(marker, a, kind, c, flags)
|
||||
if result != nil: break
|
||||
|
||||
@@ -1229,6 +1229,13 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
||||
c.freeTemp(tmp1)
|
||||
c.genAsgnPatch(d2AsNode, d2)
|
||||
c.freeTemp(d2)
|
||||
of mReset:
|
||||
unused(c, n, dest)
|
||||
var d = c.genx(n[1])
|
||||
# XXX use ldNullOpcode() here?
|
||||
c.gABx(n, opcLdNull, d, c.genType(n[1].typ))
|
||||
c.gABC(n, opcNodeToReg, d, d)
|
||||
c.genAsgnPatch(n[1], d)
|
||||
of mDefault, mZeroDefault:
|
||||
if dest < 0: dest = c.getTemp(n.typ)
|
||||
c.gABx(n, ldNullOpcode(n.typ), dest, c.genType(n.typ))
|
||||
|
||||
@@ -232,10 +232,6 @@ doc.file = """<?xml version="1.0" encoding="utf-8" ?>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>$title</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -259,6 +255,9 @@ doc.file = """<?xml version="1.0" encoding="utf-8" ?>
|
||||
</div>
|
||||
</div>
|
||||
$analytics
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
@@ -4673,6 +4673,7 @@ Closure iterators and inline iterators have some restrictions:
|
||||
(but rarely useful) and ends the iteration.
|
||||
3. Inline iterators cannot be recursive.
|
||||
4. Neither inline nor closure iterators have the special `result` variable.
|
||||
5. Closure iterators are not supported by the JS backend.
|
||||
|
||||
Iterators that are neither marked `{.closure.}` nor `{.inline.}` explicitly
|
||||
default to being inline, but this may change in future versions of the
|
||||
@@ -5419,8 +5420,6 @@ To override the compiler's side effect analysis a `{.noSideEffect.}`
|
||||
**Side effects are usually inferred. The inference for side effects is
|
||||
analogous to the inference for exception tracking.**
|
||||
|
||||
When the compiler cannot infer side effects, as is the case for imported
|
||||
functions, one can annotate them with the `sideEffect` pragma.
|
||||
|
||||
GC safety effect
|
||||
----------------
|
||||
|
||||
@@ -166,7 +166,7 @@ An example:
|
||||
n.strVal = ""
|
||||
```
|
||||
|
||||
As can be seen from the example, an advantage to an object hierarchy is that
|
||||
As can been seen from the example, an advantage to an object hierarchy is that
|
||||
no conversion between different object types is needed. Yet, access to invalid
|
||||
object fields raises an exception.
|
||||
|
||||
|
||||
11
koch.nim
11
koch.nim
@@ -11,10 +11,9 @@
|
||||
|
||||
const
|
||||
# examples of possible values for repos: Head, ea82b54
|
||||
NimbleStableCommit = "f8bd7b5fa6ea7a583b411b5959b06e6b5eb23667" # master
|
||||
AtlasStableCommit = "5faec3e9a33afe99a7d22377dd1b45a5391f5504"
|
||||
NimbleStableCommit = "39b61c5d85afffd53aa404ac9126419ae1bd8d67" # master
|
||||
AtlasStableCommit = "7b780811a168f3f32bff4822369dda46a7f87f9a"
|
||||
ChecksumsStableCommit = "025bcca3915a1b9f19878cea12ad68f9884648fc"
|
||||
SatStableCommit = "faf1617f44d7632ee9601ebc13887644925dcc01"
|
||||
|
||||
# examples of possible values for fusion: #head, #ea82b54, 1.2.3
|
||||
FusionStableHash = "#372ee4313827ef9f2ea388840f7d6b46c2b1b014"
|
||||
@@ -160,8 +159,6 @@ proc bundleNimbleExe(latest: bool, args: string) =
|
||||
commit = commit, allowBundled = true)
|
||||
cloneDependency(distDir / "nimble" / distDir, "https://github.com/nim-lang/checksums.git",
|
||||
commit = ChecksumsStableCommit, allowBundled = true) # or copy it from dist?
|
||||
cloneDependency(distDir / "nimble" / distDir, "https://github.com/nim-lang/sat.git",
|
||||
commit = SatStableCommit, allowBundled = true)
|
||||
# installer.ini expects it under $nim/bin
|
||||
nimCompile("dist/nimble/src/nimble.nim",
|
||||
options = "-d:release -d:nimNimbleBootstrap --noNimblePath " & args)
|
||||
@@ -170,11 +167,9 @@ proc bundleAtlasExe(latest: bool, args: string) =
|
||||
let commit = if latest: "HEAD" else: AtlasStableCommit
|
||||
cloneDependency(distDir, "https://github.com/nim-lang/atlas.git",
|
||||
commit = commit, allowBundled = true)
|
||||
cloneDependency(distDir / "atlas" / distDir, "https://github.com/nim-lang/sat.git",
|
||||
commit = SatStableCommit, allowBundled = true)
|
||||
# installer.ini expects it under $nim/bin
|
||||
nimCompile("dist/atlas/src/atlas.nim",
|
||||
options = "-d:release --noNimblePath -d:nimAtlasBootstrap " & args)
|
||||
options = "-d:release --noNimblePath " & args)
|
||||
|
||||
proc bundleNimsuggest(args: string) =
|
||||
nimCompileFold("Compile nimsuggest", "nimsuggest/nimsuggest.nim",
|
||||
|
||||
@@ -129,9 +129,7 @@ when not defined(gcDestructors):
|
||||
else:
|
||||
proc nimNewObj(size, align: int): pointer {.importCompilerProc.}
|
||||
proc newSeqPayload(cap, elemSize, elemAlign: int): pointer {.importCompilerProc.}
|
||||
proc prepareSeqAddUninit(len: int; p: pointer; addlen, elemSize, elemAlign: int): pointer {.
|
||||
importCompilerProc.}
|
||||
proc zeroNewElements(len: int; p: pointer; addlen, elemSize, elemAlign: int) {.
|
||||
proc prepareSeqAdd(len: int; p: pointer; addlen, elemSize, elemAlign: int): pointer {.
|
||||
importCompilerProc.}
|
||||
|
||||
template `+!!`(a, b): untyped = cast[pointer](cast[int](a) + b)
|
||||
@@ -223,8 +221,7 @@ proc extendSeq*(x: Any) =
|
||||
var s = cast[ptr NimSeqV2Reimpl](x.value)
|
||||
let elem = x.rawType.base
|
||||
if s.p == nil or s.p.cap < s.len+1:
|
||||
s.p = cast[ptr NimSeqPayloadReimpl](prepareSeqAddUninit(s.len, s.p, 1, elem.size, elem.align))
|
||||
zeroNewElements(s.len, s.p, 1, elem.size, elem.align)
|
||||
s.p = cast[ptr NimSeqPayloadReimpl](prepareSeqAdd(s.len, s.p, 1, elem.size, elem.align))
|
||||
inc s.len
|
||||
else:
|
||||
var y = cast[ptr PGenSeq](x.value)[]
|
||||
|
||||
@@ -244,7 +244,7 @@ proc decode*(s: string): string =
|
||||
inputLen = s.len
|
||||
inputEnds = 0
|
||||
# strip trailing characters
|
||||
while inputLen > 0 and s[inputLen - 1] in {'\n', '\r', ' ', '='}:
|
||||
while s[inputLen - 1] in {'\n', '\r', ' ', '='}:
|
||||
dec inputLen
|
||||
# hot loop: read 4 characters at at time
|
||||
inputEnds = inputLen - 4
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
runnableExamples:
|
||||
from std/math import almostEqual, sqrt
|
||||
|
||||
func almostEqual(a, b: Complex): bool =
|
||||
almostEqual(a.re, b.re) and almostEqual(a.im, b.im)
|
||||
|
||||
let
|
||||
z1 = complex(1.0, 2.0)
|
||||
z2 = complex(3.0, -4.0)
|
||||
@@ -409,24 +412,6 @@ func rect*[T](r, phi: T): Complex[T] =
|
||||
## * `polar func<#polar,Complex[T]>`_ for the inverse operation
|
||||
complex(r * cos(phi), r * sin(phi))
|
||||
|
||||
func almostEqual*[T: SomeFloat](x, y: Complex[T]; unitsInLastPlace: Natural = 4): bool =
|
||||
## Checks if two complex values are almost equal, using the
|
||||
## [machine epsilon](https://en.wikipedia.org/wiki/Machine_epsilon).
|
||||
##
|
||||
## Two complex values are considered almost equal if their real and imaginary
|
||||
## components are almost equal.
|
||||
##
|
||||
## `unitsInLastPlace` is the max number of
|
||||
## [units in the last place](https://en.wikipedia.org/wiki/Unit_in_the_last_place)
|
||||
## difference tolerated when comparing two numbers. The larger the value, the
|
||||
## more error is allowed. A `0` value means that two numbers must be exactly the
|
||||
## same to be considered equal.
|
||||
##
|
||||
## The machine epsilon has to be scaled to the magnitude of the values used
|
||||
## and multiplied by the desired precision in ULPs unless the difference is
|
||||
## subnormal.
|
||||
almostEqual(x.re, y.re, unitsInLastPlace = unitsInLastPlace) and
|
||||
almostEqual(x.im, y.im, unitsInLastPlace = unitsInLastPlace)
|
||||
|
||||
func `$`*(z: Complex): string =
|
||||
## Returns `z`'s string representation as `"(re, im)"`.
|
||||
|
||||
@@ -127,7 +127,6 @@ type
|
||||
|
||||
BSD
|
||||
FreeBSD
|
||||
NetBSD
|
||||
OpenBSD
|
||||
DragonFlyBSD
|
||||
|
||||
@@ -169,7 +168,7 @@ proc detectOsImpl(d: Distribution): bool =
|
||||
else:
|
||||
when defined(bsd):
|
||||
case d
|
||||
of Distribution.FreeBSD, Distribution.NetBSD, Distribution.OpenBSD:
|
||||
of Distribution.FreeBSD, Distribution.OpenBSD:
|
||||
result = $d in uname()
|
||||
else:
|
||||
result = false
|
||||
@@ -252,7 +251,7 @@ proc foreignDepInstallCmd*(foreignPackageName: string): (string, bool) =
|
||||
result = ("nix-env -i " & p, false)
|
||||
elif detectOs(Solaris) or detectOs(FreeBSD):
|
||||
result = ("pkg install " & p, true)
|
||||
elif detectOs(NetBSD) or detectOs(OpenBSD):
|
||||
elif detectOs(OpenBSD):
|
||||
result = ("pkg_add " & p, true)
|
||||
elif detectOs(PCLinuxOS):
|
||||
result = ("rpm -ivh " & p, true)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
## The types, vars and procs are bindings for the C standard library
|
||||
## [<fenv.h>](https://en.cppreference.com/w/c/numeric/fenv) header.
|
||||
|
||||
when defined(posix) and not defined(genode) and not defined(macosx):
|
||||
when defined(posix) and not defined(genode):
|
||||
{.passl: "-lm".}
|
||||
|
||||
var
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -155,7 +155,7 @@ func fac*(n: int): int =
|
||||
|
||||
{.push checks: off, line_dir: off, stack_trace: off.}
|
||||
|
||||
when defined(posix) and not defined(genode) and not defined(macosx):
|
||||
when defined(posix) and not defined(genode):
|
||||
{.passl: "-lm".}
|
||||
|
||||
const
|
||||
|
||||
@@ -432,10 +432,6 @@ const mimes* = {
|
||||
"msty": "application/vnd.muvee.style",
|
||||
"taglet": "application/vnd.mynfc",
|
||||
"nlu": "application/vnd.neurolanguage.nlu",
|
||||
"nim": "text/nim",
|
||||
"nimble": "text/nimble",
|
||||
"nimf": "text/nim",
|
||||
"nims": "text/nim",
|
||||
"ntf": "application/vnd.nitf",
|
||||
"nitf": "application/vnd.nitf",
|
||||
"nnd": "application/vnd.noblenet-directory",
|
||||
|
||||
@@ -2040,10 +2040,8 @@ proc dial*(address: string, port: Port,
|
||||
if success:
|
||||
result = newSocket(lastFd, domain, sockType, protocol, buffered)
|
||||
elif lastError != 0.OSErrorCode:
|
||||
lastFd.close()
|
||||
raiseOSError(lastError)
|
||||
else:
|
||||
lastFd.close()
|
||||
raise newException(IOError, "Couldn't resolve address: " & address)
|
||||
|
||||
proc connect*(socket: Socket, address: string,
|
||||
|
||||
@@ -754,14 +754,14 @@ template rawToFormalFileInfo(rawInfo, path, formalInfo): untyped =
|
||||
## 'rawInfo' is either a 'BY_HANDLE_FILE_INFORMATION' structure on Windows,
|
||||
## or a 'Stat' structure on posix
|
||||
when defined(windows):
|
||||
template merge[T](a, b): untyped =
|
||||
cast[T](
|
||||
template merge(a, b): untyped =
|
||||
int64(
|
||||
(uint64(cast[uint32](a))) or
|
||||
(uint64(cast[uint32](b)) shl 32)
|
||||
)
|
||||
formalInfo.id.device = rawInfo.dwVolumeSerialNumber
|
||||
formalInfo.id.file = merge[FileId](rawInfo.nFileIndexLow, rawInfo.nFileIndexHigh)
|
||||
formalInfo.size = merge[BiggestInt](rawInfo.nFileSizeLow, rawInfo.nFileSizeHigh)
|
||||
formalInfo.id.file = merge(rawInfo.nFileIndexLow, rawInfo.nFileIndexHigh)
|
||||
formalInfo.size = merge(rawInfo.nFileSizeLow, rawInfo.nFileSizeHigh)
|
||||
formalInfo.linkCount = rawInfo.nNumberOfLinks
|
||||
formalInfo.lastAccessTime = fromWinTime(rdFileTime(rawInfo.ftLastAccessTime))
|
||||
formalInfo.lastWriteTime = fromWinTime(rdFileTime(rawInfo.ftLastWriteTime))
|
||||
|
||||
@@ -334,9 +334,9 @@ func normalize*(s: string): string {.rtl, extern: "nsuNormalize".} =
|
||||
func cmpIgnoreCase*(a, b: string): int {.rtl, extern: "nsuCmpIgnoreCase".} =
|
||||
## Compares two strings in a case insensitive manner. Returns:
|
||||
##
|
||||
## | `0` if a == b
|
||||
## | `< 0` if a < b
|
||||
## | `> 0` if a > b
|
||||
## | 0 if a == b
|
||||
## | < 0 if a < b
|
||||
## | > 0 if a > b
|
||||
runnableExamples:
|
||||
doAssert cmpIgnoreCase("FooBar", "foobar") == 0
|
||||
doAssert cmpIgnoreCase("bar", "Foo") < 0
|
||||
@@ -354,9 +354,9 @@ func cmpIgnoreStyle*(a, b: string): int {.rtl, extern: "nsuCmpIgnoreStyle".} =
|
||||
##
|
||||
## Returns:
|
||||
##
|
||||
## | `0` if a == b
|
||||
## | `< 0` if a < b
|
||||
## | `> 0` if a > b
|
||||
## | 0 if a == b
|
||||
## | < 0 if a < b
|
||||
## | > 0 if a > b
|
||||
runnableExamples:
|
||||
doAssert cmpIgnoreStyle("foo_bar", "FooBar") == 0
|
||||
doAssert cmpIgnoreStyle("foo_bar_5", "FooBar4") > 0
|
||||
@@ -565,7 +565,7 @@ iterator rsplit*(s: string, sep: char,
|
||||
maxsplit: int = -1): string =
|
||||
## Splits the string `s` into substrings from the right using a
|
||||
## string separator. Works exactly the same as `split iterator
|
||||
## <#split.i,string,char,int>`_ except in **reverse** order.
|
||||
## <#split.i,string,char,int>`_ except in reverse order.
|
||||
##
|
||||
## ```nim
|
||||
## for piece in "foo:bar".rsplit(':'):
|
||||
@@ -592,7 +592,7 @@ iterator rsplit*(s: string, seps: set[char] = Whitespace,
|
||||
maxsplit: int = -1): string =
|
||||
## Splits the string `s` into substrings from the right using a
|
||||
## string separator. Works exactly the same as `split iterator
|
||||
## <#split.i,string,char,int>`_ except in **reverse** order.
|
||||
## <#split.i,string,char,int>`_ except in reverse order.
|
||||
##
|
||||
## ```nim
|
||||
## for piece in "foo bar".rsplit(WhiteSpace):
|
||||
@@ -622,7 +622,7 @@ iterator rsplit*(s: string, sep: string, maxsplit: int = -1,
|
||||
keepSeparators: bool = false): string =
|
||||
## Splits the string `s` into substrings from the right using a
|
||||
## string separator. Works exactly the same as `split iterator
|
||||
## <#split.i,string,string,int>`_ except in **reverse** order.
|
||||
## <#split.i,string,string,int>`_ except in reverse order.
|
||||
##
|
||||
## ```nim
|
||||
## for piece in "foothebar".rsplit("the"):
|
||||
@@ -805,7 +805,7 @@ func split*(s: string, sep: string, maxsplit: int = -1): seq[string] {.rtl,
|
||||
func rsplit*(s: string, sep: char, maxsplit: int = -1): seq[string] {.rtl,
|
||||
extern: "nsuRSplitChar".} =
|
||||
## The same as the `rsplit iterator <#rsplit.i,string,char,int>`_, but is a func
|
||||
## that returns a sequence of substrings in original order.
|
||||
## that returns a sequence of substrings.
|
||||
##
|
||||
## A possible common use case for `rsplit` is path manipulation,
|
||||
## particularly on systems that don't use a common delimiter.
|
||||
@@ -835,7 +835,7 @@ func rsplit*(s: string, seps: set[char] = Whitespace,
|
||||
maxsplit: int = -1): seq[string]
|
||||
{.rtl, extern: "nsuRSplitCharSet".} =
|
||||
## The same as the `rsplit iterator <#rsplit.i,string,set[char],int>`_, but is a
|
||||
## func that returns a sequence of substrings in original order.
|
||||
## func that returns a sequence of substrings.
|
||||
##
|
||||
## A possible common use case for `rsplit` is path manipulation,
|
||||
## particularly on systems that don't use a common delimiter.
|
||||
@@ -867,7 +867,7 @@ func rsplit*(s: string, seps: set[char] = Whitespace,
|
||||
func rsplit*(s: string, sep: string, maxsplit: int = -1): seq[string] {.rtl,
|
||||
extern: "nsuRSplitString".} =
|
||||
## The same as the `rsplit iterator <#rsplit.i,string,string,int,bool>`_, but is a func
|
||||
## that returns a sequence of substrings in original order.
|
||||
## that returns a sequence of substrings.
|
||||
##
|
||||
## A possible common use case for `rsplit` is path manipulation,
|
||||
## particularly on systems that don't use a common delimiter.
|
||||
|
||||
@@ -836,9 +836,9 @@ proc toRunes*(s: openArray[char]): seq[Rune] =
|
||||
proc cmpRunesIgnoreCase*(a, b: openArray[char]): int {.rtl, extern: "nuc$1".} =
|
||||
## Compares two UTF-8 strings and ignores the case. Returns:
|
||||
##
|
||||
## | `0` if a == b
|
||||
## | `< 0` if a < b
|
||||
## | `> 0` if a > b
|
||||
## | 0 if a == b
|
||||
## | < 0 if a < b
|
||||
## | > 0 if a > b
|
||||
var i = 0
|
||||
var j = 0
|
||||
var ar, br: Rune
|
||||
@@ -1375,9 +1375,9 @@ proc toRunes*(s: string): seq[Rune] {.inline.} =
|
||||
proc cmpRunesIgnoreCase*(a, b: string): int {.inline.} =
|
||||
## Compares two UTF-8 strings and ignores the case. Returns:
|
||||
##
|
||||
## | `0` if a == b
|
||||
## | `< 0` if a < b
|
||||
## | `> 0` if a > b
|
||||
## | 0 if a == b
|
||||
## | < 0 if a < b
|
||||
## | > 0 if a > b
|
||||
cmpRunesIgnoreCase(a.toOa(), b.toOa())
|
||||
|
||||
proc reversed*(s: string): string {.inline.} =
|
||||
|
||||
@@ -9,7 +9,7 @@ export osseps
|
||||
import std/envvars
|
||||
import std/private/osappdirs
|
||||
|
||||
import std/[pathnorm, hashes, sugar, strutils]
|
||||
import std/pathnorm
|
||||
|
||||
from std/private/ospaths2 import joinPath, splitPath,
|
||||
ReadDirEffect, WriteDirEffect,
|
||||
@@ -25,16 +25,6 @@ export ReadDirEffect, WriteDirEffect
|
||||
type
|
||||
Path* = distinct string
|
||||
|
||||
func hash*(x: Path): Hash =
|
||||
let x = x.string.dup(normalizePath)
|
||||
if FileSystemCaseSensitive:
|
||||
result = x.hash
|
||||
else:
|
||||
result = x.toLowerAscii.hash
|
||||
|
||||
template `$`*(x: Path): string =
|
||||
string(x)
|
||||
|
||||
func `==`*(x, y: Path): bool {.inline.} =
|
||||
## Compares two paths.
|
||||
##
|
||||
|
||||
@@ -4,7 +4,7 @@ internal API for now, API subject to change
|
||||
|
||||
# xxx move other git utilities here; candidate for stdlib.
|
||||
|
||||
import std/[os, paths, osproc, strutils, tempfiles]
|
||||
import std/[os, osproc, strutils, tempfiles]
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/[assertions, syncio]
|
||||
@@ -32,8 +32,15 @@ template retryCall*(maxRetry = 3, backoffDuration = 1.0, call: untyped): bool =
|
||||
result
|
||||
|
||||
proc isGitRepo*(dir: string): bool =
|
||||
## Avoid calling git since it depends on /bin/sh existing and fails in Nix.
|
||||
return fileExists(dir/".git/HEAD")
|
||||
## This command is used to get the relative path to the root of the repository.
|
||||
## Using this, we can verify whether a folder is a git repository by checking
|
||||
## whether the command success and if the output is empty.
|
||||
let (output, status) = execCmdEx("git rev-parse --show-cdup", workingDir = dir)
|
||||
# On Windows there will be a trailing newline on success, remove it.
|
||||
# The value of a successful call typically won't have a whitespace (it's
|
||||
# usually a series of ../), so we know that it's safe to unconditionally
|
||||
# remove trailing whitespaces from the result.
|
||||
result = status == 0 and output.strip() == ""
|
||||
|
||||
proc diffFiles*(path1, path2: string): tuple[output: string, same: bool] =
|
||||
## Returns a human readable diff of files `path1`, `path2`, the exact form of
|
||||
|
||||
@@ -37,13 +37,13 @@ when defined(js):
|
||||
let a = array[2, float64].default
|
||||
assert jsConstructorName(a) == "Float64Array"
|
||||
assert jsConstructorName(a.toJs) == "Float64Array"
|
||||
{.emit: """`result` = `a`.constructor.name;""".}
|
||||
asm """`result` = `a`.constructor.name"""
|
||||
|
||||
proc hasJsBigInt*(): bool =
|
||||
{.emit: """`result` = typeof BigInt != 'undefined';""".}
|
||||
asm """`result` = typeof BigInt != 'undefined'"""
|
||||
|
||||
proc hasBigUint64Array*(): bool =
|
||||
{.emit: """`result` = typeof BigUint64Array != 'undefined';""".}
|
||||
asm """`result` = typeof BigUint64Array != 'undefined'"""
|
||||
|
||||
proc getProtoName*[T](a: T): cstring {.importjs: "Object.prototype.toString.call(#)".} =
|
||||
runnableExamples:
|
||||
|
||||
@@ -763,9 +763,9 @@ proc cmpPaths*(pathA, pathB: string): int {.
|
||||
## On a case-sensitive filesystem this is done
|
||||
## case-sensitively otherwise case-insensitively. Returns:
|
||||
##
|
||||
## | `0` if pathA == pathB
|
||||
## | `< 0` if pathA < pathB
|
||||
## | `> 0` if pathA > pathB
|
||||
## | 0 if pathA == pathB
|
||||
## | < 0 if pathA < pathB
|
||||
## | > 0 if pathA > pathB
|
||||
runnableExamples:
|
||||
when defined(macosx):
|
||||
assert cmpPaths("foo", "Foo") == 0
|
||||
|
||||
@@ -66,13 +66,11 @@ proc expandSymlink*(symlinkPath: string): string {.noWeirdTarget.} =
|
||||
when defined(windows) or defined(nintendoswitch):
|
||||
result = symlinkPath
|
||||
else:
|
||||
var bufLen = 1024
|
||||
while true:
|
||||
result = newString(bufLen)
|
||||
let len = readlink(symlinkPath.cstring, result.cstring, bufLen)
|
||||
if len < 0:
|
||||
raiseOSError(osLastError(), symlinkPath)
|
||||
if len < bufLen:
|
||||
result.setLen(len)
|
||||
break
|
||||
bufLen = bufLen shl 1
|
||||
result = newString(maxSymlinkLen)
|
||||
var len = readlink(symlinkPath, result.cstring, maxSymlinkLen)
|
||||
if len < 0:
|
||||
raiseOSError(osLastError(), symlinkPath)
|
||||
if len > maxSymlinkLen:
|
||||
result = newString(len+1)
|
||||
len = readlink(symlinkPath, result.cstring, len)
|
||||
setLen(result, len)
|
||||
|
||||
@@ -110,19 +110,6 @@ template addAllNode(assignParam: NimNode, procParam: NimNode) =
|
||||
tempAssignList.add newLetStmt(tempNode, newDotExpr(objTemp, formalParams[i][0]))
|
||||
scratchRecList.add newIdentDefs(newIdentNode(formalParams[i][0].strVal), assignParam)
|
||||
|
||||
proc analyseRootSym(s: NimNode): NimNode =
|
||||
result = s
|
||||
while true:
|
||||
case result.kind
|
||||
of nnkBracketExpr, nnkDerefExpr, nnkHiddenDeref,
|
||||
nnkAddr, nnkHiddenAddr,
|
||||
nnkObjDownConv, nnkObjUpConv:
|
||||
result = result[0]
|
||||
of nnkDotExpr, nnkCheckedFieldExpr, nnkHiddenStdConv, nnkHiddenSubConv:
|
||||
result = result[1]
|
||||
else:
|
||||
break
|
||||
|
||||
macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkCallStrLit}): Task =
|
||||
## Converts the call and its arguments to `Task`.
|
||||
runnableExamples:
|
||||
@@ -134,14 +121,11 @@ macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkC
|
||||
let retType = getTypeInst(e)
|
||||
let returnsVoid = retType.typeKind == ntyVoid
|
||||
|
||||
let rootSym = analyseRootSym(e[0])
|
||||
expectKind rootSym, nnkSym
|
||||
|
||||
when compileOption("threads"):
|
||||
if not isGcSafe(rootSym):
|
||||
if not isGcSafe(e[0]):
|
||||
error("'toTask' takes a GC safe call expression", e)
|
||||
|
||||
if hasClosure(rootSym):
|
||||
if hasClosure(e[0]):
|
||||
error("closure call is not allowed", e)
|
||||
|
||||
if e.len > 1:
|
||||
@@ -225,7 +209,7 @@ macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkC
|
||||
let funcCall = newCall(e[0], callNode)
|
||||
functionStmtList.add tempAssignList
|
||||
|
||||
let funcName = genSym(nskProc, rootSym.strVal)
|
||||
let funcName = genSym(nskProc, e[0].strVal)
|
||||
let destroyName = genSym(nskProc, "destroyScratch")
|
||||
let objTemp2 = genSym(ident = "obj")
|
||||
let tempNode = quote("@") do:
|
||||
@@ -257,7 +241,7 @@ macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkC
|
||||
Task(callback: `funcName`, args: `scratchIdent`, destroy: `destroyName`)
|
||||
else:
|
||||
let funcCall = newCall(e[0])
|
||||
let funcName = genSym(nskProc, rootSym.strVal)
|
||||
let funcName = genSym(nskProc, e[0].strVal)
|
||||
|
||||
if returnsVoid:
|
||||
result = quote do:
|
||||
|
||||
@@ -158,11 +158,9 @@ when defined(nimHasEnsureMove):
|
||||
## Ensures that `x` is moved to the new location, otherwise it gives
|
||||
## an error at the compile time.
|
||||
runnableExamples:
|
||||
proc foo =
|
||||
var x = "Hello"
|
||||
let y = ensureMove(x)
|
||||
doAssert y == "Hello"
|
||||
foo()
|
||||
var x = "Hello"
|
||||
let y = ensureMove(x)
|
||||
doAssert y == "Hello"
|
||||
discard "implemented in injectdestructors"
|
||||
|
||||
type
|
||||
@@ -1037,7 +1035,7 @@ const
|
||||
## Possible values:
|
||||
## `"i386"`, `"alpha"`, `"powerpc"`, `"powerpc64"`, `"powerpc64el"`,
|
||||
## `"sparc"`, `"amd64"`, `"mips"`, `"mipsel"`, `"arm"`, `"arm64"`,
|
||||
## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`, `"loongarch64"`.
|
||||
## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`, '"loongarch64"'.
|
||||
|
||||
seqShallowFlag = low(int)
|
||||
strlitFlag = 1 shl (sizeof(int)*8 - 2) # later versions of the codegen \
|
||||
|
||||
@@ -112,8 +112,11 @@ proc `[]`*[Idx, T; U, V: Ordinal](a: array[Idx, T], x: HSlice[U, V]): seq[T] {.s
|
||||
## ```
|
||||
let xa = a ^^ x.a
|
||||
let L = (a ^^ x.b) - xa + 1
|
||||
result = newSeq[T](L)
|
||||
# Workaround bug #22852:
|
||||
result = newSeq[T](if L < 0: 0 else: L)
|
||||
for i in 0..<L: result[i] = a[Idx(i + xa)]
|
||||
# Workaround bug #22852
|
||||
discard Natural(L)
|
||||
|
||||
proc `[]=`*[Idx, T; U, V: Ordinal](a: var array[Idx, T], x: HSlice[U, V], b: openArray[T]) {.systemRaisesDefect.} =
|
||||
## Slice assignment for arrays.
|
||||
|
||||
@@ -72,10 +72,6 @@ proc getCurrentExceptionMsg*(): string =
|
||||
proc setCurrentException*(exc: ref Exception) =
|
||||
lastJSError = cast[PJSError](exc)
|
||||
|
||||
proc closureIterSetupExc(e: ref Exception) {.compilerproc, inline.} =
|
||||
## Used to set up exception handling for closure iterators
|
||||
setCurrentException(e)
|
||||
|
||||
proc auxWriteStackTrace(f: PCallFrame): string =
|
||||
type
|
||||
TempFrame = tuple[procname: cstring, line: int, filename: cstring]
|
||||
@@ -622,6 +618,37 @@ proc nimCopy(dest, src: JSRef, ti: PNimType): JSRef =
|
||||
else:
|
||||
result = src
|
||||
|
||||
proc genericReset(x: JSRef, ti: PNimType): JSRef {.compilerproc.} =
|
||||
{.emit: "`result` = null;".}
|
||||
case ti.kind
|
||||
of tyPtr, tyRef, tyVar, tyNil:
|
||||
if isFatPointer(ti):
|
||||
{.emit: """
|
||||
`result` = [null, 0];
|
||||
""".}
|
||||
of tySet:
|
||||
{.emit: """
|
||||
`result` = {};
|
||||
""".}
|
||||
of tyTuple, tyObject:
|
||||
if ti.kind == tyObject:
|
||||
{.emit: "`result` = {m_type: `ti`};".}
|
||||
else:
|
||||
{.emit: "`result` = {};".}
|
||||
of tySequence, tyOpenArray, tyString:
|
||||
{.emit: """
|
||||
`result` = [];
|
||||
""".}
|
||||
of tyArrayConstr, tyArray:
|
||||
{.emit: """
|
||||
`result` = new Array(`x`.length);
|
||||
for (var i = 0; i < `x`.length; ++i) {
|
||||
`result`[i] = genericReset(`x`[i], `ti`.base);
|
||||
}
|
||||
""".}
|
||||
else:
|
||||
discard
|
||||
|
||||
proc arrayConstr(len: int, value: JSRef, typ: PNimType): JSRef {.
|
||||
asmNoStackFrame, compilerproc.} =
|
||||
# types are fake
|
||||
|
||||
@@ -90,12 +90,6 @@ proc prepareSeqAdd(len: int; p: pointer; addlen, elemSize, elemAlign: int): poin
|
||||
q.cap = newCap
|
||||
result = q
|
||||
|
||||
proc zeroNewElements(len: int; q: pointer; addlen, elemSize, elemAlign: int) {.
|
||||
noSideEffect, tags: [], raises: [], compilerRtl.} =
|
||||
{.noSideEffect.}:
|
||||
let headerSize = align(sizeof(NimSeqPayloadBase), elemAlign)
|
||||
zeroMem(q +! headerSize +! len * elemSize, addlen * elemSize)
|
||||
|
||||
proc prepareSeqAddUninit(len: int; p: pointer; addlen, elemSize, elemAlign: int): pointer {.
|
||||
noSideEffect, tags: [], raises: [], compilerRtl.} =
|
||||
{.noSideEffect.}:
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>nimdoc/extlinks/util</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -101,5 +97,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Nothing User Manual</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -41,5 +37,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>nimdoc/extlinks/project/main</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -138,5 +134,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>nimdoc/extlinks/project/sub/submodule</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -127,5 +123,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Index</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -55,5 +51,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Not a Nim Manual</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -270,5 +266,8 @@ stmt = IND{>} stmt ^+ IND{=} DED # list of statements
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>nimdoc/test_doctype/test_doctype</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -79,5 +75,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>nimdoc/test_out_index_dot_html/foo</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -101,5 +97,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Index</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -39,5 +35,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>subdir/subdir_b/utils</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -610,5 +606,8 @@ Ref. <a class="reference internal nimdoc" title="proc `[]`[T](x: G[T]): T" href=
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>testproject</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -1256,5 +1252,8 @@ bar
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Index</title>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||||
@@ -427,5 +423,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -116,13 +116,7 @@ proc main =
|
||||
for kind, key, val in getopt():
|
||||
case kind
|
||||
of cmdArgument:
|
||||
if dirExists(key):
|
||||
for file in walkDirRec(key, skipSpecial = true):
|
||||
if file.endsWith(".nim") or file.endsWith(".nimble"):
|
||||
infiles.add(file)
|
||||
else:
|
||||
infiles.add(key.addFileExt(".nim"))
|
||||
|
||||
infiles.add(key.addFileExt(".nim"))
|
||||
of cmdLongOption, cmdShortOption:
|
||||
case normalize(key)
|
||||
of "help", "h": writeHelp()
|
||||
|
||||
@@ -63,13 +63,10 @@ pkg "criterion", allowFailure = true # needs testing binary
|
||||
pkg "datamancer"
|
||||
pkg "dashing", "nim c tests/functional.nim"
|
||||
pkg "delaunay"
|
||||
pkg "dnsclient"
|
||||
pkg "docopt"
|
||||
pkg "dotenv"
|
||||
# when defined(linux): pkg "drchaos"
|
||||
pkg "easygl", "nim c -o:egl -r src/easygl.nim", "https://github.com/jackmott/easygl"
|
||||
pkg "elvis"
|
||||
pkg "faststreams"
|
||||
pkg "fidget"
|
||||
pkg "fragments", "nim c -r fragments/dsl.nim", allowFailure = true # pending https://github.com/nim-lang/packages/issues/2115
|
||||
pkg "fusion"
|
||||
@@ -82,13 +79,10 @@ pkg "gnuplot", "nim c gnuplot.nim"
|
||||
# pending https://github.com/nim-lang/Nim/issues/16509
|
||||
pkg "hts", "nim c -o:htss src/hts.nim"
|
||||
pkg "httpauth"
|
||||
pkg "httputils"
|
||||
pkg "illwill", "nimble examples"
|
||||
pkg "inim"
|
||||
pkg "itertools", "nim doc src/itertools.nim"
|
||||
pkg "iterutils"
|
||||
pkg "json_rpc"
|
||||
pkg "json_serialization"
|
||||
pkg "jstin"
|
||||
pkg "karax", "nim c -r tests/tester.nim"
|
||||
pkg "kdtree", "nimble test -d:nimLegacyRandomInitRand", "https://github.com/jblindsay/kdtree"
|
||||
@@ -130,7 +124,6 @@ pkg "nimwc", "nim c nimwc.nim"
|
||||
pkg "nimx", "nim c test/main.nim", allowFailure = true
|
||||
pkg "nitter", "nim c src/nitter.nim", "https://github.com/zedeus/nitter"
|
||||
pkg "norm", "testament r tests/common/tmodel.nim"
|
||||
pkg "normalize"
|
||||
pkg "npeg", "nimble testarc"
|
||||
pkg "numericalnim", "nimble nimCI"
|
||||
pkg "optionsutils"
|
||||
@@ -141,7 +134,6 @@ pkg "pixie"
|
||||
pkg "plotly", "nim c examples/all.nim"
|
||||
pkg "pnm"
|
||||
pkg "polypbren"
|
||||
pkg "presto"
|
||||
pkg "prologue", "nimble tcompile"
|
||||
pkg "protobuf", "nim c -o:protobuff -r src/protobuf.nim"
|
||||
pkg "pylib"
|
||||
@@ -153,7 +145,6 @@ pkg "RollingHash", "nim c -r tests/test_cyclichash.nim"
|
||||
pkg "rosencrantz", "nim c -o:rsncntz -r rosencrantz.nim"
|
||||
pkg "sdl1", "nim c -r src/sdl.nim"
|
||||
pkg "sdl2_nim", "nim c -r sdl2/sdl.nim"
|
||||
pkg "serialization"
|
||||
pkg "sigv4", "nim c --mm:arc -r sigv4.nim", "https://github.com/disruptek/sigv4"
|
||||
pkg "sim"
|
||||
pkg "smtp", "nimble compileExample"
|
||||
@@ -172,22 +163,18 @@ pkg "templates"
|
||||
pkg "tensordsl", "nim c -r --mm:refc tests/tests.nim", "https://krux02@bitbucket.org/krux02/tensordslnim.git"
|
||||
pkg "terminaltables", "nim c src/terminaltables.nim"
|
||||
pkg "termstyle", "nim c -r termstyle.nim"
|
||||
pkg "testutils"
|
||||
pkg "timeit"
|
||||
pkg "timezones"
|
||||
pkg "tiny_sqlite"
|
||||
pkg "unicodedb", "nim c -d:release -r tests/tests.nim"
|
||||
pkg "unicodeplus", "nim c -d:release -r tests/tests.nim"
|
||||
pkg "union", "nim c -r tests/treadme.nim", url = "https://github.com/alaviss/union"
|
||||
pkg "unittest2"
|
||||
pkg "unpack"
|
||||
pkg "weave", "nimble test_gc_arc", useHead = true
|
||||
pkg "websock"
|
||||
pkg "websocket", "nim c websocket.nim"
|
||||
# pkg "winim", allowFailure = true
|
||||
pkg "winim", "nim c winim.nim"
|
||||
pkg "with"
|
||||
pkg "ws", allowFailure = true
|
||||
pkg "yaml"
|
||||
pkg "zero_functional", "nim c -r test.nim"
|
||||
pkg "zippy"
|
||||
pkg "zxcvbn"
|
||||
|
||||
@@ -10,12 +10,9 @@
|
||||
## This program verifies Nim against the testcases.
|
||||
|
||||
import
|
||||
std/[strutils, pegs, os, osproc, streams, json,
|
||||
parseopt, browsers, terminal, exitprocs,
|
||||
algorithm, times, intsets, macros]
|
||||
|
||||
import backend, specs, azure, htmlgen
|
||||
|
||||
strutils, pegs, os, osproc, streams, json, std/exitprocs,
|
||||
backend, parseopt, specs, htmlgen, browsers, terminal,
|
||||
algorithm, times, azure, intsets, macros
|
||||
from std/sugar import dup
|
||||
import compiler/nodejs
|
||||
import lib/stdtest/testutils
|
||||
@@ -531,23 +528,6 @@ proc testSpecHelper(r: var TResults, test: var TTest, expected: TSpec,
|
||||
"exitcode: " & $given.exitCode & "\n\nOutput:\n" &
|
||||
given.nimout, reExitcodesDiffer)
|
||||
|
||||
|
||||
|
||||
proc changeTarget(extraOptions: string; defaultTarget: TTarget): TTarget =
|
||||
result = defaultTarget
|
||||
var p = parseopt.initOptParser(extraOptions)
|
||||
|
||||
while true:
|
||||
parseopt.next(p)
|
||||
case p.kind
|
||||
of cmdEnd: break
|
||||
of cmdLongOption, cmdShortOption:
|
||||
if p.key == "b" or p.key == "backend":
|
||||
result = parseEnum[TTarget](p.val.normalize)
|
||||
# chooses the last one
|
||||
else:
|
||||
discard
|
||||
|
||||
proc targetHelper(r: var TResults, test: TTest, expected: TSpec, extraOptions: string) =
|
||||
for target in expected.targets:
|
||||
inc(r.total)
|
||||
@@ -560,7 +540,6 @@ proc targetHelper(r: var TResults, test: TTest, expected: TSpec, extraOptions: s
|
||||
else:
|
||||
let nimcache = nimcacheDir(test.name, test.options, target)
|
||||
var testClone = test
|
||||
let target = changeTarget(extraOptions, target)
|
||||
testSpecHelper(r, testClone, expected, target, extraOptions, nimcache)
|
||||
|
||||
proc testSpec(r: var TResults, test: TTest, targets: set[TTarget] = {}) =
|
||||
|
||||
@@ -136,27 +136,4 @@ proc main2 =
|
||||
doAssert a.len == 2
|
||||
doAssert b.len == 0
|
||||
|
||||
main2()
|
||||
|
||||
block:
|
||||
type
|
||||
TestObj = object of RootObj
|
||||
name: string
|
||||
|
||||
TestSubObj = object of TestObj
|
||||
objname: string
|
||||
|
||||
proc `=destroy`(x: TestObj) =
|
||||
`=destroy`(x.name)
|
||||
|
||||
proc `=destroy`(x: TestSubObj) =
|
||||
`=destroy`(x.objname)
|
||||
`=destroy`(TestObj(x))
|
||||
|
||||
proc testCase() =
|
||||
let t1 {.used.} = TestSubObj(objname: "tso1", name: "to1")
|
||||
|
||||
proc main() =
|
||||
testCase()
|
||||
|
||||
main()
|
||||
main2()
|
||||
@@ -1,6 +1,5 @@
|
||||
discard """
|
||||
output: '''
|
||||
Destructor for TestTestObj
|
||||
=destroy called
|
||||
123xyzabc
|
||||
destroyed: false
|
||||
@@ -37,33 +36,9 @@ destroying variable: 20
|
||||
destroying variable: 10
|
||||
closed
|
||||
'''
|
||||
cmd: "nim c --mm:arc --deepcopy:on -d:nimAllocPagesViaMalloc $file"
|
||||
cmd: "nim c --gc:arc --deepcopy:on -d:nimAllocPagesViaMalloc $file"
|
||||
"""
|
||||
|
||||
block: # bug #23627
|
||||
type
|
||||
TestObj = object of RootObj
|
||||
|
||||
Test2 = object of RootObj
|
||||
foo: TestObj
|
||||
|
||||
TestTestObj = object of RootObj
|
||||
shit: TestObj
|
||||
|
||||
proc `=destroy`(x: TestTestObj) =
|
||||
echo "Destructor for TestTestObj"
|
||||
let test = Test2(foo: TestObj())
|
||||
|
||||
proc testCaseT() =
|
||||
let tt1 {.used.} = TestTestObj(shit: TestObj())
|
||||
|
||||
|
||||
proc main() =
|
||||
testCaseT()
|
||||
|
||||
main()
|
||||
|
||||
|
||||
# bug #9401
|
||||
|
||||
type
|
||||
@@ -71,12 +46,13 @@ type
|
||||
len: int
|
||||
data: ptr UncheckedArray[float]
|
||||
|
||||
proc `=destroy`*(m: MyObj) =
|
||||
proc `=destroy`*(m: var MyObj) =
|
||||
|
||||
echo "=destroy called"
|
||||
|
||||
if m.data != nil:
|
||||
deallocShared(m.data)
|
||||
m.data = nil
|
||||
|
||||
type
|
||||
MyObjDistinct = distinct MyObj
|
||||
@@ -128,7 +104,7 @@ bbb("123")
|
||||
type Variable = ref object
|
||||
value: int
|
||||
|
||||
proc `=destroy`(self: typeof(Variable()[])) =
|
||||
proc `=destroy`(self: var typeof(Variable()[])) =
|
||||
echo "destroying variable: ",self.value
|
||||
|
||||
proc newVariable(value: int): Variable =
|
||||
@@ -182,7 +158,7 @@ type
|
||||
B = ref object of A
|
||||
x: int
|
||||
|
||||
proc `=destroy`(x: AObj) =
|
||||
proc `=destroy`(x: var AObj) =
|
||||
close(x.io)
|
||||
echo "closed"
|
||||
|
||||
@@ -738,31 +714,3 @@ block:
|
||||
|
||||
let c: uint = 300'u
|
||||
doAssert $arrayWith(c, 3) == "[300, 300, 300]"
|
||||
|
||||
block: # bug #23505
|
||||
type
|
||||
K = object
|
||||
C = object
|
||||
value: ptr K
|
||||
|
||||
proc init(T: type C): C =
|
||||
let tmp = new K
|
||||
C(value: addr tmp[])
|
||||
|
||||
discard init(C)
|
||||
|
||||
block: # bug #23524
|
||||
type MyType = object
|
||||
a: int
|
||||
|
||||
proc `=destroy`(typ: MyType) = discard
|
||||
|
||||
var t1 = MyType(a: 100)
|
||||
var t2 = t1 # Should be a copy?
|
||||
|
||||
proc main() =
|
||||
t2 = t1
|
||||
doAssert t1.a == 100
|
||||
doAssert t2.a == 100
|
||||
|
||||
main()
|
||||
|
||||
@@ -4,7 +4,6 @@ discard """
|
||||
# Test the new ``emit`` pragma:
|
||||
|
||||
{.emit: """
|
||||
#include <stdio.h>
|
||||
static int cvariable = 420;
|
||||
|
||||
""".}
|
||||
|
||||
@@ -3,5 +3,4 @@ func test*(input: var openArray[int32], start: int = 0, fin: int = input.len - 1
|
||||
|
||||
var someSeq = @[1'i32]
|
||||
|
||||
test(someSeq)
|
||||
# bug with gcc 14
|
||||
test(someSeq)
|
||||
@@ -5,11 +5,11 @@ discard """
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncE6stringN14titaniummangle3FooE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncE3int7varargsI6stringE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncEN14titaniummangle3BooE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncE8typeDescIN14titaniummangle17EnumAnotherSampleEE'"
|
||||
ccodecheck: "'_ZN8testFunc8testFuncE8typeDescIN14titaniummangle17EnumAnotherSampleEE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncE3ptrI14uncheckedArrayI3intEE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncE3setIN14titaniummangle10EnumSampleEE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncE4procI6string6stringE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncE3intN10Comparable10ComparableE'"
|
||||
ccodecheck: "'_ZN8testFunc8testFuncE3intN10Comparable10ComparableE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncE3int3int'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncEN14titaniummangle10EnumSampleE'"
|
||||
ccodecheck: "'_ZN14titaniummangle8testFuncEN14titaniummangle17EnumAnotherSampleE'"
|
||||
@@ -37,6 +37,7 @@ type
|
||||
Comparable = concept x, y
|
||||
(x < y) is bool
|
||||
|
||||
type
|
||||
Foo = object
|
||||
a: int32
|
||||
b: int32
|
||||
@@ -44,10 +45,8 @@ type
|
||||
FooTuple = tuple
|
||||
a: int
|
||||
b: int
|
||||
|
||||
Container[T] = object
|
||||
data: T
|
||||
|
||||
data: T
|
||||
Container2[T, T2] = object
|
||||
data: T
|
||||
data2: T2
|
||||
|
||||
@@ -48,16 +48,8 @@ block:
|
||||
foo4(x)
|
||||
|
||||
block: # bug #9550
|
||||
block:
|
||||
type Foo = concept c
|
||||
for v in c: (v is char)
|
||||
type Foo = concept c
|
||||
for v in c: (v is char)
|
||||
|
||||
func foo(c: Foo) = (for v in c: discard)
|
||||
foo @['a', 'b' ,'c']
|
||||
|
||||
block:
|
||||
type Foo = concept c
|
||||
for v in c: (v is char)
|
||||
|
||||
func foo(c: Foo) = (for v in c: discard)
|
||||
foo ['a', 'b' ,'c']
|
||||
func foo(c: Foo) = (for v in c: discard)
|
||||
foo @['a', 'b' ,'c']
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
discard """
|
||||
targets: "cpp"
|
||||
cmd: "nim cpp -r $file"
|
||||
output: '''
|
||||
1.0
|
||||
1.0
|
||||
'''
|
||||
|
||||
"""
|
||||
{.emit:"""/*TYPESECTION*/
|
||||
struct Point {
|
||||
float x, y, z;
|
||||
Point(float x, float y, float z): x(x), y(y), z(z) {}
|
||||
Point() = default;
|
||||
};
|
||||
struct Direction {
|
||||
float x, y, z;
|
||||
Direction(float x, float y, float z): x(x), y(y), z(z) {}
|
||||
Direction() = default;
|
||||
};
|
||||
struct Axis {
|
||||
Point origin;
|
||||
Direction direction;
|
||||
Axis(Point origin, Direction direction): origin(origin), direction(direction) {}
|
||||
Axis() = default;
|
||||
};
|
||||
|
||||
""".}
|
||||
|
||||
type
|
||||
Point {.importcpp.} = object
|
||||
x, y, z: float
|
||||
|
||||
Direction {.importcpp.} = object
|
||||
x, y, z: float
|
||||
|
||||
Axis {.importcpp.} = object
|
||||
origin: Point
|
||||
direction: Direction
|
||||
|
||||
proc makeAxis(origin: Point, direction: Direction): Axis {. constructor, importcpp:"Axis(@)".}
|
||||
proc makePoint(x, y, z: float): Point {. constructor, importcpp:"Point(@)".}
|
||||
proc makeDirection(x, y, z: float): Direction {. constructor, importcpp:"Direction(@)".}
|
||||
|
||||
var axis1 = makeAxis(Point(x: 1.0, y: 2.0, z: 3.0), Direction(x: 4.0, y: 5.0, z: 6.0)) #Triggers the error (T1)
|
||||
var axis2Ctor = makeAxis(makePoint(1.0, 2.0, 3.0), makeDirection(4.0, 5.0, 6.0)) #Do not triggers
|
||||
|
||||
proc main() = #Do not triggers as Tx are inside the body
|
||||
let test = makeAxis(Point(x: 1.0, y: 2.0, z: 3.0), Direction(x: 4.0, y: 5.0, z: 6.0))
|
||||
echo test.origin.x
|
||||
|
||||
main()
|
||||
|
||||
echo $axis1.origin.x #Make sures it's init
|
||||
@@ -1,27 +0,0 @@
|
||||
discard """
|
||||
targets: "cpp"
|
||||
cmd: "nim cpp $file"
|
||||
output: '''
|
||||
abc called
|
||||
def called
|
||||
abc called
|
||||
'''
|
||||
"""
|
||||
|
||||
type Foo = object
|
||||
|
||||
proc abc(this: Foo, x: int): void {.member: "$1('2 #2)".}
|
||||
proc def(this: Foo, y: int): void {.virtual: "$1('2 #2)".}
|
||||
|
||||
proc abc(this: Foo, x: int): void =
|
||||
echo "abc called"
|
||||
if x > 0:
|
||||
this.def(x - 1)
|
||||
|
||||
proc def(this: Foo, y: int): void =
|
||||
echo "def called"
|
||||
this.abc(y)
|
||||
|
||||
var x = Foo()
|
||||
x.abc(1)
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
discard """
|
||||
matrix: "-u:nimPreviewNonVarDestructor;"
|
||||
"""
|
||||
type DistinctSeq* = distinct seq[int]
|
||||
|
||||
# `=destroy`(cast[ptr DistinctSeq](0)[])
|
||||
var x = @[].DistinctSeq
|
||||
`=destroy`(x)
|
||||
@@ -137,29 +137,28 @@ doAssert seq3[0] == 1.0
|
||||
var seq4, seq5: MySeqNonCopyable
|
||||
(seq4, i, seq5) = myfunc2(2, 3)
|
||||
|
||||
proc foo =
|
||||
seq4 = block:
|
||||
var tmp = newMySeq(4, 1.0)
|
||||
tmp[0] = 3.0
|
||||
tmp
|
||||
seq4 = block:
|
||||
var tmp = newMySeq(4, 1.0)
|
||||
tmp[0] = 3.0
|
||||
tmp
|
||||
|
||||
doAssert seq4[0] == 3.0
|
||||
doAssert seq4[0] == 3.0
|
||||
|
||||
import macros
|
||||
|
||||
seq4 =
|
||||
if i > 0: newMySeq(2, 5.0)
|
||||
elif i < -100: raise newException(ValueError, "Parse Error")
|
||||
else: newMySeq(2, 3.0)
|
||||
seq4 =
|
||||
if i > 0: newMySeq(2, 5.0)
|
||||
elif i < -100: raise newException(ValueError, "Parse Error")
|
||||
else: newMySeq(2, 3.0)
|
||||
|
||||
seq4 =
|
||||
case (char) i:
|
||||
of 'A', {'W'..'Z'}: newMySeq(2, 5.0)
|
||||
of 'B': quit(-1)
|
||||
else:
|
||||
let (x1, x2, x3) = myfunc2(2, 3)
|
||||
x3
|
||||
seq4 =
|
||||
case (char) i:
|
||||
of 'A', {'W'..'Z'}: newMySeq(2, 5.0)
|
||||
of 'B': quit(-1)
|
||||
else:
|
||||
let (x1, x2, x3) = myfunc2(2, 3)
|
||||
x3
|
||||
|
||||
foo()
|
||||
|
||||
#------------------------------------------------------------
|
||||
#-- Move into array constructor
|
||||
|
||||
@@ -184,84 +184,3 @@ block: # bug #12589
|
||||
A = int64.high()
|
||||
|
||||
doAssert ord(A) == int64.high()
|
||||
|
||||
import std/enumutils
|
||||
from std/sequtils import toSeq
|
||||
import std/macros
|
||||
|
||||
block: # unordered enum
|
||||
block:
|
||||
type
|
||||
unordered_enum = enum
|
||||
a = 1
|
||||
b = 0
|
||||
|
||||
doAssert (ord(a), ord(b)) == (1, 0)
|
||||
doAssert unordered_enum.toSeq == @[a, b]
|
||||
|
||||
block:
|
||||
type
|
||||
unordered_enum = enum
|
||||
a = 1
|
||||
b = 0
|
||||
c
|
||||
|
||||
doAssert (ord(a), ord(b), ord(c)) == (1, 0, 2)
|
||||
|
||||
block:
|
||||
type
|
||||
unordered_enum = enum
|
||||
a = 100
|
||||
b
|
||||
c = 50
|
||||
d
|
||||
|
||||
doAssert (ord(a), ord(b), ord(c), ord(d)) == (100, 101, 50, 51)
|
||||
|
||||
block:
|
||||
type
|
||||
unordered_enum = enum
|
||||
a = 7
|
||||
b = 6
|
||||
c = 5
|
||||
d
|
||||
|
||||
doAssert (ord(a), ord(b), ord(c), ord(d)) == (7, 6, 5, 8)
|
||||
doAssert unordered_enum.toSeq == @[a, b, c, d]
|
||||
|
||||
block:
|
||||
type
|
||||
unordered_enum = enum
|
||||
a = 100
|
||||
b
|
||||
c = 500
|
||||
d
|
||||
e
|
||||
f = 50
|
||||
g
|
||||
h
|
||||
|
||||
doAssert (ord(a), ord(b), ord(c), ord(d), ord(e), ord(f), ord(g), ord(h)) ==
|
||||
(100, 101, 500, 501, 502, 50, 51, 52)
|
||||
|
||||
block:
|
||||
type
|
||||
unordered_enum = enum
|
||||
A
|
||||
B
|
||||
C = -1
|
||||
D
|
||||
E
|
||||
G = -999
|
||||
|
||||
doAssert (ord(A), ord(B), ord(C), ord(D), ord(E), ord(G)) ==
|
||||
(0, 1, -1, 2, 3, -999)
|
||||
|
||||
block:
|
||||
type
|
||||
SomeEnum = enum
|
||||
seA = 3
|
||||
seB = 2
|
||||
seC = "foo"
|
||||
|
||||
doAssert (ord(seA), ord(seB), ord(seC)) == (3, 2, 4)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
discard """
|
||||
errormsg: "duplicate value in enum 'd'"
|
||||
"""
|
||||
|
||||
type
|
||||
unordered_enum = enum
|
||||
a = 1
|
||||
b = 0
|
||||
c
|
||||
d = 2
|
||||
@@ -1,5 +0,0 @@
|
||||
discard """
|
||||
errormsg: "invalid type: 'void' in this context: '(array[0..-1, void],)' for var"
|
||||
"""
|
||||
|
||||
var a: (array[0, void], )
|
||||
@@ -1,12 +0,0 @@
|
||||
discard """
|
||||
outputsub: "Error: unhandled exception: value out of range: -15 notin 0 .. 9223372036854775807 [RangeDefect]"
|
||||
exitcode: "1"
|
||||
"""
|
||||
|
||||
# bug #23435
|
||||
proc foo() =
|
||||
for _ in @[1, 3, 5]:
|
||||
discard "abcde"[25..<10]
|
||||
break
|
||||
|
||||
foo()
|
||||
@@ -1,26 +0,0 @@
|
||||
discard """
|
||||
matrix: "--stackTrace:on --excessiveStackTrace:off"
|
||||
"""
|
||||
|
||||
const expected = """
|
||||
wrong trace:
|
||||
t23536.nim(22) t23536
|
||||
t23536.nim(17) foo
|
||||
assertions.nim(41) failedAssertImpl
|
||||
assertions.nim(36) raiseAssert
|
||||
fatal.nim(53) sysFatal
|
||||
"""
|
||||
|
||||
|
||||
try:
|
||||
proc foo = # bug #23536
|
||||
doAssert false
|
||||
|
||||
for i in 0 .. 1:
|
||||
|
||||
|
||||
foo()
|
||||
except AssertionDefect:
|
||||
let e = getCurrentException()
|
||||
let trace = e.getStackTrace
|
||||
doAssert "wrong trace:\n" & trace == expected
|
||||
@@ -1,61 +0,0 @@
|
||||
discard """
|
||||
cmd: "nim check --hints:off $file"
|
||||
action: "reject"
|
||||
nimout: '''
|
||||
tmetaobjectfields.nim(24, 5) Error: 'array' is not a concrete type
|
||||
tmetaobjectfields.nim(28, 5) Error: 'seq' is not a concrete type
|
||||
tmetaobjectfields.nim(32, 5) Error: 'set' is not a concrete type
|
||||
tmetaobjectfields.nim(35, 3) Error: 'sink' is not a concrete type
|
||||
tmetaobjectfields.nim(37, 3) Error: 'lent' is not a concrete type
|
||||
tmetaobjectfields.nim(54, 16) Error: 'seq' is not a concrete type
|
||||
tmetaobjectfields.nim(58, 5) Error: 'ptr' is not a concrete type
|
||||
tmetaobjectfields.nim(59, 5) Error: 'ref' is not a concrete type
|
||||
tmetaobjectfields.nim(60, 5) Error: 'auto' is not a concrete type
|
||||
tmetaobjectfields.nim(61, 5) Error: 'UncheckedArray' is not a concrete type
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
# bug #6982
|
||||
# bug #19546
|
||||
# bug #23531
|
||||
type
|
||||
ExampleObj1 = object
|
||||
arr: array
|
||||
|
||||
type
|
||||
ExampleObj2 = object
|
||||
arr: seq
|
||||
|
||||
type
|
||||
ExampleObj3 = object
|
||||
arr: set
|
||||
|
||||
type A = object
|
||||
b: sink
|
||||
# a: openarray
|
||||
c: lent
|
||||
|
||||
type PropertyKind = enum
|
||||
tInt,
|
||||
tFloat,
|
||||
tBool,
|
||||
tString,
|
||||
tArray
|
||||
|
||||
type
|
||||
Property = ref PropertyObj
|
||||
PropertyObj = object
|
||||
case kind: PropertyKind
|
||||
of tInt: intValue: int
|
||||
of tFloat: floatValue: float
|
||||
of tBool: boolValue: bool
|
||||
of tString: stringValue: string
|
||||
of tArray: arrayValue: seq
|
||||
|
||||
type
|
||||
RegressionTest = object
|
||||
a: ptr
|
||||
b: ref
|
||||
c: auto
|
||||
d: UncheckedArray
|
||||
@@ -1,24 +0,0 @@
|
||||
block: # issue #23568
|
||||
type G[T] = object
|
||||
j: T
|
||||
proc s[T](u: int) = discard
|
||||
proc s[T]() = discard
|
||||
proc c(e: int | int): G[G[G[int]]] = s[G[G[int]]]()
|
||||
discard c(0)
|
||||
|
||||
import std/options
|
||||
|
||||
block: # issue #23310
|
||||
type
|
||||
BID = string or uint64
|
||||
Future[T] = ref object of RootObj
|
||||
internalValue: T
|
||||
InternalRaisesFuture[T] = ref object of Future[T]
|
||||
proc newInternalRaisesFutureImpl[T](): InternalRaisesFuture[T] =
|
||||
let fut = InternalRaisesFuture[T]()
|
||||
template newFuture[T](): auto =
|
||||
newInternalRaisesFutureImpl[T]()
|
||||
proc problematic(blockId: BID): Future[Option[seq[int]]] =
|
||||
let resultFuture = newFuture[Option[seq[int]]]()
|
||||
return resultFuture
|
||||
let x = problematic("latest")
|
||||
@@ -1,5 +1,6 @@
|
||||
discard """
|
||||
matrix: "; --backend:js --jsbigint64:off; --backend:js --jsbigint64:on"
|
||||
targets: "c js"
|
||||
output: '''
|
||||
0 0
|
||||
0 0
|
||||
@@ -7,6 +8,7 @@ Success'''
|
||||
"""
|
||||
# Test the different integer operations
|
||||
|
||||
# TODO: fixme --backend:js cannot change targets!!!
|
||||
|
||||
import std/private/jsutils
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
discard """
|
||||
errormsg: "Closure iterators are not supported by JS backend!"
|
||||
"""
|
||||
|
||||
iterator iter*(): int {.closure.} =
|
||||
yield 3
|
||||
|
||||
var x = iter
|
||||
doAssert x() == 3
|
||||
|
||||
let fIt = iterator(): int = yield 70
|
||||
doAssert fIt() == 70
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
block:
|
||||
type Enum = enum a, b
|
||||
|
||||
block:
|
||||
let a = b
|
||||
let x: Enum = a
|
||||
doAssert x == b
|
||||
|
||||
block:
|
||||
type
|
||||
Enum = enum
|
||||
a = 2
|
||||
b = 10
|
||||
|
||||
iterator items2(): Enum =
|
||||
for a in [a, b]:
|
||||
yield a
|
||||
|
||||
var s = newSeq[Enum]()
|
||||
for i in items2():
|
||||
s.add i
|
||||
doAssert s == @[a, b]
|
||||
@@ -1,13 +0,0 @@
|
||||
# issue #23596
|
||||
|
||||
import std/heapqueue
|
||||
type Algo = enum heapqueue, quick
|
||||
when false:
|
||||
let x = heapqueue
|
||||
let y: Algo = heapqueue
|
||||
proc bar*(algo=quick) =
|
||||
var x: HeapQueue[int]
|
||||
case algo
|
||||
of heapqueue: echo 1 # `Algo.heapqueue` works on devel
|
||||
of quick: echo 2
|
||||
echo x.len
|
||||
@@ -1,6 +0,0 @@
|
||||
import std/heapqueue
|
||||
proc heapqueue(x: int) = discard
|
||||
let x: proc (x: int) = heapqueue
|
||||
let y: proc = heapqueue
|
||||
when false:
|
||||
let z = heapqueue
|
||||
@@ -365,14 +365,3 @@ block: # enum.len
|
||||
doAssert MyEnum.enumLen == 4
|
||||
doAssert OtherEnum.enumLen == 3
|
||||
doAssert MyFlag.enumLen == 4
|
||||
|
||||
when true: # Odd bug where alias can seep inside of `distinctBase`
|
||||
import std/unittest
|
||||
|
||||
type
|
||||
AdtChild* = concept t
|
||||
distinctBase(t)
|
||||
|
||||
proc `$`*[T: AdtChild](adtChild: T): string = ""
|
||||
|
||||
check 10 is int
|
||||
|
||||
@@ -18,7 +18,7 @@ renderer.setDrawColor 29, 64, 153, 255
|
||||
renderer.clear
|
||||
renderer.setDrawColor 255, 255, 255, 255
|
||||
|
||||
when false: # no long work with gcc 14!
|
||||
when defined(c):
|
||||
# just to ensure code from NimInAction still works, but
|
||||
# the `else` branch would work as well in C mode
|
||||
var points = [
|
||||
|
||||
@@ -48,41 +48,6 @@ proc main =
|
||||
doAssert testing(mySeq) == mySeq
|
||||
doAssert testing(mySeq[2..^2]) == mySeq[2..^2]
|
||||
|
||||
block: # bug #23321
|
||||
block:
|
||||
proc foo(x: openArray[int]) =
|
||||
doAssert x[0] == 0
|
||||
|
||||
var d = new array[1, int]
|
||||
foo d[].toOpenArray(0, 0)
|
||||
|
||||
block:
|
||||
proc foo(x: openArray[int]) =
|
||||
doAssert x[0] == 0
|
||||
|
||||
proc task(x: var array[1, int]): var array[1, int] =
|
||||
result = x
|
||||
var d: array[1, int]
|
||||
foo task(d).toOpenArray(0, 0)
|
||||
|
||||
block:
|
||||
proc foo(x: openArray[int]) =
|
||||
doAssert x[0] == 0
|
||||
|
||||
proc task(x: var array[1, int]): lent array[1, int] =
|
||||
result = x
|
||||
var d: array[1, int]
|
||||
foo task(d).toOpenArray(0, 0)
|
||||
|
||||
block:
|
||||
proc foo(x: openArray[int]) =
|
||||
doAssert x[0] == 0
|
||||
|
||||
proc task(x: var array[1, int]): ptr array[1, int] =
|
||||
result = addr x
|
||||
var d: array[1, int]
|
||||
foo task(d)[].toOpenArray(0, 0)
|
||||
|
||||
|
||||
main()
|
||||
static: main()
|
||||
|
||||
@@ -18,8 +18,6 @@ template main() =
|
||||
doAssert encode("") == ""
|
||||
doAssert decode("") == ""
|
||||
|
||||
doAssert decode(" ") == ""
|
||||
|
||||
const testInputExpandsTo76 = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||
const testInputExpands = "++++++++++++++++++++++++++++++"
|
||||
const longText = """Man is distinguished, not only by his reason, but by this
|
||||
|
||||
@@ -84,9 +84,6 @@ let t = polar(a)
|
||||
doAssert(rect(t.r, t.phi) =~ a)
|
||||
doAssert(rect(1.0, 2.0) =~ complex(-0.4161468365471424, 0.9092974268256817))
|
||||
|
||||
doAssert(almostEqual(a, a + complex(1e-16, 1e-16)))
|
||||
doAssert(almostEqual(a, a + complex(2e-15, 2e-15), unitsInLastPlace = 5))
|
||||
|
||||
|
||||
let
|
||||
i64: Complex32 = complex(0.0f, 1.0f)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user