mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 01:41:30 +00:00
More cleanup
This commit is contained in:
@ -41,7 +41,11 @@ import {
|
||||
} from "./program";
|
||||
|
||||
/** Compiles a get of a built-in global. */
|
||||
export function compileGetConstant(compiler: Compiler, global: Global, reportNode: Node): ExpressionRef {
|
||||
export function compileGetConstant(
|
||||
compiler: Compiler,
|
||||
global: Global,
|
||||
reportNode: Node
|
||||
): ExpressionRef {
|
||||
switch (global.internalName) {
|
||||
|
||||
case "NaN": // context-sensitive
|
||||
@ -58,14 +62,23 @@ export function compileGetConstant(compiler: Compiler, global: Global, reportNod
|
||||
|
||||
case "HEAP_BASE": // never inlined for linking purposes
|
||||
compiler.currentType = compiler.options.usizeType;
|
||||
return compiler.module.createGetGlobal("HEAP_BASE", compiler.options.nativeSizeType);
|
||||
return compiler.module.createGetGlobal(
|
||||
"HEAP_BASE", compiler.currentType.toNativeType()
|
||||
);
|
||||
}
|
||||
compiler.error(DiagnosticCode.Operation_not_supported, reportNode.range);
|
||||
return compiler.module.createUnreachable();
|
||||
}
|
||||
|
||||
/** Compiles a call to a built-in function. */
|
||||
export function compileCall(compiler: Compiler, prototype: FunctionPrototype, typeArguments: Type[] | null, operands: Expression[], contextualType: Type, reportNode: Node): ExpressionRef {
|
||||
export function compileCall(
|
||||
compiler: Compiler,
|
||||
prototype: FunctionPrototype,
|
||||
typeArguments: Type[] | null,
|
||||
operands: Expression[],
|
||||
contextualType: Type,
|
||||
reportNode: Node
|
||||
): ExpressionRef {
|
||||
var module = compiler.module;
|
||||
|
||||
var arg0: ExpressionRef,
|
||||
|
Reference in New Issue
Block a user