mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-18 09:21:35 +00:00
Initial implementation of 'new'
This doesn't yet call the constructor or use provided parameters and just allocates raw memory
This commit is contained in:
22
src/ast.ts
22
src/ast.ts
@ -2,7 +2,7 @@ import {
|
||||
PATH_DELIMITER,
|
||||
STATIC_DELIMITER,
|
||||
INSTANCE_DELIMITER
|
||||
} from "./constants";
|
||||
} from "./program";
|
||||
|
||||
import {
|
||||
Token,
|
||||
@ -1508,16 +1508,6 @@ export function hasDecorator(name: string, decorators: Decorator[] | null): bool
|
||||
return getFirstDecorator(name, decorators) != null;
|
||||
}
|
||||
|
||||
/** Mangles a path to an internal path. */
|
||||
export function mangleInternalPath(path: string): string {
|
||||
// not necessary with current config
|
||||
// if (PATH_DELIMITER.charCodeAt(0) != CharCode.SLASH)
|
||||
// path = path.replace("/", PATH_DELIMITER);
|
||||
// if (PARENT_SUBST != "..")
|
||||
// path = path.replace("..", PARENT_SUBST);
|
||||
return path;
|
||||
}
|
||||
|
||||
/** Mangles a declaration's name to an internal name. */
|
||||
export function mangleInternalName(declaration: DeclarationStatement, asGlobal: bool = false): string {
|
||||
var name = declaration.name.name;
|
||||
@ -1535,3 +1525,13 @@ export function mangleInternalName(declaration: DeclarationStatement, asGlobal:
|
||||
return name;
|
||||
return declaration.range.source.internalPath + PATH_DELIMITER + name;
|
||||
}
|
||||
|
||||
/** Mangles an external to an internal path. */
|
||||
export function mangleInternalPath(path: string): string {
|
||||
// not necessary with current config
|
||||
// if (PATH_DELIMITER.charCodeAt(0) != CharCode.SLASH)
|
||||
// path = path.replace("/", PATH_DELIMITER);
|
||||
// if (PARENT_SUBST != "..")
|
||||
// path = path.replace("..", PARENT_SUBST);
|
||||
return path;
|
||||
}
|
||||
|
Reference in New Issue
Block a user