1
0
mirror of https://github.com/fluencelabs/assemblyscript synced 2025-07-24 02:32:07 +00:00

refactor, indexof, map/set overloads

This commit is contained in:
dcode
2019-06-17 16:17:27 +02:00
parent 8571df939f
commit f8f2565f60
23 changed files with 1091 additions and 645 deletions

@@ -30,11 +30,11 @@ export enum NodeKind {
SOURCE, SOURCE,
// types // types
TYPE, NAMEDTYPE,
FUNCTIONTYPE,
TYPENAME, TYPENAME,
TYPEPARAMETER, TYPEPARAMETER,
PARAMETER, PARAMETER,
SIGNATURE,
// expressions // expressions
IDENTIFIER, IDENTIFIER,
@@ -164,13 +164,13 @@ export abstract class Node {
return Node.createTypeName(Node.createIdentifierExpression(name, range), range); return Node.createTypeName(Node.createIdentifierExpression(name, range), range);
} }
static createType( static createNamedType(
name: TypeName, name: TypeName,
typeArguments: CommonTypeNode[] | null, typeArguments: TypeNode[] | null,
isNullable: bool, isNullable: bool,
range: Range range: Range
): TypeNode { ): NamedTypeNode {
var type = new TypeNode(); var type = new NamedTypeNode();
type.range = range; type.range = range;
type.name = name; type.name = name;
type.typeArguments = typeArguments; type.typeArguments = typeArguments;
@@ -178,10 +178,26 @@ export abstract class Node {
return type; return type;
} }
static createFunctionType(
parameters: ParameterNode[],
returnType: TypeNode,
explicitThisType: NamedTypeNode | null,
isNullable: bool,
range: Range
): FunctionTypeNode {
var type = new FunctionTypeNode();
type.range = range;
type.parameters = parameters;
type.returnType = returnType;
type.explicitThisType = explicitThisType;
type.isNullable = isNullable;
return type;
}
static createOmittedType( static createOmittedType(
range: Range range: Range
): TypeNode { ): NamedTypeNode {
return Node.createType( return Node.createNamedType(
Node.createSimpleTypeName("", range), Node.createSimpleTypeName("", range),
null, null,
false, false,
@@ -191,8 +207,8 @@ export abstract class Node {
static createTypeParameter( static createTypeParameter(
name: IdentifierExpression, name: IdentifierExpression,
extendsType: TypeNode | null, extendsType: NamedTypeNode | null,
defaultType: TypeNode | null, defaultType: NamedTypeNode | null,
range: Range range: Range
): TypeParameterNode { ): TypeParameterNode {
var elem = new TypeParameterNode(); var elem = new TypeParameterNode();
@@ -205,7 +221,7 @@ export abstract class Node {
static createParameter( static createParameter(
name: IdentifierExpression, name: IdentifierExpression,
type: CommonTypeNode, type: TypeNode,
initializer: Expression | null, initializer: Expression | null,
kind: ParameterKind, kind: ParameterKind,
range: Range range: Range
@@ -219,22 +235,6 @@ export abstract class Node {
return elem; return elem;
} }
static createSignature(
parameters: ParameterNode[],
returnType: CommonTypeNode,
explicitThisType: TypeNode | null,
isNullable: bool,
range: Range
): SignatureNode {
var sig = new SignatureNode();
sig.range = range;
sig.parameters = parameters;
sig.returnType = returnType;
sig.explicitThisType = explicitThisType;
sig.isNullable = isNullable;
return sig;
}
// special // special
static createDecorator( static createDecorator(
@@ -299,7 +299,7 @@ export abstract class Node {
static createAssertionExpression( static createAssertionExpression(
assertionKind: AssertionKind, assertionKind: AssertionKind,
expression: Expression, expression: Expression,
toType: CommonTypeNode | null, toType: TypeNode | null,
range: Range range: Range
): AssertionExpression { ): AssertionExpression {
var expr = new AssertionExpression(); var expr = new AssertionExpression();
@@ -326,7 +326,7 @@ export abstract class Node {
static createCallExpression( static createCallExpression(
expression: Expression, expression: Expression,
typeArgs: CommonTypeNode[] | null, typeArgs: TypeNode[] | null,
args: Expression[], args: Expression[],
range: Range range: Range
): CallExpression { ): CallExpression {
@@ -406,7 +406,7 @@ export abstract class Node {
static createInstanceOfExpression( static createInstanceOfExpression(
expression: Expression, expression: Expression,
isType: CommonTypeNode, isType: TypeNode,
range: Range range: Range
): InstanceOfExpression { ): InstanceOfExpression {
var expr = new InstanceOfExpression(); var expr = new InstanceOfExpression();
@@ -428,7 +428,7 @@ export abstract class Node {
static createNewExpression( static createNewExpression(
expression: Expression, expression: Expression,
typeArgs: CommonTypeNode[] | null, typeArgs: TypeNode[] | null,
args: Expression[], args: Expression[],
range: Range range: Range
): NewExpression { ): NewExpression {
@@ -591,8 +591,8 @@ export abstract class Node {
static createClassDeclaration( static createClassDeclaration(
identifier: IdentifierExpression, identifier: IdentifierExpression,
typeParameters: TypeParameterNode[] | null, typeParameters: TypeParameterNode[] | null,
extendsType: TypeNode | null, // can't be a function extendsType: NamedTypeNode | null, // can't be a function
implementsTypes: TypeNode[] | null, // can't be functions implementsTypes: NamedTypeNode[] | null, // can't be functions
members: DeclarationStatement[], members: DeclarationStatement[],
decorators: DecoratorNode[] | null, decorators: DecoratorNode[] | null,
flags: CommonFlags, flags: CommonFlags,
@@ -828,7 +828,7 @@ export abstract class Node {
static createInterfaceDeclaration( static createInterfaceDeclaration(
name: IdentifierExpression, name: IdentifierExpression,
typeParameters: TypeParameterNode[] | null, typeParameters: TypeParameterNode[] | null,
extendsType: TypeNode | null, // can't be a function extendsType: NamedTypeNode | null, // can't be a function
members: DeclarationStatement[], members: DeclarationStatement[],
decorators: DecoratorNode[] | null, decorators: DecoratorNode[] | null,
flags: CommonFlags, flags: CommonFlags,
@@ -847,7 +847,7 @@ export abstract class Node {
static createFieldDeclaration( static createFieldDeclaration(
name: IdentifierExpression, name: IdentifierExpression,
type: CommonTypeNode | null, type: TypeNode | null,
initializer: Expression | null, initializer: Expression | null,
decorators: DecoratorNode[] | null, decorators: DecoratorNode[] | null,
flags: CommonFlags, flags: CommonFlags,
@@ -882,7 +882,7 @@ export abstract class Node {
static createFunctionDeclaration( static createFunctionDeclaration(
name: IdentifierExpression, name: IdentifierExpression,
typeParameters: TypeParameterNode[] | null, typeParameters: TypeParameterNode[] | null,
signature: SignatureNode, signature: FunctionTypeNode,
body: Statement | null, body: Statement | null,
decorators: DecoratorNode[] | null, decorators: DecoratorNode[] | null,
flags: CommonFlags, flags: CommonFlags,
@@ -902,8 +902,8 @@ export abstract class Node {
} }
static createIndexSignatureDeclaration( static createIndexSignatureDeclaration(
keyType: TypeNode, keyType: NamedTypeNode,
valueType: CommonTypeNode, valueType: TypeNode,
range: Range range: Range
): IndexSignatureDeclaration { ): IndexSignatureDeclaration {
var elem = new IndexSignatureDeclaration(); var elem = new IndexSignatureDeclaration();
@@ -916,7 +916,7 @@ export abstract class Node {
static createMethodDeclaration( static createMethodDeclaration(
name: IdentifierExpression, name: IdentifierExpression,
typeParameters: TypeParameterNode[] | null, typeParameters: TypeParameterNode[] | null,
signature: SignatureNode, signature: FunctionTypeNode,
body: Statement | null, body: Statement | null,
decorators: DecoratorNode[] | null, decorators: DecoratorNode[] | null,
flags: CommonFlags, flags: CommonFlags,
@@ -1012,7 +1012,7 @@ export abstract class Node {
static createTypeDeclaration( static createTypeDeclaration(
name: IdentifierExpression, name: IdentifierExpression,
typeParameters: TypeParameterNode[] | null, typeParameters: TypeParameterNode[] | null,
alias: CommonTypeNode, alias: TypeNode,
decorators: DecoratorNode[] | null, decorators: DecoratorNode[] | null,
flags: CommonFlags, flags: CommonFlags,
range: Range range: Range
@@ -1041,7 +1041,7 @@ export abstract class Node {
static createVariableDeclaration( static createVariableDeclaration(
name: IdentifierExpression, name: IdentifierExpression,
type: CommonTypeNode | null, type: TypeNode | null,
initializer: Expression | null, initializer: Expression | null,
decorators: DecoratorNode[] | null, decorators: DecoratorNode[] | null,
flags: CommonFlags, flags: CommonFlags,
@@ -1082,7 +1082,7 @@ export abstract class Node {
// types // types
export abstract class CommonTypeNode extends Node { export abstract class TypeNode extends Node {
// kind varies // kind varies
/** Whether nullable or not. */ /** Whether nullable or not. */
@@ -1099,14 +1099,26 @@ export class TypeName extends Node {
next: TypeName | null; next: TypeName | null;
} }
/** Represents a type annotation. */ /** Represents a named type. */
export class TypeNode extends CommonTypeNode { export class NamedTypeNode extends TypeNode {
kind = NodeKind.TYPE; kind = NodeKind.NAMEDTYPE;
/** Type name. */ /** Type name. */
name: TypeName; name: TypeName;
/** Type argument references. */ /** Type argument references. */
typeArguments: CommonTypeNode[] | null; typeArguments: TypeNode[] | null;
}
/** Represents a function type. */
export class FunctionTypeNode extends TypeNode {
kind = NodeKind.FUNCTIONTYPE;
/** Accepted parameters. */
parameters: ParameterNode[];
/** Return type. */
returnType: TypeNode;
/** Explicitly provided this type, if any. */
explicitThisType: NamedTypeNode | null; // can't be a function
} }
/** Represents a type parameter. */ /** Represents a type parameter. */
@@ -1116,9 +1128,9 @@ export class TypeParameterNode extends Node {
/** Identifier reference. */ /** Identifier reference. */
name: IdentifierExpression; name: IdentifierExpression;
/** Extended type reference, if any. */ /** Extended type reference, if any. */
extendsType: TypeNode | null; // can't be a function extendsType: NamedTypeNode | null; // can't be a function
/** Default type if omitted, if any. */ /** Default type if omitted, if any. */
defaultType: TypeNode | null; // can't be a function defaultType: NamedTypeNode | null; // can't be a function
} }
/** Represents the kind of a parameter. */ /** Represents the kind of a parameter. */
@@ -1140,7 +1152,7 @@ export class ParameterNode extends Node {
/** Parameter name. */ /** Parameter name. */
name: IdentifierExpression; name: IdentifierExpression;
/** Parameter type. */ /** Parameter type. */
type: CommonTypeNode; type: TypeNode;
/** Initializer expression, if present. */ /** Initializer expression, if present. */
initializer: Expression | null; initializer: Expression | null;
/** Implicit field declaration, if applicable. */ /** Implicit field declaration, if applicable. */
@@ -1156,18 +1168,6 @@ export class ParameterNode extends Node {
set(flag: CommonFlags): void { this.flags |= flag; } set(flag: CommonFlags): void { this.flags |= flag; }
} }
/** Represents a function signature. */
export class SignatureNode extends CommonTypeNode {
kind = NodeKind.SIGNATURE;
/** Accepted parameters. */
parameters: ParameterNode[];
/** Return type. */
returnType: CommonTypeNode;
/** Explicitly provided this type, if any. */
explicitThisType: TypeNode | null; // can't be a function
}
// special // special
/** Built-in decorator kinds. */ /** Built-in decorator kinds. */
@@ -1347,7 +1347,7 @@ export class AssertionExpression extends Expression {
/** Expression being asserted. */ /** Expression being asserted. */
expression: Expression; expression: Expression;
/** Target type. */ /** Target type. */
toType: CommonTypeNode | null; toType: TypeNode | null;
} }
/** Represents a binary expression. */ /** Represents a binary expression. */
@@ -1369,7 +1369,7 @@ export class CallExpression extends Expression {
/** Called expression. Usually an identifier or property access expression. */ /** Called expression. Usually an identifier or property access expression. */
expression: Expression; expression: Expression;
/** Provided type arguments. */ /** Provided type arguments. */
typeArguments: CommonTypeNode[] | null; typeArguments: TypeNode[] | null;
/** Provided arguments. */ /** Provided arguments. */
arguments: Expression[]; arguments: Expression[];
@@ -1450,7 +1450,7 @@ export class InstanceOfExpression extends Expression {
/** Expression being asserted. */ /** Expression being asserted. */
expression: Expression; expression: Expression;
/** Type to test for. */ /** Type to test for. */
isType: CommonTypeNode; isType: TypeNode;
} }
/** Represents an integer literal expression. */ /** Represents an integer literal expression. */
@@ -1659,16 +1659,16 @@ export class IndexSignatureDeclaration extends DeclarationStatement {
kind = NodeKind.INDEXSIGNATUREDECLARATION; kind = NodeKind.INDEXSIGNATUREDECLARATION;
/** Key type. */ /** Key type. */
keyType: TypeNode; keyType: NamedTypeNode;
/** Value type. */ /** Value type. */
valueType: CommonTypeNode; valueType: TypeNode;
} }
/** Base class of all variable-like declaration statements. */ /** Base class of all variable-like declaration statements. */
export abstract class VariableLikeDeclarationStatement extends DeclarationStatement { export abstract class VariableLikeDeclarationStatement extends DeclarationStatement {
/** Variable type. */ /** Variable type. */
type: CommonTypeNode | null; type: TypeNode | null;
/** Variable initializer. */ /** Variable initializer. */
initializer: Expression | null; initializer: Expression | null;
} }
@@ -1696,9 +1696,9 @@ export class ClassDeclaration extends DeclarationStatement {
/** Accepted type parameters. */ /** Accepted type parameters. */
typeParameters: TypeParameterNode[] | null; typeParameters: TypeParameterNode[] | null;
/** Base class type being extended, if any. */ /** Base class type being extended, if any. */
extendsType: TypeNode | null; // can't be a function extendsType: NamedTypeNode | null; // can't be a function
/** Interface types being implemented, if any. */ /** Interface types being implemented, if any. */
implementsTypes: TypeNode[] | null; // can't be functions implementsTypes: NamedTypeNode[] | null; // can't be functions
/** Class member declarations. */ /** Class member declarations. */
members: DeclarationStatement[]; members: DeclarationStatement[];
@@ -1842,7 +1842,7 @@ export class FunctionDeclaration extends DeclarationStatement {
/** Type parameters, if any. */ /** Type parameters, if any. */
typeParameters: TypeParameterNode[] | null; typeParameters: TypeParameterNode[] | null;
/** Function signature. */ /** Function signature. */
signature: SignatureNode; signature: FunctionTypeNode;
/** Body statement. Usually a block. */ /** Body statement. Usually a block. */
body: Statement | null; body: Statement | null;
/** Arrow function kind, if applicable. */ /** Arrow function kind, if applicable. */
@@ -1979,7 +1979,7 @@ export class TypeDeclaration extends DeclarationStatement {
/** Type parameters, if any. */ /** Type parameters, if any. */
typeParameters: TypeParameterNode[] | null; typeParameters: TypeParameterNode[] | null;
/** Type being aliased. */ /** Type being aliased. */
type: CommonTypeNode; type: TypeNode;
} }
/** Represents a variable declaration part of a {@link VariableStatement}. */ /** Represents a variable declaration part of a {@link VariableStatement}. */
@@ -2033,9 +2033,9 @@ export function mangleInternalPath(path: string): string {
} }
/** Tests if the specified type node represents an omitted type. */ /** Tests if the specified type node represents an omitted type. */
export function isTypeOmitted(type: CommonTypeNode): bool { export function isTypeOmitted(type: TypeNode): bool {
if (type.kind == NodeKind.TYPE) { if (type.kind == NodeKind.NAMEDTYPE) {
let name = (<TypeNode>type).name; let name = (<NamedTypeNode>type).name;
return !(name.next || name.identifier.text.length); return !(name.next || name.identifier.text.length);
} }
return false; return false;

@@ -134,6 +134,7 @@ export namespace CommonSymbols {
export const boolean = "boolean"; export const boolean = "boolean";
export const string = "string"; export const string = "string";
export const native = "native"; export const native = "native";
export const indexof = "indexof";
export const valueof = "valueof"; export const valueof = "valueof";
// aliases // aliases
export const null_ = "null"; export const null_ = "null";

@@ -100,7 +100,7 @@ import {
import { import {
Node, Node,
NodeKind, NodeKind,
TypeNode, NamedTypeNode,
Range, Range,
DecoratorKind, DecoratorKind,
AssertionKind, AssertionKind,
@@ -1064,7 +1064,7 @@ export class Compiler extends DiagnosticEmitter {
/** Resolves the specified type arguments prior to compiling the resulting function instance. */ /** Resolves the specified type arguments prior to compiling the resulting function instance. */
compileFunctionUsingTypeArguments( compileFunctionUsingTypeArguments(
prototype: FunctionPrototype, prototype: FunctionPrototype,
typeArguments: TypeNode[], typeArguments: NamedTypeNode[],
contextualTypeArguments: Map<string,Type> = makeMap(), contextualTypeArguments: Map<string,Type> = makeMap(),
alternativeReportNode: Node | null = null alternativeReportNode: Node | null = null
): Function | null { ): Function | null {
@@ -1209,7 +1209,7 @@ export class Compiler extends DiagnosticEmitter {
} else if (returnType != Type.void && !flow.is(FlowFlags.TERMINATES)) { } else if (returnType != Type.void && !flow.is(FlowFlags.TERMINATES)) {
this.error( this.error(
DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value, DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value,
instance.prototype.signatureNode.returnType.range instance.prototype.functionTypeNode.returnType.range
); );
} }
@@ -1325,7 +1325,7 @@ export class Compiler extends DiagnosticEmitter {
compileClassUsingTypeArguments( compileClassUsingTypeArguments(
prototype: ClassPrototype, prototype: ClassPrototype,
typeArguments: TypeNode[], typeArguments: NamedTypeNode[],
contextualTypeArguments: Map<string,Type> = makeMap(), contextualTypeArguments: Map<string,Type> = makeMap(),
alternativeReportNode: Node | null = null alternativeReportNode: Node | null = null
): void { ): void {
@@ -1429,7 +1429,7 @@ export class Compiler extends DiagnosticEmitter {
compileInterfaceDeclaration( compileInterfaceDeclaration(
declaration: InterfaceDeclaration, declaration: InterfaceDeclaration,
typeArguments: TypeNode[], typeArguments: NamedTypeNode[],
contextualTypeArguments: Map<string,Type> | null = null, contextualTypeArguments: Map<string,Type> | null = null,
alternativeReportNode: Node | null = null alternativeReportNode: Node | null = null
): void { ): void {
@@ -5810,15 +5810,15 @@ export class Compiler extends DiagnosticEmitter {
inferredTypes.set(typeParameterNodes[i].name.text, null); inferredTypes.set(typeParameterNodes[i].name.text, null);
} }
// let numInferred = 0; // let numInferred = 0;
let parameterNodes = prototype.signatureNode.parameters; let parameterNodes = prototype.functionTypeNode.parameters;
let numParameters = parameterNodes.length; let numParameters = parameterNodes.length;
let argumentNodes = expression.arguments; let argumentNodes = expression.arguments;
let numArguments = argumentNodes.length; let numArguments = argumentNodes.length;
let argumentExprs = new Array<ExpressionRef>(numArguments); let argumentExprs = new Array<ExpressionRef>(numArguments);
for (let i = 0; i < numParameters; ++i) { for (let i = 0; i < numParameters; ++i) {
let typeNode = parameterNodes[i].type; let typeNode = parameterNodes[i].type;
let templateName = typeNode.kind == NodeKind.TYPE && !(<TypeNode>typeNode).name.next let templateName = typeNode.kind == NodeKind.NAMEDTYPE && !(<NamedTypeNode>typeNode).name.next
? (<TypeNode>typeNode).name.identifier.text ? (<NamedTypeNode>typeNode).name.identifier.text
: null; : null;
let argumentExpression = i < numArguments let argumentExpression = i < numArguments
? argumentNodes[i] ? argumentNodes[i]
@@ -6254,7 +6254,7 @@ export class Compiler extends DiagnosticEmitter {
for (let i = numArguments; i < numParameters; ++i) { for (let i = numArguments; i < numParameters; ++i) {
let initType = parameterTypes[i]; let initType = parameterTypes[i];
let initExpr = this.compileExpression( let initExpr = this.compileExpression(
assert(instance.prototype.signatureNode.parameters[i].initializer), assert(instance.prototype.functionTypeNode.parameters[i].initializer),
initType, initType,
Constraints.CONV_IMPLICIT Constraints.CONV_IMPLICIT
); );
@@ -6314,7 +6314,7 @@ export class Compiler extends DiagnosticEmitter {
var originalSignature = original.signature; var originalSignature = original.signature;
var originalName = original.internalName; var originalName = original.internalName;
var originalParameterTypes = originalSignature.parameterTypes; var originalParameterTypes = originalSignature.parameterTypes;
var originalParameterDeclarations = original.prototype.signatureNode.parameters; var originalParameterDeclarations = original.prototype.functionTypeNode.parameters;
var returnType = originalSignature.returnType; var returnType = originalSignature.returnType;
var thisType = originalSignature.thisType; var thisType = originalSignature.thisType;
var isInstance = original.is(CommonFlags.INSTANCE); var isInstance = original.is(CommonFlags.INSTANCE);
@@ -6705,7 +6705,7 @@ export class Compiler extends DiagnosticEmitter {
operands.length = 0; operands.length = 0;
} }
let parameterTypes = instance.signature.parameterTypes; let parameterTypes = instance.signature.parameterTypes;
let parameterNodes = instance.prototype.signatureNode.parameters; let parameterNodes = instance.prototype.functionTypeNode.parameters;
assert(parameterNodes.length == parameterTypes.length); assert(parameterNodes.length == parameterTypes.length);
let allOptionalsAreConstant = true; let allOptionalsAreConstant = true;
for (let i = numArguments; i < maxArguments; ++i) { for (let i = numArguments; i < maxArguments; ++i) {
@@ -6954,7 +6954,7 @@ export class Compiler extends DiagnosticEmitter {
// compile according to context. this differs from a normal function in that omitted parameter // compile according to context. this differs from a normal function in that omitted parameter
// and return types can be inferred and omitted arguments can be replaced with dummies. // and return types can be inferred and omitted arguments can be replaced with dummies.
if (contextualSignature) { if (contextualSignature) {
let signatureNode = prototype.signatureNode; let signatureNode = prototype.functionTypeNode;
let parameterNodes = signatureNode.parameters; let parameterNodes = signatureNode.parameters;
let numPresentParameters = parameterNodes.length; let numPresentParameters = parameterNodes.length;

@@ -12,11 +12,11 @@ import {
Source, Source,
ArrowKind, ArrowKind,
CommonTypeNode,
TypeNode, TypeNode,
NamedTypeNode,
FunctionTypeNode,
TypeName, TypeName,
TypeParameterNode, TypeParameterNode,
SignatureNode,
Expression, Expression,
IdentifierExpression, IdentifierExpression,
@@ -123,8 +123,12 @@ export class ASTBuilder {
// types // types
case NodeKind.TYPE: { case NodeKind.NAMEDTYPE: {
this.visitTypeNode(<TypeNode>node); this.visitNamedTypeNode(<NamedTypeNode>node);
break;
}
case NodeKind.FUNCTIONTYPE: {
this.visitFunctionTypeNode(<FunctionTypeNode>node);
break; break;
} }
case NodeKind.TYPEPARAMETER: { case NodeKind.TYPEPARAMETER: {
@@ -362,14 +366,34 @@ export class ASTBuilder {
// types // types
visitTypeNode(node: CommonTypeNode): void { visitTypeNode(node: TypeNode): void {
if (node.kind == NodeKind.SIGNATURE) { switch (node.kind) {
this.visitSignatureNode(<SignatureNode>node); case NodeKind.NAMEDTYPE: {
return; this.visitNamedTypeNode(<NamedTypeNode>node);
break;
}
case NodeKind.FUNCTIONTYPE: {
this.visitFunctionTypeNode(<FunctionTypeNode>node);
break;
}
default: assert(false);
} }
var typeNode = <TypeNode>node; }
this.visitTypeName((<TypeNode>node).name);
var typeArguments = typeNode.typeArguments; visitTypeName(node: TypeName): void {
this.visitIdentifierExpression(node.identifier);
var sb = this.sb;
var current = node.next;
while (current) {
sb.push(".");
this.visitIdentifierExpression(current.identifier);
current = current.next;
}
}
visitNamedTypeNode(node: NamedTypeNode): void {
this.visitTypeName(node.name);
var typeArguments = node.typeArguments;
if (typeArguments) { if (typeArguments) {
let numTypeArguments = typeArguments.length; let numTypeArguments = typeArguments.length;
let sb = this.sb; let sb = this.sb;
@@ -386,32 +410,7 @@ export class ASTBuilder {
} }
} }
visitTypeName(node: TypeName): void { visitFunctionTypeNode(node: FunctionTypeNode): void {
this.visitIdentifierExpression(node.identifier);
var sb = this.sb;
var current = node.next;
while (current) {
sb.push(".");
this.visitIdentifierExpression(current.identifier);
current = current.next;
}
}
visitTypeParameter(node: TypeParameterNode): void {
this.visitIdentifierExpression(node.name);
var extendsType = node.extendsType;
if (extendsType) {
this.sb.push(" extends ");
this.visitTypeNode(extendsType);
}
var defaultType = node.defaultType;
if (defaultType) {
this.sb.push("=");
this.visitTypeNode(defaultType);
}
}
visitSignatureNode(node: SignatureNode): void {
var isNullable = node.isNullable; var isNullable = node.isNullable;
var sb = this.sb; var sb = this.sb;
sb.push(isNullable ? "((" : "("); sb.push(isNullable ? "((" : "(");
@@ -440,6 +439,20 @@ export class ASTBuilder {
if (isNullable) sb.push(") | null"); if (isNullable) sb.push(") | null");
} }
visitTypeParameter(node: TypeParameterNode): void {
this.visitIdentifierExpression(node.name);
var extendsType = node.extendsType;
if (extendsType) {
this.sb.push(" extends ");
this.visitTypeNode(extendsType);
}
var defaultType = node.defaultType;
if (defaultType) {
this.sb.push("=");
this.visitTypeNode(defaultType);
}
}
// expressions // expressions
visitIdentifierExpression(node: IdentifierExpression): void { visitIdentifierExpression(node: IdentifierExpression): void {

@@ -36,9 +36,9 @@ import {
NodeKind, NodeKind,
Source, Source,
SourceKind, SourceKind,
CommonTypeNode,
TypeNode, TypeNode,
SignatureNode, NamedTypeNode,
FunctionTypeNode,
ArrowKind, ArrowKind,
Expression, Expression,
@@ -387,13 +387,13 @@ export class Parser extends DiagnosticEmitter {
tn: Tokenizer, tn: Tokenizer,
acceptParenthesized: bool = true, acceptParenthesized: bool = true,
suppressErrors: bool = false suppressErrors: bool = false
): CommonTypeNode | null { ): TypeNode | null {
// NOTE: this parses our limited subset // NOTE: this parses our limited subset
var token = tn.next(); var token = tn.next();
var startPos = tn.tokenPos; var startPos = tn.tokenPos;
var type: CommonTypeNode; var type: TypeNode;
// '(' ... // '(' ...
if (token == Token.OPENPAREN) { if (token == Token.OPENPAREN) {
@@ -401,7 +401,7 @@ export class Parser extends DiagnosticEmitter {
// '(' FunctionSignature ')' '|' 'null'? // '(' FunctionSignature ')' '|' 'null'?
let isNullableSignature = tn.skip(Token.OPENPAREN); let isNullableSignature = tn.skip(Token.OPENPAREN);
// FunctionSignature? // FunctionSignature?
let signature = this.tryParseSignature(tn); let signature = this.tryParseFunctionType(tn);
if (signature) { if (signature) {
if (isNullableSignature) { if (isNullableSignature) {
if (!tn.skip(Token.CLOSEPAREN)) { if (!tn.skip(Token.CLOSEPAREN)) {
@@ -461,26 +461,26 @@ export class Parser extends DiagnosticEmitter {
// 'void' // 'void'
} else if (token == Token.VOID) { } else if (token == Token.VOID) {
type = Node.createType( type = Node.createNamedType(
Node.createSimpleTypeName("void", tn.range()), [], false, tn.range(startPos, tn.pos) Node.createSimpleTypeName("void", tn.range()), [], false, tn.range(startPos, tn.pos)
); );
// 'this' // 'this'
} else if (token == Token.THIS) { } else if (token == Token.THIS) {
type = Node.createType( type = Node.createNamedType(
Node.createSimpleTypeName("this", tn.range()), [], false, tn.range(startPos, tn.pos) Node.createSimpleTypeName("this", tn.range()), [], false, tn.range(startPos, tn.pos)
); );
// 'true' // 'true'
} else if (token == Token.TRUE || token == Token.FALSE) { } else if (token == Token.TRUE || token == Token.FALSE) {
type = Node.createType( type = Node.createNamedType(
Node.createSimpleTypeName("bool", tn.range()), [], false, tn.range(startPos, tn.pos) Node.createSimpleTypeName("bool", tn.range()), [], false, tn.range(startPos, tn.pos)
); );
// StringLiteral // StringLiteral
} else if (token == Token.STRINGLITERAL) { } else if (token == Token.STRINGLITERAL) {
tn.readString(); tn.readString();
type = Node.createType( type = Node.createNamedType(
Node.createSimpleTypeName("string", tn.range()), [], false, tn.range(startPos, tn.pos) Node.createSimpleTypeName("string", tn.range()), [], false, tn.range(startPos, tn.pos)
); );
@@ -488,7 +488,7 @@ export class Parser extends DiagnosticEmitter {
} else if (token == Token.IDENTIFIER) { } else if (token == Token.IDENTIFIER) {
let first = Node.createSimpleTypeName(tn.readIdentifier(), tn.range()); let first = Node.createSimpleTypeName(tn.readIdentifier(), tn.range());
let current = first; let current = first;
let parameters: TypeNode[] | null = null; let parameters: NamedTypeNode[] | null = null;
let nullable = false; let nullable = false;
// Identifier ('.' Identifier)+ // Identifier ('.' Identifier)+
@@ -511,8 +511,8 @@ export class Parser extends DiagnosticEmitter {
do { do {
let parameter = this.parseType(tn, true, suppressErrors); let parameter = this.parseType(tn, true, suppressErrors);
if (!parameter) return null; if (!parameter) return null;
if (!parameters) parameters = [<TypeNode>parameter]; if (!parameters) parameters = [<NamedTypeNode>parameter];
else parameters.push(<TypeNode>parameter); else parameters.push(<NamedTypeNode>parameter);
} while (tn.skip(Token.COMMA)); } while (tn.skip(Token.COMMA));
if (!tn.skip(Token.GREATERTHAN)) { if (!tn.skip(Token.GREATERTHAN)) {
if (!suppressErrors) { if (!suppressErrors) {
@@ -538,7 +538,7 @@ export class Parser extends DiagnosticEmitter {
return null; return null;
} }
} }
type = Node.createType(first, parameters || [], nullable, tn.range(startPos, tn.pos)); type = Node.createNamedType(first, parameters || [], nullable, tn.range(startPos, tn.pos));
} else { } else {
if (!suppressErrors) { if (!suppressErrors) {
this.error( this.error(
@@ -577,7 +577,7 @@ export class Parser extends DiagnosticEmitter {
return null; return null;
} }
} }
type = Node.createType( type = Node.createNamedType(
Node.createSimpleTypeName("Array", bracketRange), Node.createSimpleTypeName("Array", bracketRange),
[ type ], [ type ],
nullable, nullable,
@@ -592,17 +592,17 @@ export class Parser extends DiagnosticEmitter {
// Indicates whether tryParseSignature determined that it is handling a Signature // Indicates whether tryParseSignature determined that it is handling a Signature
private tryParseSignatureIsSignature: bool = false; private tryParseSignatureIsSignature: bool = false;
/** Parses a function signature, as used in type declarations. */ /** Parses a function type, as used in type declarations. */
tryParseSignature( tryParseFunctionType(
tn: Tokenizer tn: Tokenizer
): SignatureNode | null { ): FunctionTypeNode | null {
// at '(': ('...'? Identifier '?'? ':' Type (',' '...'? Identifier '?'? ':' Type)* )? ')' '=>' Type // at '(': ('...'? Identifier '?'? ':' Type (',' '...'? Identifier '?'? ':' Type)* )? ')' '=>' Type
var state = tn.mark(); var state = tn.mark();
var startPos = tn.tokenPos; var startPos = tn.tokenPos;
var parameters: ParameterNode[] | null = null; var parameters: ParameterNode[] | null = null;
var thisType: TypeNode | null = null; var thisType: NamedTypeNode | null = null;
var isSignature: bool = false; var isSignature: bool = false;
if (tn.skip(Token.CLOSEPAREN)) { if (tn.skip(Token.CLOSEPAREN)) {
@@ -625,7 +625,7 @@ export class Parser extends DiagnosticEmitter {
tn.discard(state); tn.discard(state);
let t = this.parseType(tn, false); let t = this.parseType(tn, false);
if (!t) return null; if (!t) return null;
if (t.kind != NodeKind.TYPE) { if (t.kind != NodeKind.NAMEDTYPE) {
this.error( this.error(
DiagnosticCode.Operation_not_supported, DiagnosticCode.Operation_not_supported,
t.range t.range
@@ -633,7 +633,7 @@ export class Parser extends DiagnosticEmitter {
this.tryParseSignatureIsSignature = true; this.tryParseSignatureIsSignature = true;
return null; return null;
} }
thisType = <TypeNode>t; thisType = <NamedTypeNode>t;
} else { } else {
tn.reset(state); tn.reset(state);
this.tryParseSignatureIsSignature = false; this.tryParseSignatureIsSignature = false;
@@ -702,7 +702,7 @@ export class Parser extends DiagnosticEmitter {
} }
} }
var returnType: CommonTypeNode | null; var returnType: TypeNode | null;
if (tn.skip(Token.EQUALS_GREATERTHAN)) { if (tn.skip(Token.EQUALS_GREATERTHAN)) {
isSignature = true; isSignature = true;
tn.discard(state); tn.discard(state);
@@ -724,7 +724,7 @@ export class Parser extends DiagnosticEmitter {
return null; return null;
} }
this.tryParseSignatureIsSignature = true; this.tryParseSignatureIsSignature = true;
return Node.createSignature( return Node.createFunctionType(
parameters || [], parameters || [],
returnType, returnType,
thisType, thisType,
@@ -827,7 +827,7 @@ export class Parser extends DiagnosticEmitter {
flags |= CommonFlags.DEFINITE_ASSIGNMENT; flags |= CommonFlags.DEFINITE_ASSIGNMENT;
} }
var type: CommonTypeNode | null = null; var type: TypeNode | null = null;
if (tn.skip(Token.COLON)) { if (tn.skip(Token.COLON)) {
type = this.parseType(tn); type = this.parseType(tn);
} }
@@ -1027,31 +1027,31 @@ export class Parser extends DiagnosticEmitter {
tn.readIdentifier(), tn.readIdentifier(),
tn.range() tn.range()
); );
let extendsType: TypeNode | null = null; let extendsType: NamedTypeNode | null = null;
if (tn.skip(Token.EXTENDS)) { if (tn.skip(Token.EXTENDS)) {
let t = this.parseType(tn); let t = this.parseType(tn);
if (!t) return null; if (!t) return null;
if (t.kind != NodeKind.TYPE) { if (t.kind != NodeKind.NAMEDTYPE) {
this.error( this.error(
DiagnosticCode.Operation_not_supported, DiagnosticCode.Operation_not_supported,
t.range t.range
); );
return null; return null;
} }
extendsType = <TypeNode>t; extendsType = <NamedTypeNode>t;
} }
let defaultType: TypeNode | null = null; let defaultType: NamedTypeNode | null = null;
if (tn.skip(Token.EQUALS)) { if (tn.skip(Token.EQUALS)) {
let t = this.parseType(tn); let t = this.parseType(tn);
if (!t) return null; if (!t) return null;
if (t.kind != NodeKind.TYPE) { if (t.kind != NodeKind.NAMEDTYPE) {
this.error( this.error(
DiagnosticCode.Operation_not_supported, DiagnosticCode.Operation_not_supported,
t.range t.range
); );
return null; return null;
} }
defaultType = <TypeNode>t; defaultType = <NamedTypeNode>t;
} }
return Node.createTypeParameter( return Node.createTypeParameter(
identifier, identifier,
@@ -1068,7 +1068,7 @@ export class Parser extends DiagnosticEmitter {
return null; return null;
} }
private parseParametersThis: TypeNode | null = null; private parseParametersThis: NamedTypeNode | null = null;
parseParameters( parseParameters(
tn: Tokenizer, tn: Tokenizer,
@@ -1081,7 +1081,7 @@ export class Parser extends DiagnosticEmitter {
var seenRest: ParameterNode | null = null; var seenRest: ParameterNode | null = null;
var seenOptional = false; var seenOptional = false;
var reportedRest = false; var reportedRest = false;
var thisType: CommonTypeNode | null = null; var thisType: TypeNode | null = null;
// check if there is a leading `this` parameter // check if there is a leading `this` parameter
this.parseParametersThis = null; this.parseParametersThis = null;
@@ -1089,8 +1089,8 @@ export class Parser extends DiagnosticEmitter {
if (tn.skip(Token.COLON)) { if (tn.skip(Token.COLON)) {
thisType = this.parseType(tn); // reports thisType = this.parseType(tn); // reports
if (!thisType) return null; if (!thisType) return null;
if (thisType.kind == NodeKind.TYPE) { if (thisType.kind == NodeKind.NAMEDTYPE) {
this.parseParametersThis = <TypeNode>thisType; this.parseParametersThis = <NamedTypeNode>thisType;
} else { } else {
this.error( this.error(
DiagnosticCode.Operation_not_supported, DiagnosticCode.Operation_not_supported,
@@ -1210,7 +1210,7 @@ export class Parser extends DiagnosticEmitter {
if (tn.skipIdentifier()) { if (tn.skipIdentifier()) {
if (!isRest) startRange = tn.range(); if (!isRest) startRange = tn.range();
let identifier = Node.createIdentifierExpression(tn.readIdentifier(), tn.range()); let identifier = Node.createIdentifierExpression(tn.readIdentifier(), tn.range());
let type: CommonTypeNode | null = null; let type: TypeNode | null = null;
if (isOptional = tn.skip(Token.QUESTION)) { if (isOptional = tn.skip(Token.QUESTION)) {
if (isRest) { if (isRest) {
this.error( this.error(
@@ -1340,7 +1340,7 @@ export class Parser extends DiagnosticEmitter {
} }
} }
var returnType: CommonTypeNode | null = null; var returnType: TypeNode | null = null;
if (tn.skip(Token.COLON)) { if (tn.skip(Token.COLON)) {
returnType = this.parseType(tn, true, isSetter); returnType = this.parseType(tn, true, isSetter);
if (!returnType) return null; if (!returnType) return null;
@@ -1358,7 +1358,7 @@ export class Parser extends DiagnosticEmitter {
} }
} }
var signature = Node.createSignature( var signature = Node.createFunctionType(
parameters, parameters,
returnType, returnType,
thisType, thisType,
@@ -1452,7 +1452,7 @@ export class Parser extends DiagnosticEmitter {
if (startPos < 0) startPos = name.range.start; if (startPos < 0) startPos = name.range.start;
if (signatureStart < 0) signatureStart = startPos; if (signatureStart < 0) signatureStart = startPos;
var returnType: CommonTypeNode | null = null; var returnType: TypeNode | null = null;
if (arrowKind != ArrowKind.ARROW_SINGLE && tn.skip(Token.COLON)) { if (arrowKind != ArrowKind.ARROW_SINGLE && tn.skip(Token.COLON)) {
returnType = this.parseType(tn); returnType = this.parseType(tn);
if (!returnType) return null; if (!returnType) return null;
@@ -1470,7 +1470,7 @@ export class Parser extends DiagnosticEmitter {
} }
} }
var signature = Node.createSignature( var signature = Node.createFunctionType(
parameters, parameters,
returnType, returnType,
null, // TODO? null, // TODO?
@@ -1547,21 +1547,21 @@ export class Parser extends DiagnosticEmitter {
flags |= CommonFlags.GENERIC; flags |= CommonFlags.GENERIC;
} }
var extendsType: TypeNode | null = null; var extendsType: NamedTypeNode | null = null;
if (tn.skip(Token.EXTENDS)) { if (tn.skip(Token.EXTENDS)) {
let t = this.parseType(tn); let t = this.parseType(tn);
if (!t) return null; if (!t) return null;
if (t.kind != NodeKind.TYPE) { if (t.kind != NodeKind.NAMEDTYPE) {
this.error( this.error(
DiagnosticCode.Operation_not_supported, DiagnosticCode.Operation_not_supported,
t.range t.range
); );
return null; return null;
} }
extendsType = <TypeNode>t; extendsType = <NamedTypeNode>t;
} }
var implementsTypes: TypeNode[] | null = null; var implementsTypes: NamedTypeNode[] | null = null;
if (tn.skip(Token.IMPLEMENTS)) { if (tn.skip(Token.IMPLEMENTS)) {
if (isInterface) { if (isInterface) {
this.error( this.error(
@@ -1573,8 +1573,8 @@ export class Parser extends DiagnosticEmitter {
let type = this.parseType(tn); let type = this.parseType(tn);
if (!type) return null; if (!type) return null;
if (!isInterface) { if (!isInterface) {
if (!implementsTypes) implementsTypes = [<TypeNode>type]; if (!implementsTypes) implementsTypes = [<NamedTypeNode>type];
else implementsTypes.push(<TypeNode>type); else implementsTypes.push(<NamedTypeNode>type);
} }
} while (tn.skip(Token.COMMA)); } while (tn.skip(Token.COMMA));
} }
@@ -1988,7 +1988,7 @@ export class Parser extends DiagnosticEmitter {
} }
} }
let returnType: CommonTypeNode | null = null; let returnType: TypeNode | null = null;
if (tn.skip(Token.COLON)) { if (tn.skip(Token.COLON)) {
if (name.kind == NodeKind.CONSTRUCTOR) { if (name.kind == NodeKind.CONSTRUCTOR) {
this.error( this.error(
@@ -2013,7 +2013,7 @@ export class Parser extends DiagnosticEmitter {
} }
} }
let signature = Node.createSignature( let signature = Node.createFunctionType(
parameters, parameters,
returnType, returnType,
thisType, thisType,
@@ -2090,7 +2090,7 @@ export class Parser extends DiagnosticEmitter {
); // recoverable ); // recoverable
} }
let type: CommonTypeNode | null = null; let type: TypeNode | null = null;
if (tn.skip(Token.QUESTION)) { if (tn.skip(Token.QUESTION)) {
this.error( this.error(
DiagnosticCode.Optional_properties_are_not_supported, DiagnosticCode.Optional_properties_are_not_supported,
@@ -2153,7 +2153,7 @@ export class Parser extends DiagnosticEmitter {
if (tn.skip(Token.COLON)) { if (tn.skip(Token.COLON)) {
let keyType = this.parseType(tn); let keyType = this.parseType(tn);
if (!keyType) return null; if (!keyType) return null;
if (keyType.kind != NodeKind.TYPE) { if (keyType.kind != NodeKind.NAMEDTYPE) {
this.error( this.error(
DiagnosticCode.Type_expected, DiagnosticCode.Type_expected,
tn.range() tn.range()
@@ -2164,7 +2164,7 @@ export class Parser extends DiagnosticEmitter {
if (tn.skip(Token.COLON)) { if (tn.skip(Token.COLON)) {
let valueType = this.parseType(tn); let valueType = this.parseType(tn);
if (!valueType) return null; if (!valueType) return null;
return Node.createIndexSignatureDeclaration(<TypeNode>keyType, valueType, tn.range(start, tn.pos)); return Node.createIndexSignatureDeclaration(<NamedTypeNode>keyType, valueType, tn.range(start, tn.pos));
} else { } else {
this.error( this.error(
DiagnosticCode._0_expected, DiagnosticCode._0_expected,
@@ -3528,13 +3528,13 @@ export class Parser extends DiagnosticEmitter {
tryParseTypeArgumentsBeforeArguments( tryParseTypeArgumentsBeforeArguments(
tn: Tokenizer tn: Tokenizer
): CommonTypeNode[] | null { ): TypeNode[] | null {
// at '<': Type (',' Type)* '>' '(' // at '<': Type (',' Type)* '>' '('
var state = tn.mark(); var state = tn.mark();
if (!tn.skip(Token.LESSTHAN)) return null; if (!tn.skip(Token.LESSTHAN)) return null;
var typeArguments: CommonTypeNode[] | null = null; var typeArguments: TypeNode[] | null = null;
do { do {
if (tn.peek() === Token.GREATERTHAN) { if (tn.peek() === Token.GREATERTHAN) {
break; break;
@@ -3792,7 +3792,7 @@ export class Parser extends DiagnosticEmitter {
expr: Expression expr: Expression
): Expression { ): Expression {
if (nodeIsCallable(expr.kind)) { if (nodeIsCallable(expr.kind)) {
let typeArguments: CommonTypeNode[] | null = null; let typeArguments: TypeNode[] | null = null;
while ( while (
tn.skip(Token.OPENPAREN) tn.skip(Token.OPENPAREN)
|| ||

@@ -43,10 +43,10 @@ import {
Range, Range,
DecoratorNode, DecoratorNode,
DecoratorKind, DecoratorKind,
SignatureNode,
TypeParameterNode, TypeParameterNode,
CommonTypeNode,
TypeNode, TypeNode,
NamedTypeNode,
FunctionTypeNode,
ArrowKind, ArrowKind,
Expression, Expression,
@@ -470,7 +470,7 @@ export class Program extends DiagnosticEmitter {
} }
// a dummy signature for programmatically generated native functions // a dummy signature for programmatically generated native functions
private nativeDummySignature: SignatureNode | null = null; private nativeDummySignature: FunctionTypeNode | null = null;
/** Creates a native function declaration. */ /** Creates a native function declaration. */
makeNativeFunctionDeclaration( makeNativeFunctionDeclaration(
@@ -483,8 +483,8 @@ export class Program extends DiagnosticEmitter {
return Node.createFunctionDeclaration( return Node.createFunctionDeclaration(
Node.createIdentifierExpression(name, range), Node.createIdentifierExpression(name, range),
null, null,
this.nativeDummySignature || (this.nativeDummySignature = Node.createSignature([], this.nativeDummySignature || (this.nativeDummySignature = Node.createFunctionType([],
Node.createType( // ^ AST signature doesn't really matter, is overridden anyway Node.createNamedType( // ^ AST signature doesn't really matter, is overridden anyway
Node.createSimpleTypeName(CommonSymbols.void_, range), Node.createSimpleTypeName(CommonSymbols.void_, range),
null, false, range null, false, range
), ),
@@ -567,6 +567,12 @@ export class Program extends DiagnosticEmitter {
this.makeNativeTypeDeclaration(CommonSymbols.native, CommonFlags.EXPORT | CommonFlags.GENERIC), this.makeNativeTypeDeclaration(CommonSymbols.native, CommonFlags.EXPORT | CommonFlags.GENERIC),
DecoratorFlags.BUILTIN DecoratorFlags.BUILTIN
)); ));
this.nativeFile.add(CommonSymbols.indexof, new TypeDefinition(
CommonSymbols.indexof,
this.nativeFile,
this.makeNativeTypeDeclaration(CommonSymbols.indexof, CommonFlags.EXPORT | CommonFlags.GENERIC),
DecoratorFlags.BUILTIN
));
this.nativeFile.add(CommonSymbols.valueof, new TypeDefinition( this.nativeFile.add(CommonSymbols.valueof, new TypeDefinition(
CommonSymbols.valueof, CommonSymbols.valueof,
this.nativeFile, this.nativeFile,
@@ -2248,7 +2254,7 @@ export class TypeDefinition extends TypedElement {
} }
/** Gets the associated type node. */ /** Gets the associated type node. */
get typeNode(): CommonTypeNode { get typeNode(): TypeNode {
return (<TypeDeclaration>this.declaration).type; return (<TypeDeclaration>this.declaration).type;
} }
@@ -2366,7 +2372,7 @@ export abstract class VariableLikeElement extends TypedElement {
} }
/** Gets the associated type node.s */ /** Gets the associated type node.s */
get typeNode(): CommonTypeNode | null { get typeNode(): TypeNode | null {
return (<VariableLikeDeclarationStatement>this.declaration).type; return (<VariableLikeDeclarationStatement>this.declaration).type;
} }
@@ -2540,8 +2546,8 @@ export class FunctionPrototype extends DeclaredElement {
return (<FunctionDeclaration>this.declaration).typeParameters; return (<FunctionDeclaration>this.declaration).typeParameters;
} }
/** Gets the associated signature node. */ /** Gets the associated function type node. */
get signatureNode(): SignatureNode { get functionTypeNode(): FunctionTypeNode {
return (<FunctionDeclaration>this.declaration).signature; return (<FunctionDeclaration>this.declaration).signature;
} }
@@ -2818,7 +2824,7 @@ export class FieldPrototype extends DeclaredElement {
} }
/** Gets the associated type node. */ /** Gets the associated type node. */
get typeNode(): CommonTypeNode | null { get typeNode(): TypeNode | null {
return (<FieldDeclaration>this.declaration).type; return (<FieldDeclaration>this.declaration).type;
} }
@@ -2982,11 +2988,11 @@ export class ClassPrototype extends DeclaredElement {
return (<ClassDeclaration>this.declaration).typeParameters; return (<ClassDeclaration>this.declaration).typeParameters;
} }
/** Gets the associated extends node. */ /** Gets the associated extends node. */
get extendsNode(): TypeNode | null { get extendsNode(): NamedTypeNode | null {
return (<ClassDeclaration>this.declaration).extendsType; return (<ClassDeclaration>this.declaration).extendsType;
} }
/** Gets the associated implements nodes. */ /** Gets the associated implements nodes. */
get implementsNodes(): TypeNode[] | null { get implementsNodes(): NamedTypeNode[] | null {
return (<ClassDeclaration>this.declaration).implementsTypes; return (<ClassDeclaration>this.declaration).implementsTypes;
} }

@@ -32,11 +32,11 @@ import {
} from "./flow"; } from "./flow";
import { import {
SignatureNode, FunctionTypeNode,
ParameterKind, ParameterKind,
CommonTypeNode,
NodeKind,
TypeNode, TypeNode,
NodeKind,
NamedTypeNode,
TypeName, TypeName,
TypeParameterNode, TypeParameterNode,
Node, Node,
@@ -117,7 +117,7 @@ export class Resolver extends DiagnosticEmitter {
/** Resolves a {@link CommonTypeNode} to a concrete {@link Type}. */ /** Resolves a {@link CommonTypeNode} to a concrete {@link Type}. */
resolveType( resolveType(
/** The type to resolve. */ /** The type to resolve. */
node: CommonTypeNode, node: TypeNode,
/** Relative context. */ /** Relative context. */
context: Element, context: Element,
/** Type arguments inherited through context, i.e. `T`. */ /** Type arguments inherited through context, i.e. `T`. */
@@ -127,8 +127,8 @@ export class Resolver extends DiagnosticEmitter {
): Type | null { ): Type | null {
// handle signature // handle signature
if (node.kind == NodeKind.SIGNATURE) { if (node.kind == NodeKind.FUNCTIONTYPE) {
let explicitThisType = (<SignatureNode>node).explicitThisType; let explicitThisType = (<FunctionTypeNode>node).explicitThisType;
let thisType: Type | null = null; let thisType: Type | null = null;
if (explicitThisType) { if (explicitThisType) {
thisType = this.resolveType( thisType = this.resolveType(
@@ -139,7 +139,7 @@ export class Resolver extends DiagnosticEmitter {
); );
if (!thisType) return null; if (!thisType) return null;
} }
let parameterNodes = (<SignatureNode>node).parameters; let parameterNodes = (<FunctionTypeNode>node).parameters;
let numParameters = parameterNodes.length; let numParameters = parameterNodes.length;
let parameterTypes = new Array<Type>(numParameters); let parameterTypes = new Array<Type>(numParameters);
let parameterNames = new Array<string>(numParameters); let parameterNames = new Array<string>(numParameters);
@@ -178,7 +178,7 @@ export class Resolver extends DiagnosticEmitter {
parameterTypes[i] = parameterType; parameterTypes[i] = parameterType;
parameterNames[i] = parameterNode.name.text; parameterNames[i] = parameterNode.name.text;
} }
let returnTypeNode = (<SignatureNode>node).returnType; let returnTypeNode = (<FunctionTypeNode>node).returnType;
if (isTypeOmitted(returnTypeNode)) { if (isTypeOmitted(returnTypeNode)) {
if (reportMode == ReportMode.REPORT) { if (reportMode == ReportMode.REPORT) {
this.error( this.error(
@@ -208,8 +208,8 @@ export class Resolver extends DiagnosticEmitter {
} }
// now dealing with TypeNode // now dealing with TypeNode
assert(node.kind == NodeKind.TYPE); assert(node.kind == NodeKind.NAMEDTYPE);
var typeNode = <TypeNode>node; var typeNode = <NamedTypeNode>node;
var typeName = typeNode.name; var typeName = typeNode.name;
var typeArgumentNodes = typeNode.typeArguments; var typeArgumentNodes = typeNode.typeArguments;
var isSimpleType = !typeName.next; var isSimpleType = !typeName.next;
@@ -318,7 +318,8 @@ export class Resolver extends DiagnosticEmitter {
if (isSimpleType) { if (isSimpleType) {
switch (typeName.identifier.symbol) { switch (typeName.identifier.symbol) {
case CommonSymbols.native: return this.resolveBuiltinNativeType(typeNode, context, contextualTypeArguments, reportMode); case CommonSymbols.native: return this.resolveBuiltinNativeType(typeNode, context, contextualTypeArguments, reportMode);
case CommonSymbols.valueof: return this.resolveBuiltinValueofType(typeNode, context, contextualTypeArguments, reportMode) case CommonSymbols.indexof: return this.resolveBuiltinIndexofType(typeNode, context, contextualTypeArguments, reportMode);
case CommonSymbols.valueof: return this.resolveBuiltinValueofType(typeNode, context, contextualTypeArguments, reportMode);
} }
} }
@@ -374,7 +375,7 @@ export class Resolver extends DiagnosticEmitter {
private resolveBuiltinNativeType( private resolveBuiltinNativeType(
/** The type to resolve. */ /** The type to resolve. */
typeNode: TypeNode, typeNode: NamedTypeNode,
/** Relative context. */ /** Relative context. */
context: Element, context: Element,
/** Type arguments inherited through context, i.e. `T`. */ /** Type arguments inherited through context, i.e. `T`. */
@@ -415,9 +416,9 @@ export class Resolver extends DiagnosticEmitter {
return null; return null;
} }
private resolveBuiltinValueofType( private resolveBuiltinIndexofType(
/** The type to resolve. */ /** The type to resolve. */
typeNode: TypeNode, typeNode: NamedTypeNode,
/** Relative context. */ /** Relative context. */
context: Element, context: Element,
/** Type arguments inherited through context, i.e. `T`. */ /** Type arguments inherited through context, i.e. `T`. */
@@ -447,25 +448,49 @@ export class Resolver extends DiagnosticEmitter {
} }
return null; return null;
} }
var program = this.program; var overload = classReference.lookupOverload(OperatorKind.INDEXED_GET);
var mapPrototype = program.mapPrototype; if (overload) {
var setPrototype = program.setPrototype; if (overload.is(CommonFlags.STATIC)) {
var arrayPrototype = program.arrayPrototype; assert(overload.signature.parameterTypes.length == 2);
if (classReference.extends(arrayPrototype)) { return overload.signature.parameterTypes[1];
let actualTypeArguments = assert(classReference.getTypeArgumentsTo(arrayPrototype)); } else {
assert(actualTypeArguments.length == 1); assert(overload.signature.parameterTypes.length == 1);
return actualTypeArguments[0]; return overload.signature.parameterTypes[0];
} else if (classReference.extends(mapPrototype)) { }
let actualTypeArguments = assert(classReference.getTypeArgumentsTo(arrayPrototype)); }
assert(actualTypeArguments.length == 2); if (reportMode == ReportMode.REPORT) {
return actualTypeArguments[1]; this.error(
} else if (classReference.extends(setPrototype)) { DiagnosticCode.Index_signature_is_missing_in_type_0,
let actualTypeArguments = assert(classReference.getTypeArgumentsTo(arrayPrototype)); typeArgumentNodes[0].range, typeArgument.toString()
assert(actualTypeArguments.length == 1); );
return actualTypeArguments[0]; }
} else { return null;
let overload = classReference.lookupOverload(OperatorKind.INDEXED_GET); }
if (overload) return overload.signature.returnType;
private resolveBuiltinValueofType(
/** The type to resolve. */
typeNode: NamedTypeNode,
/** Relative context. */
context: Element,
/** Type arguments inherited through context, i.e. `T`. */
contextualTypeArguments: Map<string,Type> | null = null,
/** How to proceed with eventualy diagnostics. */
reportMode: ReportMode = ReportMode.REPORT
): Type | null {
var typeArgumentNodes = typeNode.typeArguments;
if (!(typeArgumentNodes && typeArgumentNodes.length == 1)) {
if (reportMode == ReportMode.REPORT) {
this.error(
DiagnosticCode.Expected_0_type_arguments_but_got_1,
typeNode.range, "1", (typeArgumentNodes ? typeArgumentNodes.length : 1).toString(10)
);
}
return null;
}
var typeArgument = this.resolveType(typeArgumentNodes[0], context, contextualTypeArguments, reportMode);
if (!typeArgument) return null;
var classReference = typeArgument.classReference;
if (!classReference) {
if (reportMode == ReportMode.REPORT) { if (reportMode == ReportMode.REPORT) {
this.error( this.error(
DiagnosticCode.Index_signature_is_missing_in_type_0, DiagnosticCode.Index_signature_is_missing_in_type_0,
@@ -474,6 +499,16 @@ export class Resolver extends DiagnosticEmitter {
} }
return null; return null;
} }
var overload = classReference.lookupOverload(OperatorKind.INDEXED_GET);
if (overload) return overload.signature.returnType;
if (reportMode == ReportMode.REPORT) {
this.error(
DiagnosticCode.Index_signature_is_missing_in_type_0,
typeArgumentNodes[0].range, typeArgument.toString()
);
}
return null;
} }
/** Resolves a type name to the program element it refers to. */ /** Resolves a type name to the program element it refers to. */
@@ -518,7 +553,7 @@ export class Resolver extends DiagnosticEmitter {
/** Actual type parameter nodes. */ /** Actual type parameter nodes. */
typeParameters: TypeParameterNode[], typeParameters: TypeParameterNode[],
/** Type arguments provided. */ /** Type arguments provided. */
typeArgumentNodes: CommonTypeNode[] | null, typeArgumentNodes: TypeNode[] | null,
/** Relative context. */ /** Relative context. */
context: Element, context: Element,
/** Type arguments inherited through context, i.e. `T`. */ /** Type arguments inherited through context, i.e. `T`. */
@@ -540,8 +575,8 @@ export class Resolver extends DiagnosticEmitter {
DiagnosticCode.Expected_0_type_arguments_but_got_1, DiagnosticCode.Expected_0_type_arguments_but_got_1,
argumentCount argumentCount
? Range.join( ? Range.join(
(<TypeNode[]>typeArgumentNodes)[0].range, (<NamedTypeNode[]>typeArgumentNodes)[0].range,
(<TypeNode[]>typeArgumentNodes)[argumentCount - 1].range (<NamedTypeNode[]>typeArgumentNodes)[argumentCount - 1].range
) )
: assert(alternativeReportNode).range, : assert(alternativeReportNode).range,
(argumentCount < minParameterCount ? minParameterCount : maxParameterCount).toString(10), (argumentCount < minParameterCount ? minParameterCount : maxParameterCount).toString(10),
@@ -553,7 +588,7 @@ export class Resolver extends DiagnosticEmitter {
for (let i = 0; i < maxParameterCount; ++i) { for (let i = 0; i < maxParameterCount; ++i) {
let type = i < argumentCount let type = i < argumentCount
? this.resolveType( // reports ? this.resolveType( // reports
(<TypeNode[]>typeArgumentNodes)[i], (<NamedTypeNode[]>typeArgumentNodes)[i],
context, context,
contextualTypeArguments, contextualTypeArguments,
reportMode reportMode
@@ -1398,7 +1433,7 @@ export class Resolver extends DiagnosticEmitter {
} }
// override whatever is contextual with actual function type arguments // override whatever is contextual with actual function type arguments
var signatureNode = prototype.signatureNode; var signatureNode = prototype.functionTypeNode;
var typeParameterNodes = prototype.typeParameterNodes; var typeParameterNodes = prototype.typeParameterNodes;
var numFunctionTypeArguments: i32; var numFunctionTypeArguments: i32;
if (typeArguments && (numFunctionTypeArguments = typeArguments.length)) { if (typeArguments && (numFunctionTypeArguments = typeArguments.length)) {
@@ -1506,7 +1541,7 @@ export class Resolver extends DiagnosticEmitter {
/** The prototype of the function. */ /** The prototype of the function. */
prototype: FunctionPrototype, prototype: FunctionPrototype,
/** Type arguments provided. */ /** Type arguments provided. */
typeArgumentNodes: CommonTypeNode[] | null, typeArgumentNodes: TypeNode[] | null,
/** Relative context. Type arguments are resolved from here. */ /** Relative context. Type arguments are resolved from here. */
context: Element, context: Element,
/** Type arguments inherited through context, i.e. `T`. */ /** Type arguments inherited through context, i.e. `T`. */
@@ -1795,7 +1830,7 @@ export class Resolver extends DiagnosticEmitter {
/** The prototype of the class. */ /** The prototype of the class. */
prototype: ClassPrototype, prototype: ClassPrototype,
/** Type argument nodes provided. */ /** Type argument nodes provided. */
typeArgumentNodes: CommonTypeNode[] | null, typeArgumentNodes: TypeNode[] | null,
/** Relative context. Type arguments are resolved from here. */ /** Relative context. Type arguments are resolved from here. */
context: Element, context: Element,
/** Type arguments inherited through context, i.e. `T`. */ /** Type arguments inherited through context, i.e. `T`. */

@@ -882,7 +882,9 @@ declare namespace v8x16 {
} }
/** Macro type evaluating to the underlying native WebAssembly type. */ /** Macro type evaluating to the underlying native WebAssembly type. */
declare type native<T> = T; declare type native<T> = T;
/** Special type evaluating the value type of a collection. */ /** Special type evaluating the indexed access index type. */
declare type indexof<T extends unknown[]> = keyof T;
/** Special type evaluating the indexed access value type. */
declare type valueof<T extends unknown[]> = T[0]; declare type valueof<T extends unknown[]> = T[0];
/** Pseudo-class representing the backing class of integer types. */ /** Pseudo-class representing the backing class of integer types. */

@@ -1,6 +1,7 @@
/// <reference path="./rt/index.d.ts" /> /// <reference path="./rt/index.d.ts" />
import { HASH } from "./util/hash"; import { HASH } from "./util/hash";
import { E_KEYNOTFOUND } from "util/error";
// A deterministic hash map based on CloseTable from https://github.com/jorendorff/dht // A deterministic hash map based on CloseTable from https://github.com/jorendorff/dht
@@ -96,11 +97,14 @@ export class Map<K,V> {
return this.find(key, HASH<K>(key)) !== null; return this.find(key, HASH<K>(key)) !== null;
} }
@operator("[]")
get(key: K): V { get(key: K): V {
var entry = this.find(key, HASH<K>(key)); var entry = this.find(key, HASH<K>(key));
return entry ? entry.value : <V>unreachable(); if (!entry) throw new Error(E_KEYNOTFOUND); // cannot represent `undefined`
return entry.value;
} }
@operator("[]=")
set(key: K, value: V): void { set(key: K, value: V): void {
var hashCode = HASH<K>(key); var hashCode = HASH<K>(key);
var entry = this.find(key, hashCode); // unmanaged! var entry = this.find(key, hashCode); // unmanaged!

@@ -88,6 +88,7 @@ export class Set<T> {
return null; return null;
} }
@operator("[]")
has(key: T): bool { has(key: T): bool {
return this.find(key, HASH<T>(key)) !== null; return this.find(key, HASH<T>(key)) !== null;
} }
@@ -117,6 +118,12 @@ export class Set<T> {
} }
} }
@operator("[]=")
private __set(key: T, value: bool): void {
if (value) this.add(key);
else this.delete(key);
}
delete(key: T): bool { delete(key: T): bool {
var entry = this.find(key, HASH<T>(key)); // unmanaged! var entry = this.find(key, HASH<T>(key)); // unmanaged!
if (!entry) return false; if (!entry) return false;

@@ -20,3 +20,7 @@ export const E_HOLEYARRAY: string = "Element type must be nullable if array is h
// @ts-ignore: decorator // @ts-ignore: decorator
@lazy @inline @lazy @inline
export const E_NOTIMPLEMENTED: string = "Not implemented"; export const E_NOTIMPLEMENTED: string = "Not implemented";
// @ts-ignore: decorator
@lazy @inline
export const E_KEYNOTFOUND: string = "Key does not exist";

@@ -28,7 +28,9 @@ declare type usize = number;
declare type f32 = number; declare type f32 = number;
declare type f64 = number; declare type f64 = number;
/** Special type evaluating the value type of a collection. */ /** Special type evaluating the indexed access index type. */
declare type indexof<T extends unknown[]> = keyof T;
/** Special type evaluating the indexed access value type. */
declare type valueof<T extends unknown[]> = T[0]; declare type valueof<T extends unknown[]> = T[0];
// Compiler hints // Compiler hints

@@ -0,0 +1,9 @@
(module
(type $FUNCSIG$v (func))
(memory $0 1)
(data (i32.const 8) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00i\00n\00d\00e\00x\00o\00f\00-\00v\00a\00l\00u\00e\00o\00f\00.\00t\00s")
(export "memory" (memory $0))
(func $start (; 0 ;) (type $FUNCSIG$v)
nop
)
)

@@ -0,0 +1,61 @@
// simple indexes
assert(isInteger<indexof<i8[]>>());
assert(isSigned<indexof<i8[]>>());
assert(sizeof<indexof<i8[]>>() == 4); // i32
// simple values
assert(isInteger<valueof<i8[]>>());
assert(isSigned<valueof<i8[]>>());
assert(sizeof<valueof<i8[]>>() == 1);
// using an alias
type u32Array = u32[];
assert(isInteger<valueof<u32Array>>());
assert(!isSigned<valueof<u32Array>>());
assert(sizeof<valueof<u32Array>>() == 4);
// float values
assert(isFloat<valueof<f32[]>>());
assert(sizeof<valueof<f32[]>>() == 4);
// string values
assert(isString<valueof<string[]>>());
assert(isManaged<valueof<string[]>>());
// array indexes
assert(isInteger<indexof<string[][]>>());
assert(isSigned<indexof<string[][]>>());
assert(sizeof<indexof<string[][]>>() == 4); // i32
// array values
assert(isArray<valueof<string[][]>>());
// typed array indexes
assert(isInteger<indexof<Float32Array>>());
assert(isSigned<indexof<Float32Array>>());
assert(sizeof<indexof<Float32Array>>() == 4); // i32
// typed array values
assert(isInteger<valueof<Uint8ClampedArray>>());
assert(!isSigned<valueof<Uint8ClampedArray>>());
assert(sizeof<valueof<Uint8ClampedArray>>() == 1);
// map indexes
assert(isInteger<indexof<Map<i32,i32>>>());
assert(isFloat<indexof<Map<f32,i32>>>());
assert(isString<indexof<Map<string,i32>>>());
// map values
assert(isInteger<valueof<Map<i32,i8>>>());
assert(isFloat<valueof<Map<i32,f32>>>());
assert(isString<valueof<Map<i32,string>>>());
// set indexes
assert(isInteger<indexof<Set<i32>>>());
assert(isFloat<indexof<Set<f32>>>());
assert(isString<indexof<Set<string>>>());
// set values (always bool)
assert(isBoolean<valueof<Set<i32>>>());
assert(isBoolean<valueof<Set<f32>>>());
assert(isBoolean<valueof<Set<string>>>());

@@ -0,0 +1,384 @@
(module
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00i\00n\00d\00e\00x\00o\00f\00-\00v\00a\00l\00u\00e\00o\00f\00.\00t\00s\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(export "memory" (memory $0))
(start $start)
(func $start:indexof-valueof (; 1 ;) (type $FUNCSIG$v)
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 2
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 3
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 4
i32.const 4
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 4
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 7
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 8
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 9
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 13
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 0
i32.eqz
i32.eqz
if
i32.const 0
i32.const 24
i32.const 14
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 4
i32.const 4
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 15
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 18
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 4
i32.const 4
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 19
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 22
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 23
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 26
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 27
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 4
i32.const 4
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 28
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 31
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 34
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 35
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 4
i32.const 4
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 36
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 39
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 0
i32.eqz
i32.eqz
if
i32.const 0
i32.const 24
i32.const 40
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 41
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 44
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 45
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 46
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 49
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 50
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 51
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 54
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 55
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 56
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 59
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 60
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 61
i32.const 0
call $~lib/builtins/abort
unreachable
end
)
(func $start (; 2 ;) (type $FUNCSIG$v)
call $start:indexof-valueof
)
(func $null (; 3 ;) (type $FUNCSIG$v)
)
)

@@ -35,7 +35,9 @@
(data (i32.const 264) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e") (data (i32.const 264) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e")
(data (i32.const 320) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s") (data (i32.const 320) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s")
(data (i32.const 360) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s") (data (i32.const 360) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s")
(data (i32.const 400) "\0d\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\98D\08\00\00\00\00\00\98D\00\00\00\00\00\00\98\84\08\00\00\00\00\00\98\84\00\00\00\00\00\00\98\04\t\00\00\00\00\00\98\04\01\00\00\00\00\00\98\04\n\00\00\00\00\00\98\04\02\00\00\00\00\00\98\04\19\00\00\00\00\00\98\04\1a") (data (i32.const 400) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00K\00e\00y\00 \00d\00o\00e\00s\00 \00n\00o\00t\00 \00e\00x\00i\00s\00t")
(data (i32.const 456) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00~\00l\00i\00b\00/\00m\00a\00p\00.\00t\00s")
(data (i32.const 496) "\0d\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\98D\08\00\00\00\00\00\98D\00\00\00\00\00\00\98\84\08\00\00\00\00\00\98\84\00\00\00\00\00\00\98\04\t\00\00\00\00\00\98\04\01\00\00\00\00\00\98\04\n\00\00\00\00\00\98\04\02\00\00\00\00\00\98\04\19\00\00\00\00\00\98\04\1a")
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0))
@@ -627,10 +629,10 @@
if if
unreachable unreachable
end end
i32.const 512 i32.const 608
i32.const 0 i32.const 0
i32.store i32.store
i32.const 2080 i32.const 2176
i32.const 0 i32.const 0
i32.store i32.store
i32.const 0 i32.const 0
@@ -644,7 +646,7 @@
local.get $0 local.get $0
i32.const 2 i32.const 2
i32.shl i32.shl
i32.const 512 i32.const 608
i32.add i32.add
i32.const 0 i32.const 0
i32.store offset=4 i32.store offset=4
@@ -663,7 +665,7 @@
i32.add i32.add
i32.const 2 i32.const 2
i32.shl i32.shl
i32.const 512 i32.const 608
i32.add i32.add
i32.const 0 i32.const 0
i32.store offset=96 i32.store offset=96
@@ -681,13 +683,13 @@
br $loop|0 br $loop|0
end end
end end
i32.const 512 i32.const 608
i32.const 2096 i32.const 2192
memory.size memory.size
i32.const 16 i32.const 16
i32.shl i32.shl
call $~lib/rt/tlsf/addMemory call $~lib/rt/tlsf/addMemory
i32.const 512 i32.const 608
global.set $~lib/rt/tlsf/ROOT global.set $~lib/rt/tlsf/ROOT
) )
(func $~lib/rt/tlsf/prepareSize (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/rt/tlsf/prepareSize (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@@ -1079,7 +1081,7 @@
) )
(func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
i32.const 508 i32.const 604
i32.gt_u i32.gt_u
if if
local.get $0 local.get $0
@@ -1348,7 +1350,7 @@
) )
(func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
i32.const 400 i32.const 496
i32.load i32.load
i32.gt_u i32.gt_u
if if
@@ -1362,7 +1364,7 @@
local.get $0 local.get $0
i32.const 3 i32.const 3
i32.shl i32.shl
i32.const 404 i32.const 500
i32.add i32.add
i32.load i32.load
) )
@@ -1734,7 +1736,7 @@
) )
(func $~lib/rt/pure/__release (; 26 ;) (type $FUNCSIG$vi) (param $0 i32) (func $~lib/rt/pure/__release (; 26 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0 local.get $0
i32.const 508 i32.const 604
i32.gt_u i32.gt_u
if if
local.get $0 local.get $0
@@ -2107,12 +2109,17 @@
call $~lib/util/hash/hash8 call $~lib/util/hash/hash8
call $~lib/map/Map<i8,i32>#find call $~lib/map/Map<i8,i32>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=4
) )
(func $~lib/map/Map<i8,i32>#delete (; 35 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<i8,i32>#delete (; 35 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
@@ -2796,12 +2803,17 @@
call $~lib/util/hash/hash8 call $~lib/util/hash/hash8
call $~lib/map/Map<i8,i32>#find call $~lib/map/Map<i8,i32>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=4
) )
(func $~lib/map/Map<u8,i32>#delete (; 42 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<u8,i32>#delete (; 42 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
@@ -3535,12 +3547,17 @@
call $~lib/util/hash/hash16 call $~lib/util/hash/hash16
call $~lib/map/Map<i16,i32>#find call $~lib/map/Map<i16,i32>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=4
) )
(func $~lib/map/Map<i16,i32>#delete (; 51 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<i16,i32>#delete (; 51 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
@@ -4224,12 +4241,17 @@
call $~lib/util/hash/hash16 call $~lib/util/hash/hash16
call $~lib/map/Map<i16,i32>#find call $~lib/map/Map<i16,i32>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=4
) )
(func $~lib/map/Map<u16,i32>#delete (; 58 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<u16,i32>#delete (; 58 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
@@ -4965,12 +4987,17 @@
call $~lib/util/hash/hash32 call $~lib/util/hash/hash32
call $~lib/map/Map<i32,i32>#find call $~lib/map/Map<i32,i32>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=4
) )
(func $~lib/map/Map<i32,i32>#delete (; 67 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<i32,i32>#delete (; 67 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
@@ -6104,12 +6131,17 @@
call $~lib/util/hash/hash64 call $~lib/util/hash/hash64
call $~lib/map/Map<i64,i32>#find call $~lib/map/Map<i64,i32>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=8 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=8
) )
(func $~lib/map/Map<i64,i32>#delete (; 79 ;) (type $FUNCSIG$vij) (param $0 i32) (param $1 i64) (func $~lib/map/Map<i64,i32>#delete (; 79 ;) (type $FUNCSIG$vij) (param $0 i32) (param $1 i64)
(local $2 i32) (local $2 i32)
@@ -7163,12 +7195,17 @@
call $~lib/util/hash/hash32 call $~lib/util/hash/hash32
call $~lib/map/Map<f32,i32>#find call $~lib/map/Map<f32,i32>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=4
) )
(func $~lib/map/Map<f32,i32>#delete (; 89 ;) (type $FUNCSIG$vif) (param $0 i32) (param $1 f32) (func $~lib/map/Map<f32,i32>#delete (; 89 ;) (type $FUNCSIG$vif) (param $0 i32) (param $1 f32)
(local $2 i32) (local $2 i32)
@@ -7870,12 +7907,17 @@
call $~lib/util/hash/hash64 call $~lib/util/hash/hash64
call $~lib/map/Map<f64,i32>#find call $~lib/map/Map<f64,i32>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=8 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=8
) )
(func $~lib/map/Map<f64,i32>#delete (; 97 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) (func $~lib/map/Map<f64,i32>#delete (; 97 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64)
(local $2 i32) (local $2 i32)
@@ -8381,7 +8423,7 @@
) )
(func $~lib/rt/pure/__visit (; 104 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/rt/pure/__visit (; 104 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
local.get $0 local.get $0
i32.const 508 i32.const 604
i32.lt_u i32.lt_u
if if
return return

@@ -31,7 +31,9 @@
(data (i32.const 264) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00") (data (i32.const 264) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00")
(data (i32.const 320) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00") (data (i32.const 320) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00")
(data (i32.const 360) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s\00") (data (i32.const 360) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s\00")
(data (i32.const 400) "\0d\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\98D\08\00\00\00\00\00\98D\00\00\00\00\00\00\98\84\08\00\00\00\00\00\98\84\00\00\00\00\00\00\98\04\t\00\00\00\00\00\98\04\01\00\00\00\00\00\98\04\n\00\00\00\00\00\98\04\02\00\00\00\00\00\98\04\19\00\00\00\00\00\98\04\1a\00\00\00\00\00") (data (i32.const 400) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00K\00e\00y\00 \00d\00o\00e\00s\00 \00n\00o\00t\00 \00e\00x\00i\00s\00t\00")
(data (i32.const 456) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00~\00l\00i\00b\00/\00m\00a\00p\00.\00t\00s\00")
(data (i32.const 496) "\0d\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\98D\08\00\00\00\00\00\98D\00\00\00\00\00\00\98\84\08\00\00\00\00\00\98\84\00\00\00\00\00\00\98\04\t\00\00\00\00\00\98\04\01\00\00\00\00\00\98\04\n\00\00\00\00\00\98\04\02\00\00\00\00\00\98\04\19\00\00\00\00\00\98\04\1a\00\00\00\00\00")
(table $0 1 funcref) (table $0 1 funcref)
(elem (i32.const 0) $null) (elem (i32.const 0) $null)
(global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0))
@@ -39,8 +41,8 @@
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/rt/__rtti_base i32 (i32.const 400)) (global $~lib/rt/__rtti_base i32 (i32.const 496))
(global $~lib/heap/__heap_base i32 (i32.const 508)) (global $~lib/heap/__heap_base i32 (i32.const 604))
(export "memory" (memory $0)) (export "memory" (memory $0))
(start $start) (start $start)
(func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
@@ -3663,12 +3665,17 @@
call $~lib/map/Map<i8,i32>#find call $~lib/map/Map<i8,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=4
) )
(func $~lib/map/Map<i8,i32>#get:size (; 36 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<i8,i32>#get:size (; 36 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -4542,12 +4549,17 @@
call $~lib/map/Map<u8,i32>#find call $~lib/map/Map<u8,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=4
) )
(func $~lib/map/Map<u8,i32>#get:size (; 46 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<u8,i32>#get:size (; 46 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -5435,12 +5447,17 @@
call $~lib/map/Map<i16,i32>#find call $~lib/map/Map<i16,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=4
) )
(func $~lib/map/Map<i16,i32>#get:size (; 57 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<i16,i32>#get:size (; 57 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -6314,12 +6331,17 @@
call $~lib/map/Map<u16,i32>#find call $~lib/map/Map<u16,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=4
) )
(func $~lib/map/Map<u16,i32>#get:size (; 67 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<u16,i32>#get:size (; 67 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -7211,12 +7233,17 @@
call $~lib/map/Map<i32,i32>#find call $~lib/map/Map<i32,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=4
) )
(func $~lib/map/Map<i32,i32>#get:size (; 78 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<i32,i32>#get:size (; 78 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -8050,12 +8077,17 @@
call $~lib/map/Map<u32,i32>#find call $~lib/map/Map<u32,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=4
) )
(func $~lib/map/Map<u32,i32>#get:size (; 88 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<u32,i32>#get:size (; 88 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -8979,12 +9011,17 @@
call $~lib/map/Map<i64,i32>#find call $~lib/map/Map<i64,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=8 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=8
) )
(func $~lib/map/Map<i64,i32>#get:size (; 99 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<i64,i32>#get:size (; 99 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -9828,12 +9865,17 @@
call $~lib/map/Map<u64,i32>#find call $~lib/map/Map<u64,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=8 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=8
) )
(func $~lib/map/Map<u64,i32>#get:size (; 109 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<u64,i32>#get:size (; 109 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -10681,12 +10723,17 @@
call $~lib/map/Map<f32,i32>#find call $~lib/map/Map<f32,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=4 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=4
) )
(func $~lib/map/Map<f32,i32>#get:size (; 119 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<f32,i32>#get:size (; 119 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
@@ -11535,12 +11582,17 @@
call $~lib/map/Map<f64,i32>#find call $~lib/map/Map<f64,i32>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=8 i32.const 416
else i32.const 472
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=8
) )
(func $~lib/map/Map<f64,i32>#get:size (; 129 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/map/Map<f64,i32>#get:size (; 129 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0

@@ -14,25 +14,27 @@
(data (i32.const 32) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s") (data (i32.const 32) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s")
(data (i32.const 80) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") (data (i32.const 80) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h")
(data (i32.const 128) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 128) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s")
(data (i32.const 188) "\01\00\00\00\01") (data (i32.const 184) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00K\00e\00y\00 \00d\00o\00e\00s\00 \00n\00o\00t\00 \00e\00x\00i\00s\00t")
(data (i32.const 200) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e") (data (i32.const 240) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00~\00l\00i\00b\00/\00m\00a\00p\00.\00t\00s")
(data (i32.const 240) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e") (data (i32.const 284) "\01\00\00\00\01")
(data (i32.const 296) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00i\00s\00R\00e\00g\00E\00x\00p") (data (i32.const 296) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e")
(data (i32.const 328) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00m\00a\00t\00c\00h") (data (i32.const 336) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e")
(data (i32.const 360) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00r\00e\00p\00l\00a\00c\00e") (data (i32.const 392) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00i\00s\00R\00e\00g\00E\00x\00p")
(data (i32.const 392) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00s\00e\00a\00r\00c\00h") (data (i32.const 424) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00m\00a\00t\00c\00h")
(data (i32.const 424) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00s\00p\00e\00c\00i\00e\00s") (data (i32.const 456) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00r\00e\00p\00l\00a\00c\00e")
(data (i32.const 456) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00s\00p\00l\00i\00t") (data (i32.const 488) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00s\00e\00a\00r\00c\00h")
(data (i32.const 488) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e") (data (i32.const 520) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00s\00p\00e\00c\00i\00e\00s")
(data (i32.const 528) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g") (data (i32.const 552) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00s\00p\00l\00i\00t")
(data (i32.const 568) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s") (data (i32.const 584) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e")
(data (i32.const 608) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00S\00y\00m\00b\00o\00l\00(") (data (i32.const 624) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g")
(data (i32.const 640) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00n\00u\00l\00l") (data (i32.const 664) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s")
(data (i32.const 664) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00)") (data (i32.const 704) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00S\00y\00m\00b\00o\00l\00(")
(data (i32.const 688) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00S\00y\00m\00b\00o\00l\00(\00)") (data (i32.const 736) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00n\00u\00l\00l")
(data (i32.const 720) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)") (data (i32.const 760) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00)")
(data (i32.const 760) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)") (data (i32.const 784) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00S\00y\00m\00b\00o\00l\00(\00)")
(data (i32.const 816) "4\00\00\00\01\00\00\00\01\00\00\004\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)") (data (i32.const 816) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)")
(data (i32.const 856) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)")
(data (i32.const 912) "4\00\00\00\01\00\00\00\01\00\00\004\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)")
(global $~lib/symbol/nextId (mut i32) (i32.const 12)) (global $~lib/symbol/nextId (mut i32) (i32.const 12))
(global $std/symbol/sym1 (mut i32) (i32.const 0)) (global $std/symbol/sym1 (mut i32) (i32.const 0))
(global $std/symbol/sym2 (mut i32) (i32.const 0)) (global $std/symbol/sym2 (mut i32) (i32.const 0))
@@ -609,7 +611,25 @@
end end
i32.const 0 i32.const 0
) )
(func $~lib/map/Map<~lib/string/String,usize>#rehash (; 13 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<~lib/string/String,usize>#get (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.const 24
call $~lib/util/hash/hashStr
call $~lib/map/Map<~lib/string/String,usize>#find
local.tee $0
i32.eqz
if
i32.const 200
i32.const 256
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable
end
local.get $0
i32.load offset=4
)
(func $~lib/map/Map<~lib/string/String,usize>#rehash (; 14 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@@ -716,7 +736,7 @@
i32.load offset=20 i32.load offset=20
i32.store offset=16 i32.store offset=16
) )
(func $~lib/map/Map<~lib/string/String,usize>#set (; 14 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<~lib/string/String,usize>#set (; 15 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@@ -805,7 +825,7 @@
i32.store i32.store
end end
) )
(func $~lib/util/hash/hash32 (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/util/hash/hash32 (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0 local.get $0
i32.const 255 i32.const 255
i32.and i32.and
@@ -836,7 +856,7 @@
i32.const 16777619 i32.const 16777619
i32.mul i32.mul
) )
(func $~lib/map/Map<usize,~lib/string/String>#find (; 16 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (func $~lib/map/Map<usize,~lib/string/String>#find (; 17 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
local.get $0 local.get $0
i32.load i32.load
local.get $0 local.get $0
@@ -879,7 +899,7 @@
end end
i32.const 0 i32.const 0
) )
(func $~lib/map/Map<usize,~lib/string/String>#rehash (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<usize,~lib/string/String>#rehash (; 18 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@@ -986,7 +1006,7 @@
i32.load offset=20 i32.load offset=20
i32.store offset=16 i32.store offset=16
) )
(func $~lib/map/Map<usize,~lib/string/String>#set (; 18 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (func $~lib/map/Map<usize,~lib/string/String>#set (; 19 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@@ -1082,7 +1102,7 @@
i32.store i32.store
end end
) )
(func $~lib/symbol/_Symbol.for (; 19 ;) (type $FUNCSIG$i) (result i32) (func $~lib/symbol/_Symbol.for (; 20 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32) (local $0 i32)
global.get $~lib/symbol/stringToId global.get $~lib/symbol/stringToId
if if
@@ -1092,16 +1112,7 @@
call $~lib/map/Map<~lib/string/String,usize>#find call $~lib/map/Map<~lib/string/String,usize>#find
if if
global.get $~lib/symbol/stringToId global.get $~lib/symbol/stringToId
i32.const 24 call $~lib/map/Map<~lib/string/String,usize>#get
call $~lib/util/hash/hashStr
call $~lib/map/Map<~lib/string/String,usize>#find
local.tee $0
if (result i32)
local.get $0
i32.load offset=4
else
unreachable
end
return return
end end
else else
@@ -1128,7 +1139,7 @@
call $~lib/map/Map<usize,~lib/string/String>#set call $~lib/map/Map<usize,~lib/string/String>#set
local.get $0 local.get $0
) )
(func $~lib/map/Map<usize,~lib/string/String>#has (; 20 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/map/Map<usize,~lib/string/String>#has (; 21 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0 local.get $0
local.get $1 local.get $1
local.get $1 local.get $1
@@ -1137,21 +1148,26 @@
i32.const 0 i32.const 0
i32.ne i32.ne
) )
(func $~lib/map/Map<usize,~lib/string/String>#get (; 21 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/map/Map<usize,~lib/string/String>#get (; 22 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0 local.get $0
local.get $1 local.get $1
local.get $1 local.get $1
call $~lib/util/hash/hash32 call $~lib/util/hash/hash32
call $~lib/map/Map<usize,~lib/string/String>#find call $~lib/map/Map<usize,~lib/string/String>#find
local.tee $0 local.tee $0
if (result i32) i32.eqz
local.get $0 if
i32.load offset=4 i32.const 200
else i32.const 256
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $0
i32.load offset=4
) )
(func $~lib/symbol/_Symbol.keyFor (; 22 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/symbol/_Symbol.keyFor (; 23 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
global.get $~lib/symbol/idToString global.get $~lib/symbol/idToString
if (result i32) if (result i32)
global.get $~lib/symbol/idToString global.get $~lib/symbol/idToString
@@ -1168,7 +1184,7 @@
i32.const 0 i32.const 0
end end
) )
(func $~lib/memory/memory.copy (; 23 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (func $~lib/memory/memory.copy (; 24 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
block $~lib/util/memory/memmove|inlined.0 block $~lib/util/memory/memmove|inlined.0
@@ -1343,7 +1359,7 @@
end end
end end
) )
(func $~lib/string/String#concat (; 24 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/string/String#concat (; 25 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32) (local $4 i32)
@@ -1353,7 +1369,7 @@
i32.shl i32.shl
local.tee $3 local.tee $3
local.get $1 local.get $1
i32.const 656 i32.const 752
local.get $1 local.get $1
select select
local.tee $1 local.tee $1
@@ -1365,7 +1381,7 @@
local.tee $2 local.tee $2
i32.eqz i32.eqz
if if
i32.const 200 i32.const 296
return return
end end
local.get $2 local.get $2
@@ -1383,16 +1399,16 @@
call $~lib/memory/memory.copy call $~lib/memory/memory.copy
local.get $2 local.get $2
) )
(func $~lib/string/String.__concat (; 25 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/string/String.__concat (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0 local.get $0
i32.const 656 i32.const 752
local.get $0 local.get $0
select select
local.get $1 local.get $1
call $~lib/string/String#concat call $~lib/string/String#concat
) )
(func $~lib/symbol/_Symbol#toString (; 26 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/symbol/_Symbol#toString (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 624 i32.const 720
block $break|0 (result i32) block $break|0 (result i32)
block $case11|0 block $case11|0
block $case10|0 block $case10|0
@@ -1421,37 +1437,37 @@
end end
br $case11|0 br $case11|0
end end
i32.const 216 i32.const 312
br $break|0 br $break|0
end end
i32.const 256 i32.const 352
br $break|0 br $break|0
end end
i32.const 312 i32.const 408
br $break|0 br $break|0
end end
i32.const 344 i32.const 440
br $break|0 br $break|0
end end
i32.const 376 i32.const 472
br $break|0 br $break|0
end end
i32.const 408 i32.const 504
br $break|0 br $break|0
end end
i32.const 440 i32.const 536
br $break|0 br $break|0
end end
i32.const 472 i32.const 568
br $break|0 br $break|0
end end
i32.const 504 i32.const 600
br $break|0 br $break|0
end end
i32.const 544 i32.const 640
br $break|0 br $break|0
end end
i32.const 584 i32.const 680
br $break|0 br $break|0
end end
global.get $~lib/symbol/idToString global.get $~lib/symbol/idToString
@@ -1467,14 +1483,14 @@
local.get $0 local.get $0
call $~lib/map/Map<usize,~lib/string/String>#get call $~lib/map/Map<usize,~lib/string/String>#get
else else
i32.const 200 i32.const 296
end end
end end
call $~lib/string/String.__concat call $~lib/string/String.__concat
i32.const 680 i32.const 776
call $~lib/string/String.__concat call $~lib/string/String.__concat
) )
(func $start:std/symbol (; 27 ;) (type $FUNCSIG$v) (func $start:std/symbol (; 28 ;) (type $FUNCSIG$v)
(local $0 i32) (local $0 i32)
i32.const 24 i32.const 24
call $~lib/symbol/Symbol call $~lib/symbol/Symbol
@@ -1493,7 +1509,7 @@
call $~lib/builtins/abort call $~lib/builtins/abort
unreachable unreachable
end end
i32.const 896 i32.const 992
global.set $~lib/rt/stub/startOffset global.set $~lib/rt/stub/startOffset
global.get $~lib/rt/stub/startOffset global.get $~lib/rt/stub/startOffset
global.set $~lib/rt/stub/offset global.set $~lib/rt/stub/offset
@@ -1581,7 +1597,7 @@
i32.const 0 i32.const 0
call $~lib/symbol/Symbol call $~lib/symbol/Symbol
call $~lib/symbol/_Symbol#toString call $~lib/symbol/_Symbol#toString
i32.const 704 i32.const 800
call $~lib/string/String.__eq call $~lib/string/String.__eq
i32.eqz i32.eqz
if if
@@ -1594,7 +1610,7 @@
end end
global.get $std/symbol/sym3 global.get $std/symbol/sym3
call $~lib/symbol/_Symbol#toString call $~lib/symbol/_Symbol#toString
i32.const 736 i32.const 832
call $~lib/string/String.__eq call $~lib/string/String.__eq
i32.eqz i32.eqz
if if
@@ -1611,7 +1627,7 @@
global.set $std/symbol/isConcatSpreadable global.set $std/symbol/isConcatSpreadable
global.get $std/symbol/hasInstance global.get $std/symbol/hasInstance
call $~lib/symbol/_Symbol#toString call $~lib/symbol/_Symbol#toString
i32.const 776 i32.const 872
call $~lib/string/String.__eq call $~lib/string/String.__eq
i32.eqz i32.eqz
if if
@@ -1624,7 +1640,7 @@
end end
global.get $std/symbol/isConcatSpreadable global.get $std/symbol/isConcatSpreadable
call $~lib/symbol/_Symbol#toString call $~lib/symbol/_Symbol#toString
i32.const 832 i32.const 928
call $~lib/string/String.__eq call $~lib/string/String.__eq
i32.eqz i32.eqz
if if
@@ -1636,10 +1652,10 @@
unreachable unreachable
end end
) )
(func $start (; 28 ;) (type $FUNCSIG$v) (func $start (; 29 ;) (type $FUNCSIG$v)
call $start:std/symbol call $start:std/symbol
) )
(func $null (; 29 ;) (type $FUNCSIG$v) (func $null (; 30 ;) (type $FUNCSIG$v)
nop nop
) )
) )

@@ -14,25 +14,27 @@
(data (i32.const 32) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00") (data (i32.const 32) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00")
(data (i32.const 80) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") (data (i32.const 80) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00")
(data (i32.const 128) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") (data (i32.const 128) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
(data (i32.const 184) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00") (data (i32.const 184) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00K\00e\00y\00 \00d\00o\00e\00s\00 \00n\00o\00t\00 \00e\00x\00i\00s\00t\00")
(data (i32.const 200) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00") (data (i32.const 240) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00~\00l\00i\00b\00/\00m\00a\00p\00.\00t\00s\00")
(data (i32.const 240) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00") (data (i32.const 280) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00")
(data (i32.const 296) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00i\00s\00R\00e\00g\00E\00x\00p\00") (data (i32.const 296) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00")
(data (i32.const 328) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00m\00a\00t\00c\00h\00") (data (i32.const 336) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00")
(data (i32.const 360) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00r\00e\00p\00l\00a\00c\00e\00") (data (i32.const 392) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00i\00s\00R\00e\00g\00E\00x\00p\00")
(data (i32.const 392) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00s\00e\00a\00r\00c\00h\00") (data (i32.const 424) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00m\00a\00t\00c\00h\00")
(data (i32.const 424) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00s\00p\00e\00c\00i\00e\00s\00") (data (i32.const 456) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00r\00e\00p\00l\00a\00c\00e\00")
(data (i32.const 456) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00s\00p\00l\00i\00t\00") (data (i32.const 488) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00s\00e\00a\00r\00c\00h\00")
(data (i32.const 488) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e\00") (data (i32.const 520) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00s\00p\00e\00c\00i\00e\00s\00")
(data (i32.const 528) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g\00") (data (i32.const 552) "\n\00\00\00\01\00\00\00\01\00\00\00\n\00\00\00s\00p\00l\00i\00t\00")
(data (i32.const 568) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s\00") (data (i32.const 584) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e\00")
(data (i32.const 608) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00S\00y\00m\00b\00o\00l\00(\00") (data (i32.const 624) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g\00")
(data (i32.const 640) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00n\00u\00l\00l\00") (data (i32.const 664) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s\00")
(data (i32.const 664) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00)\00") (data (i32.const 704) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00S\00y\00m\00b\00o\00l\00(\00")
(data (i32.const 688) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00S\00y\00m\00b\00o\00l\00(\00)\00") (data (i32.const 736) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00n\00u\00l\00l\00")
(data (i32.const 720) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)\00") (data (i32.const 760) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00)\00")
(data (i32.const 760) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)\00") (data (i32.const 784) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00S\00y\00m\00b\00o\00l\00(\00)\00")
(data (i32.const 816) "4\00\00\00\01\00\00\00\01\00\00\004\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)\00") (data (i32.const 816) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)\00")
(data (i32.const 856) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)\00")
(data (i32.const 912) "4\00\00\00\01\00\00\00\01\00\00\004\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)\00")
(table $0 1 funcref) (table $0 1 funcref)
(elem (i32.const 0) $null) (elem (i32.const 0) $null)
(global $~lib/symbol/nextId (mut i32) (i32.const 12)) (global $~lib/symbol/nextId (mut i32) (i32.const 12))
@@ -53,7 +55,7 @@
(global $std/symbol/hasInstance (mut i32) (i32.const 0)) (global $std/symbol/hasInstance (mut i32) (i32.const 0))
(global $~lib/symbol/_Symbol.isConcatSpreadable i32 (i32.const 2)) (global $~lib/symbol/_Symbol.isConcatSpreadable i32 (i32.const 2))
(global $std/symbol/isConcatSpreadable (mut i32) (i32.const 0)) (global $std/symbol/isConcatSpreadable (mut i32) (i32.const 0))
(global $~lib/heap/__heap_base i32 (i32.const 884)) (global $~lib/heap/__heap_base i32 (i32.const 980))
(export "memory" (memory $0)) (export "memory" (memory $0))
(start $start) (start $start)
(func $~lib/rt/stub/__retain (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/rt/stub/__retain (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@@ -919,12 +921,19 @@
call $~lib/map/Map<~lib/string/String,usize>#find call $~lib/map/Map<~lib/string/String,usize>#find
local.set $4 local.set $4
local.get $4 local.get $4
if (result i32) i32.eqz
local.get $4 if
i32.load offset=4 local.get $1
else call $~lib/rt/stub/__release
i32.const 200
i32.const 256
i32.const 103
i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $4
i32.load offset=4
local.set $2 local.set $2
local.get $1 local.get $1
call $~lib/rt/stub/__release call $~lib/rt/stub/__release
@@ -1655,7 +1664,6 @@
(func $~lib/map/Map<usize,~lib/string/String>#get (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (func $~lib/map/Map<usize,~lib/string/String>#get (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32) (local $2 i32)
(local $3 i32) (local $3 i32)
(local $4 i32)
local.get $0 local.get $0
local.get $1 local.get $1
block $~lib/util/hash/HASH<usize>|inlined.3 (result i32) block $~lib/util/hash/HASH<usize>|inlined.3 (result i32)
@@ -1668,14 +1676,17 @@
call $~lib/map/Map<usize,~lib/string/String>#find call $~lib/map/Map<usize,~lib/string/String>#find
local.set $3 local.set $3
local.get $3 local.get $3
if (result i32) i32.eqz
local.get $3 if
i32.load offset=4 i32.const 200
call $~lib/rt/stub/__retain i32.const 256
local.tee $2 i32.const 103
else i32.const 16
call $~lib/builtins/abort
unreachable unreachable
end end
local.get $3
i32.load offset=4
call $~lib/rt/stub/__retain call $~lib/rt/stub/__retain
) )
(func $~lib/symbol/_Symbol.keyFor (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (func $~lib/symbol/_Symbol.keyFor (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@@ -2965,7 +2976,7 @@
i32.const 0 i32.const 0
i32.eq i32.eq
if if
i32.const 656 i32.const 752
local.tee $2 local.tee $2
local.get $1 local.get $1
local.tee $3 local.tee $3
@@ -2998,7 +3009,7 @@
i32.const 0 i32.const 0
i32.eq i32.eq
if if
i32.const 200 i32.const 296
call $~lib/rt/stub/__retain call $~lib/rt/stub/__retain
local.set $2 local.set $2
local.get $1 local.get $1
@@ -3036,7 +3047,7 @@
call $~lib/rt/stub/__retain call $~lib/rt/stub/__retain
drop drop
local.get $0 local.get $0
i32.const 656 i32.const 752
local.get $0 local.get $0
i32.const 0 i32.const 0
i32.ne i32.ne
@@ -3058,7 +3069,7 @@
(local $5 i32) (local $5 i32)
local.get $0 local.get $0
local.set $1 local.set $1
i32.const 200 i32.const 296
call $~lib/rt/stub/__retain call $~lib/rt/stub/__retain
local.set $2 local.set $2
block $break|0 block $break|0
@@ -3122,7 +3133,7 @@
br_if $case10|0 br_if $case10|0
br $case11|0 br $case11|0
end end
i32.const 216 i32.const 312
local.tee $3 local.tee $3
local.get $2 local.get $2
local.tee $4 local.tee $4
@@ -3138,7 +3149,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 256 i32.const 352
local.tee $4 local.tee $4
local.get $2 local.get $2
local.tee $3 local.tee $3
@@ -3154,7 +3165,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 312 i32.const 408
local.tee $3 local.tee $3
local.get $2 local.get $2
local.tee $4 local.tee $4
@@ -3170,7 +3181,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 344 i32.const 440
local.tee $4 local.tee $4
local.get $2 local.get $2
local.tee $3 local.tee $3
@@ -3186,7 +3197,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 376 i32.const 472
local.tee $3 local.tee $3
local.get $2 local.get $2
local.tee $4 local.tee $4
@@ -3202,7 +3213,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 408 i32.const 504
local.tee $4 local.tee $4
local.get $2 local.get $2
local.tee $3 local.tee $3
@@ -3218,7 +3229,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 440 i32.const 536
local.tee $3 local.tee $3
local.get $2 local.get $2
local.tee $4 local.tee $4
@@ -3234,7 +3245,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 472 i32.const 568
local.tee $4 local.tee $4
local.get $2 local.get $2
local.tee $3 local.tee $3
@@ -3250,7 +3261,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 504 i32.const 600
local.tee $3 local.tee $3
local.get $2 local.get $2
local.tee $4 local.tee $4
@@ -3266,7 +3277,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 544 i32.const 640
local.tee $4 local.tee $4
local.get $2 local.get $2
local.tee $3 local.tee $3
@@ -3282,7 +3293,7 @@
local.set $2 local.set $2
br $break|0 br $break|0
end end
i32.const 584 i32.const 680
local.tee $3 local.tee $3
local.get $2 local.get $2
local.tee $4 local.tee $4
@@ -3320,11 +3331,11 @@
end end
br $break|0 br $break|0
end end
i32.const 624 i32.const 720
local.get $2 local.get $2
call $~lib/string/String.__concat call $~lib/string/String.__concat
local.tee $4 local.tee $4
i32.const 680 i32.const 776
call $~lib/string/String.__concat call $~lib/string/String.__concat
local.tee $3 local.tee $3
call $~lib/rt/stub/__retain call $~lib/rt/stub/__retain
@@ -3466,7 +3477,7 @@
call $~lib/symbol/Symbol call $~lib/symbol/Symbol
call $~lib/symbol/_Symbol#toString call $~lib/symbol/_Symbol#toString
local.tee $0 local.tee $0
i32.const 704 i32.const 800
call $~lib/string/String.__eq call $~lib/string/String.__eq
i32.eqz i32.eqz
if if
@@ -3480,7 +3491,7 @@
global.get $std/symbol/sym3 global.get $std/symbol/sym3
call $~lib/symbol/_Symbol#toString call $~lib/symbol/_Symbol#toString
local.tee $1 local.tee $1
i32.const 736 i32.const 832
call $~lib/string/String.__eq call $~lib/string/String.__eq
i32.eqz i32.eqz
if if
@@ -3498,7 +3509,7 @@
global.get $std/symbol/hasInstance global.get $std/symbol/hasInstance
call $~lib/symbol/_Symbol#toString call $~lib/symbol/_Symbol#toString
local.tee $2 local.tee $2
i32.const 776 i32.const 872
call $~lib/string/String.__eq call $~lib/string/String.__eq
i32.eqz i32.eqz
if if
@@ -3512,7 +3523,7 @@
global.get $std/symbol/isConcatSpreadable global.get $std/symbol/isConcatSpreadable
call $~lib/symbol/_Symbol#toString call $~lib/symbol/_Symbol#toString
local.tee $3 local.tee $3
i32.const 832 i32.const 928
call $~lib/string/String.__eq call $~lib/string/String.__eq
i32.eqz i32.eqz
if if

@@ -1,9 +0,0 @@
(module
(type $FUNCSIG$v (func))
(memory $0 1)
(data (i32.const 8) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00v\00a\00l\00u\00e\00o\00f\00.\00t\00s")
(export "memory" (memory $0))
(func $start (; 0 ;) (type $FUNCSIG$v)
nop
)
)

@@ -1,26 +0,0 @@
// simple
assert(isInteger<valueof<i8[]>>());
assert(isSigned<valueof<i8[]>>());
assert(sizeof<valueof<i8[]>>() == 1);
// alias
type u32Array = u32[];
assert(isInteger<valueof<u32Array>>());
assert(!isSigned<valueof<u32Array>>());
assert(sizeof<valueof<u32Array>>() == 4);
// float
assert(isFloat<valueof<f32[]>>());
assert(sizeof<valueof<f32[]>>() == 4);
// string
assert(isString<valueof<string[]>>());
assert(isManaged<valueof<string[]>>());
// array
assert(isArray<valueof<string[][]>>());
// typed array
assert(isInteger<valueof<Uint8ClampedArray>>());
assert(!isSigned<valueof<Uint8ClampedArray>>());
assert(sizeof<valueof<Uint8ClampedArray>>() == 1);

@@ -1,168 +0,0 @@
(module
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00v\00a\00l\00u\00e\00o\00f\00.\00t\00s\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(export "memory" (memory $0))
(start $start)
(func $start:valueof (; 1 ;) (type $FUNCSIG$v)
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 2
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 3
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 4
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 8
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 0
i32.eqz
i32.eqz
if
i32.const 0
i32.const 24
i32.const 9
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 4
i32.const 4
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 10
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 13
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 4
i32.const 4
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 14
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 17
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 18
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 21
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.eqz
if
i32.const 0
i32.const 24
i32.const 24
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 0
i32.eqz
i32.eqz
if
i32.const 0
i32.const 24
i32.const 25
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 26
i32.const 0
call $~lib/builtins/abort
unreachable
end
)
(func $start (; 2 ;) (type $FUNCSIG$v)
call $start:valueof
)
(func $null (; 3 ;) (type $FUNCSIG$v)
)
)