std lib docs: fix null and int values

This commit is contained in:
xackus 2020-04-07 22:55:52 +02:00
parent ed23dad487
commit bf46117f13
2 changed files with 24 additions and 0 deletions

View File

@ -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";
}
}

View File

@ -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;