move {.injectStmt.} to experimental; add a test (#18300)

* move {.injectStmt.} to experimental; add a test

* undocument and deprecat `.injectStmt` but keep its implementation until we have a replacement
This commit is contained in:
Timothee Cour 2021-06-20 00:51:07 -07:00 • committed by GitHub
commit 6030e139b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 15 deletions

View file

@ -1183,6 +1183,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
if sym == nil: invalidPragma(c, it)
else: magicsys.registerNimScriptSymbol(c.graph, sym)
of wInjectStmt:
warningDeprecated(c.config, it.info, "'.injectStmt' pragma is deprecated")
if it.kind notin nkPragmaCallKinds or it.len != 2:
localError(c.config, it.info, "expression expected")
else:
@ -1194,10 +1195,10 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
of wThis:
if it.kind in nkPragmaCallKinds and it.len == 2:
c.selfName = considerQuotedIdent(c, it[1])
message(c.config, n.info, warnDeprecated, "the '.this' pragma is deprecated")
message(c.config, n.info, warnDeprecated, "'.this' pragma is deprecated")
elif it.kind == nkIdent or it.len == 1:
c.selfName = getIdent(c.cache, "self")
message(c.config, n.info, warnDeprecated, "the '.this' pragma is deprecated")
message(c.config, n.info, warnDeprecated, "'.this' pragma is deprecated")
else:
localError(c.config, it.info, "'this' pragma is allowed to have zero or one arguments")
of wNoRewrite: