authorgravatar for 14938807+xackus@users.noreply.github.comxackus <14938807+xackus@users.noreply.github.com> 2020-04-07 22:55:52+02:00
committergravatar for 14938807+xackus@users.noreply.github.comxackus <14938807+xackus@users.noreply.github.com> 2020-04-07 23:37:01+02:00
logbf46117f1314653df3a70ede05aabcd599ce6b08
treea60f55188c5f0f8b31da51b1d4b8c2a8223198c1
parented23dad4877cd93fd684852b17e0e554ef71e297

std lib docs: fix null and int values


2 files changed, 24 insertions(+), 0 deletions(-)

lib/std/special/docs/main.js+12
......@@ -542,8 +542,20 @@
542542 } else {
543543 return value + "";
544544 }
545 case typeKinds.Optional:
546 if(value === 'null'){
547 if (wantHtml) {
548 return '<span class="tok-null">' + value + '</span>';
549 } else {
550 return value + "";
551 }
552 } else {
553 console.trace("TODO non-null optional value printing");
554 return "TODO";
555 }
545556 default:
546557 console.trace("TODO implement getValueText for this type:", zigAnalysis.typeKinds[typeObj.kind]);
558 return "TODO";
547559 }
548560 }
549561
src/dump_analysis.cpp+12
......@@ -693,6 +693,18 @@ static void anal_dump_value(AnalDumpCtx *ctx, AstNode *source_node, ZigType *ty,
693693 }
694694 return;
695695 }
696 case ZigTypeIdOptional: {
697 if(optional_value_is_null(value)){
698 jw_string(&ctx->jw, "null");
699 } else {
700 jw_null(&ctx->jw);
701 }
702 return;
703 }
704 case ZigTypeIdInt: {
705 jw_bigint(&ctx->jw, &value->data.x_bigint);
706 return;
707 }
696708 default:
697709 jw_null(&ctx->jw);
698710 return;