commit bf46117f1314653df3a70ede05aabcd599ce6b08 (tree)
parent ed23dad4877cd93fd684852b17e0e554ef71e297
Author: xackus <14938807+xackus@users.noreply.github.com>
Date: Tue, 7 Apr 2020 22:55:52 +0200
std lib docs: fix null and int values
Diffstat:
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/lib/std/special/docs/main.js b/lib/std/special/docs/main.js
@@ -542,8 +542,20 @@
} else {
return value + "";
}
+ case typeKinds.Optional:
+ if(value === 'null'){
+ if (wantHtml) {
+ return '<span class="tok-null">' + value + '</span>';
+ } else {
+ return value + "";
+ }
+ } else {
+ console.trace("TODO non-null optional value printing");
+ return "TODO";
+ }
default:
console.trace("TODO implement getValueText for this type:", zigAnalysis.typeKinds[typeObj.kind]);
+ return "TODO";
}
}
diff --git a/src/dump_analysis.cpp b/src/dump_analysis.cpp
@@ -693,6 +693,18 @@ static void anal_dump_value(AnalDumpCtx *ctx, AstNode *source_node, ZigType *ty,
}
return;
}
+ case ZigTypeIdOptional: {
+ if(optional_value_is_null(value)){
+ jw_string(&ctx->jw, "null");
+ } else {
+ jw_null(&ctx->jw);
+ }
+ return;
+ }
+ case ZigTypeIdInt: {
+ jw_bigint(&ctx->jw, &value->data.x_bigint);
+ return;
+ }
default:
jw_null(&ctx->jw);
return;