mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-25 03:02:08 +00:00
Make the transition to ArrayBuffer backed Arrays (#70)
* Traverse base classes when resolving overloads * Implement preliminary TypedArray accessors * Extract decorator flags from common flags to make space * Add '**' overload * Implement basic explicit inlining * Support inlining of instance methods * Reduce number of required locals when inlining * Implement inlining of operator overloads * Fix issues when inlining generic functions
This commit is contained in:
src
ast.tsbuiltins.tscompiler.tsdiagnosticMessages.generated.tsdiagnosticMessages.jsondiagnostics.ts
extra
module.tsparser.tsprogram.tstokenizer.tstypes.tsstd
tests
allocators
compiler
if.optimized.watif.untouched.watinlining.optimized.watinlining.tsinlining.untouched.wat
std
array-access.optimized.watarray-access.untouched.watarray.optimized.watarray.tsarray.untouched.watarraybuffer.optimized.watarraybuffer.untouched.watmath.optimized.watmath.untouched.watoperator-overloading.optimized.watoperator-overloading.tsoperator-overloading.untouched.watstatic-array.optimized.watstatic-array.untouched.watstring.optimized.watstring.untouched.wattypedarray.optimized.wattypedarray.tstypedarray.untouched.wat
46
src/ast.ts
46
src/ast.ts
@@ -198,32 +198,9 @@ export abstract class Node {
|
||||
stmt.range = range;
|
||||
stmt.name = expression; expression.parent = stmt;
|
||||
stmt.arguments = args; if (args) setParent(args, stmt);
|
||||
if (expression.kind == NodeKind.IDENTIFIER) {
|
||||
switch ((<IdentifierExpression>expression).text) {
|
||||
case "global": {
|
||||
stmt.decoratorKind = DecoratorKind.GLOBAL;
|
||||
break;
|
||||
}
|
||||
case "operator": {
|
||||
stmt.decoratorKind = DecoratorKind.OPERATOR;
|
||||
break;
|
||||
}
|
||||
case "unmanaged": {
|
||||
stmt.decoratorKind = DecoratorKind.UNMANAGED;
|
||||
break;
|
||||
}
|
||||
case "offset": {
|
||||
stmt.decoratorKind = DecoratorKind.OFFSET;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
stmt.decoratorKind = DecoratorKind.CUSTOM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
stmt.decoratorKind = DecoratorKind.CUSTOM;
|
||||
}
|
||||
stmt.decoratorKind = expression.kind == NodeKind.IDENTIFIER
|
||||
? stringToDecoratorKind((<IdentifierExpression>expression).text)
|
||||
: DecoratorKind.CUSTOM;
|
||||
return stmt;
|
||||
}
|
||||
|
||||
@@ -1075,7 +1052,22 @@ export enum DecoratorKind {
|
||||
GLOBAL,
|
||||
OPERATOR,
|
||||
UNMANAGED,
|
||||
OFFSET
|
||||
SEALED,
|
||||
INLINE,
|
||||
PRECOMPUTE
|
||||
}
|
||||
|
||||
/** Returns the decorator kind represented by the specified string. */
|
||||
export function stringToDecoratorKind(str: string): DecoratorKind {
|
||||
switch (str) {
|
||||
case "global": return DecoratorKind.GLOBAL;
|
||||
case "operator": return DecoratorKind.OPERATOR;
|
||||
case "unmanaged": return DecoratorKind.UNMANAGED;
|
||||
case "sealed": return DecoratorKind.SEALED;
|
||||
case "inline": return DecoratorKind.INLINE;
|
||||
case "precompute": return DecoratorKind.PRECOMPUTE;
|
||||
default: return DecoratorKind.CUSTOM;
|
||||
}
|
||||
}
|
||||
|
||||
/** Represents a decorator. */
|
||||
|
Reference in New Issue
Block a user