Implement non-null assertions (#443)

This commit is contained in:
Daniel Wirtz
2019-01-30 09:56:13 +01:00
committed by GitHub
parent 2fe228ff00
commit d843772314
11 changed files with 413 additions and 32 deletions

View File

@ -526,6 +526,13 @@ export class Signature {
this.type = Type.u32.asFunction(this);
}
asFunctionTarget(program: Program): FunctionTarget {
var target = this.cachedFunctionTarget;
if (!target) this.cachedFunctionTarget = target = new FunctionTarget(program, this);
else assert(target.program == program);
return target;
}
/** Gets the known or, alternatively, generic parameter name at the specified index. */
getParameterName(index: i32): string {
var parameterNames = this.parameterNames;