Compare commits

...

31 Commits

Author SHA1 Message Date
1d50ff14c5 bump
All checks were successful
tagged-release / Tagged Release (push) Successful in 2m34s
2025-01-10 00:35:04 +02:00
a6c458cb23 rename project from jscript to j2s 2025-01-10 00:34:29 +02:00
31e2e95bc8 fix: prevent rollup from optimizing "void 0" to "undefined"
All checks were successful
tagged-release / Tagged Release (push) Successful in 2m29s
2025-01-09 00:13:14 +02:00
98dde69751 revert to coffeescript transpiler 2025-01-09 00:12:13 +02:00
ec1edb981e fix: register sources before the next compiler gets invoked 2025-01-09 00:11:57 +02:00
36f9839485 fix: get rid of readonly for the Location type
(only caused headaches)
2025-01-09 00:10:15 +02:00
22f36267c0 feat: add prettier printing for arrays in debugger 2025-01-09 00:09:43 +02:00
f8b9776f28 fix: for-in loop doesn't declare its binding when it has to 2025-01-09 00:09:18 +02:00
12cff84666 fix: String.lastIndexOf's offset argument must default to the string's length 2025-01-09 00:08:14 +02:00
7058a689a2 fix: Object.defineProperty passes flags wrongly 2025-01-09 00:07:51 +02:00
fde8b42e36 fix: wrong return value from array.push and array.unshift 2025-01-09 00:07:17 +02:00
4ea14ca1f5 build: enable minification 2025-01-06 17:06:10 +02:00
f6ce261485 fix: add custom global functions to ts decls 2025-01-06 17:05:59 +02:00
51b347e0d7 fix: more stable engine exit 2025-01-06 17:05:37 +02:00
0b6484e0b4 fuck
All checks were successful
tagged-release / Tagged Release (push) Successful in 2m41s
2025-01-06 14:53:27 +02:00
07e0d0ba3b fix script; bump version
Some checks failed
tagged-release / Tagged Release (push) Failing after 3m29s
2025-01-06 14:26:56 +02:00
93cae33bb0 fix: fix up script
Some checks failed
tagged-release / Tagged Release (push) Failing after 4m50s
2025-01-06 14:13:58 +02:00
b1e0db627c fix typings so they are usable for building the project itself
Some checks failed
tagged-release / Tagged Release (push) Failing after 3m24s
2025-01-06 14:02:07 +02:00
4fd05e9e6f fix up build scripts
Some checks failed
tagged-release / Tagged Release (push) Failing after 3m48s
2025-01-06 13:31:17 +02:00
de93adde8f fix: some source mapping fixes 2025-01-06 13:24:58 +02:00
5c68c1717c feat: implement some typed arrays 2025-01-06 13:24:44 +02:00
7883af7fff fix: some array function fixes 2025-01-06 13:24:09 +02:00
3d5be60fc7 feat: honor passed set in toReadableLines 2025-01-06 13:22:58 +02:00
ba0b4e06ad fix: some debugger issues 2025-01-06 13:22:26 +02:00
58e3546459 implement __proto__ field for all objects 2025-01-06 13:22:06 +02:00
57097e46ca reorganize libs 2025-01-06 13:20:51 +02:00
28e72503a6 Update .github/workflows/tagged-release.yml
Some checks failed
tagged-release / Tagged Release (push) Failing after 2m14s
2025-01-01 22:33:57 +00:00
d0a0796e14 Merge pull request 'topchetoeu-bump-0-10' (#32) from topchetoeu-bump-0-10 into master
Some checks failed
tagged-release / Tagged Release (push) Failing after 11m3s
Reviewed-on: #32
2025-01-01 22:20:16 +00:00
0de54e5505 Update gradle.properties 2025-01-01 22:19:56 +00:00
96c9d29a6a Update .github/workflows/tagged-release.yml 2025-01-01 22:19:36 +00:00
37dc844cc4 fix: use typescript instead 2025-01-01 22:16:01 +00:00
179 changed files with 1833 additions and 1146 deletions

View File

@@ -11,27 +11,24 @@ jobs:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: 'adopt' distribution: 'adopt'
java-version: '11' java-version: '17'
- name: Setup Gradle - name: Setup Gradle
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
- name: Clone repository
uses: GuillaumeFalourd/clone-github-repo-action@main
with: with:
branch: 'master' cache-disabled: true
owner: 'TopchetoEU' gradle-version: "8.10"
repository: 'java-jscript'
- name: Build - name: Build
run: | run: gradle build
cd java-jscript; gradle build - name: Create release
uses: "https://gitea.com/actions/gitea-release-action@main"
- uses: "marvinpinto/action-automatic-releases@latest"
with: with:
repo_token: "${{ secrets.GITHUB_TOKEN }}" # api_key: "${{secrets.TOKEN}}"
prerelease: false
files: | files: |
java-jscript/LICENSE LICENSE
java-jscript/build/libs/*.jar build/libs/*.jar

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@
!/package.json !/package.json
!/rollup.config.js !/rollup.config.js
!/tsconfig.json

View File

@@ -1,10 +1,8 @@
# JScript # J2S (Java-JavaScript or Java to JavaScript)
**NOTE: This had nothing to do with Microsoft's dialect of EcmaScript**
**WARNING: Currently, this code is undocumented. Proceed with caution and a psychiatrist.** **WARNING: Currently, this code is undocumented. Proceed with caution and a psychiatrist.**
JScript is an engine, capable of running EcmaScript 5, written entirely in Java. This engine has been developed with the goal of being easy to integrate with your preexisting codebase, **THE GOAL OF THIS ENGINE IS NOT PERFORMANCE**. My crude experiments show that this engine is 50x-100x slower than V8, which, although bad, is acceptable for most simple scripting purposes. Note that although the codebase has a Main class, this isn't meant to be a standalone program, but instead a library for running JavaScript code. J2S is an engine, capable of running EcmaScript 5, written entirely in Java. This engine has been developed with the goal of being easy to integrate with your preexisting codebase, **THE GOAL OF THIS ENGINE IS NOT PERFORMANCE**. My crude experiments show that this engine is 50x-100x slower than V8, which, although bad, is acceptable for most simple scripting purposes. Note that although the codebase has a Main class, this isn't meant to be a standalone program, but instead a library for running JavaScript code.
## Example ## Example

View File

@@ -22,6 +22,8 @@ node {
} }
task compileEnv(type: NpmTask) { task compileEnv(type: NpmTask) {
dependsOn npmInstall;
inputs.files('rollup.config.js'); inputs.files('rollup.config.js');
inputs.dir('src/lib/libs'); inputs.dir('src/lib/libs');
outputs.files("build/js/env.js"); outputs.files("build/js/env.js");
@@ -30,6 +32,8 @@ task compileEnv(type: NpmTask) {
args = ['run', 'build-env']; args = ['run', 'build-env'];
} }
task compileTypescript(type: NpmTask) { task compileTypescript(type: NpmTask) {
dependsOn npmInstall;
inputs.files('rollup.config.js'); inputs.files('rollup.config.js');
inputs.dir('src/lib/transpiler'); inputs.dir('src/lib/transpiler');
outputs.files("build/js/ts.js"); outputs.files("build/js/ts.js");

View File

@@ -1,4 +1,4 @@
project_group = me.topchetoeu project_group = me.topchetoeu
project_name = jscript project_name = j2s
project_version = 0.9.41-beta project_version = 0.10.2-beta
main_class = me.topchetoeu.jscript.repl.SimpleRepl main_class = me.topchetoeu.j2s.repl.SimpleRepl

View File

@@ -7,7 +7,7 @@ const nodeResolve = require("@rollup/plugin-node-resolve");
const json = require("@rollup/plugin-json"); const json = require("@rollup/plugin-json");
const { resolve } = require("path"); const { resolve } = require("path");
const shouldMinify = () => false; const shouldMinify = () => true;
const shouldEmitSourcemaps = () => true; const shouldEmitSourcemaps = () => true;
const shouldPolyfill = () => !!process.env.POLYFILLS; const shouldPolyfill = () => !!process.env.POLYFILLS;
@@ -99,6 +99,7 @@ const construct = (input, output) => defineConfig({
shouldMinify() && terser({ shouldMinify() && terser({
sourceMap: shouldEmitSourcemaps(), sourceMap: shouldEmitSourcemaps(),
keep_classnames: true, keep_classnames: true,
keep_fnames: true,
}), }),
], ],
output: { output: {

View File

@@ -1,21 +1,25 @@
import { object, setGlobalPrototypes, target } from "./primordials.ts"; import { object, setGlobalPrototypes, target } from "./primordials.ts";
import { Error, RangeError, SyntaxError, TypeError } from "./errors.ts"; import { Error, RangeError, SyntaxError, TypeError } from "./values/errors.ts";
import { Boolean } from "./boolean.ts"; import { Boolean } from "./values/boolean.ts";
import { Function } from "./function.ts"; import { Function } from "./values/function.ts";
import { Number } from "./number.ts"; import { Number } from "./values/number.ts";
import { Object } from "./object.ts"; import { Object } from "./values/object.ts";
import { String } from "./string.ts"; import { String } from "./values/string.ts";
import { Symbol } from "./symbol.ts"; import { Symbol } from "./values/symbol.ts";
import { Array } from "./array.ts"; import { Array } from "./values/array.ts";
import { Map, WeakMap } from "./map.ts"; import { Map, WeakMap } from "./classes/map.ts";
import { RegExp } from "./regex.ts"; import { RegExp } from "./values/regex.ts";
import { Date } from "./date.ts"; import { Date } from "./classes/date.ts";
import { Math as _Math } from "./math.ts"; import { Math as _Math } from "./namespaces/math.ts";
import { Set, WeakSet } from "./set.ts"; import { Set, WeakSet } from "./classes/set.ts";
import { JSON } from "./json.ts"; import { JSON } from "./namespaces/json.ts";
import { console } from "./console.ts"; import { console } from "./namespaces/console.ts";
import { encodeURI, encodeURIComponent } from "./url.ts"; import { encodeURI, encodeURIComponent } from "./url.ts";
import { Promise } from "./promise.ts"; import { Promise } from "./classes/promise.ts";
import { ArrayBuffer } from "./arrays/ArrayBuffer.ts";
import { Uint8Array } from "./arrays/Uint8Array.ts";
import { Int32Array } from "./arrays/Int32Array.ts";
import { TypedArray } from "./arrays/TypedArray.ts";
declare global { declare global {
function print(...args: any[]): void; function print(...args: any[]): void;
@@ -46,6 +50,11 @@ target.RangeError = RangeError;
target.SyntaxError = SyntaxError; target.SyntaxError = SyntaxError;
target.TypeError = TypeError; target.TypeError = TypeError;
fixup(TypedArray);
target.ArrayBuffer = fixup(ArrayBuffer);
target.Uint8Array = Uint8Array;
target.Int32Array = Int32Array;
target.Map = fixup(Map); target.Map = fixup(Map);
target.WeakMap = fixup(WeakMap); target.WeakMap = fixup(WeakMap);
target.Set = fixup(Set); target.Set = fixup(Set);
@@ -56,7 +65,6 @@ target.Promise = fixup(Promise);
target.Math = object.setPrototype(_Math, Object.prototype); target.Math = object.setPrototype(_Math, Object.prototype);
target.JSON = object.setPrototype(JSON, Object.prototype); target.JSON = object.setPrototype(JSON, Object.prototype);
target.console = object.setPrototype(console, Object.prototype); target.console = object.setPrototype(console, Object.prototype);
target.TYPED_ARRAY_SUPPORT = false;
target.parseInt = Number.parseInt; target.parseInt = Number.parseInt;
target.parseFloat = Number.parseFloat; target.parseFloat = Number.parseFloat;
@@ -77,5 +85,7 @@ setGlobalPrototypes({
syntax: SyntaxError.prototype, syntax: SyntaxError.prototype,
range: RangeError.prototype, range: RangeError.prototype,
type: TypeError.prototype, type: TypeError.prototype,
uint8: Uint8Array.prototype,
int32: Int32Array.prototype,
regex: RegExp, regex: RegExp,
}); });

View File

@@ -0,0 +1,30 @@
import { buffer, type InternalBuffer, map, symbol } from "../primordials.ts";
export const abs = new map(true);
export const abKey: unique symbol = symbol.getSymbol("ArrayBuffer.impl") as any;
export class ArrayBuffer {
public [abKey]!: InternalBuffer;
public get byteLength() {
return this[abKey].length;
}
public get byteOffset() {
return 0;
}
public constructor(val: unknown) {
if (buffer.isBuff(val)) this[abKey] = val;
else this[abKey] = buffer.buff(Number(val));
}
}
export function getAB(buff: InternalBuffer): ArrayBuffer {
let res = abs.get(buff);
if (res == null) {
res = new ArrayBuffer(buff);
abs.set(buff, res);
}
return res;
}

View File

@@ -0,0 +1,25 @@
import { buffer } from "../primordials.ts";
import { abstractIgnore, TypedArray, typedArrayFuncs } from "./TypedArray.ts";
const factory = buffer.int32;
const funcs = typedArrayFuncs(4, factory);
export class Int32Array extends TypedArray {
public subarray(this: number[], start?: number, end?: number) {
return funcs.subarray(this, start, end);
}
public slice(this: any[], start?: number, end?: number) {
return funcs.slice(this, start, end);
}
public map(this: any[], cb: (val: number, i: number, self: any) => number, self?: any) {
return funcs.map(this, cb, self);
}
public filter(this: any[], cb: (val: number, i: number, self: any) => boolean, self?: any) {
return funcs.filter(this, cb, self);
}
public constructor(obj: any, start?: number, end?: number) {
super(abstractIgnore);
return funcs.construct(obj, start, end) as any;
}
}

View File

@@ -0,0 +1,220 @@
import { buffer, func, type InternalBuffer, object, string, symbol } from "../primordials.ts";
import { symbols, wrapI } from "../utils.ts";
import { Error, TypeError } from "../values/errors.ts";
import { abKey, ArrayBuffer, getAB } from "./ArrayBuffer.ts";
export const abstractIgnore = symbol.getSymbol("TypedArray.abstractIgnore");
export function typedArrayFuncs(perEl: number, constructor: (buff: InternalBuffer, start: number, end: number) => number[]) {
return {
map(self: number[], cb: (val: number, i: number, self: number[]) => number, fnSelf: any) {
const res = constructor(buffer.buff(self.length * perEl), 0, self.length);
for (let i = 0; i < self.length; i++) {
res[i] = func.invoke(cb, fnSelf, [self[i], i, self]);
}
return res;
},
filter(self: number[], cb: (val: number, i: number, self: number[]) => boolean, fnSelf: any) {
const bigger = constructor(buffer.buff(self.length * perEl), 0, self.length);
let j = 0;
for (let i = 0; i < self.length; i++) {
if (func.invoke(cb, self, [self[i], i, fnSelf])) bigger[j++] = self[i];
}
const res = constructor(buffer.buff(j * perEl), 0, j);
for (let i = 0; i < j; i++) res[i] = bigger[i];
return res;
},
slice(self: number[], start = 0, end = self.length) {
start = wrapI(start, self.length);
end = wrapI(end, self.length);
if (end <= start) return constructor(buffer.buff(0), 0, 0);
const res = constructor(buffer.buff((end - start) * perEl), 0, end - start);
for (let i = 0; i < end - start; i++) {
res[i] = self[start + i];
}
return res;
},
subarray(self: number[], start = 0, end = self.length) {
start = wrapI(start, self.length);
end = wrapI(end, self.length);
if (end <= start) return constructor(buffer.buff(0), 0, 0);
const offset = buffer.start(self);
return constructor(buffer.backer(self), offset + start, offset + end);
},
construct(self: ArrayBuffer | number[] | number | Iterable<number>, start?: number, end?: number) {
if (typeof self === "number") {
return constructor(buffer.buff(self * perEl), 0, self);
}
if (self instanceof ArrayBuffer) {
const internal = self[abKey];
if (start === undefined) start = 0;
if (end === undefined) end = (internal.length / perEl) | 0;
return constructor(internal, start, end);
}
if (symbols.iterator in self && typeof self[symbols.iterator] === "function") {
const arr: number[] = [];
let i = 0;
const gen: Iterator<number> = self[symbols.iterator]();
for (let it = gen.next(); !it.done; it = gen.next()) {
arr[i++] = Number(it.value);
}
const res = constructor(buffer.buff(i * perEl), 0, i);
for (let j = 0; j < i; j++) res[j] = arr[j];
return res;
}
const res = constructor(buffer.buff((self as number[]).length * perEl), 0, (self as number[]).length);
for (let i = 0; i < (self as number[]).length; i++) res[i] = (self as number[])[i];
return res;
},
byteOffset(self: number[]) {
return buffer.start(self) * perEl;
},
byteLength(self: number[]) {
return (buffer.end(self) - buffer.start(self)) * perEl;
},
};
}
export class TypedArray {
public get buffer() {
return getAB(buffer.backer(this as any));
}
public get byteOffset(): number {
throw new Error("abstract");
}
public get byteLength(): number {
throw new Error("abstract");
}
public forEach(this: number[], cb: (val: number, i: number, self: this) => void, self?: any) {
for (let i = 0; i < this.length; i++) {
if (i in this) func.invoke(cb, self, [this[i], i, this]);
}
}
public join(this: number[], delim = ",") {
delim = String(delim);
const parts = [];
if (delim) {
for (let i = 0; i < this.length; i++) {
if (i) parts[parts.length] = delim;
parts[parts.length] = (i in this) ? String(this[i]) : "";
}
}
else {
for (let i = 0; i < this.length; i++) {
parts[i] = (i in this) ? String(this[i]) : "";
}
}
return string.stringBuild(parts);
}
public subarray(this: number[], start = 0, end = this.length) {
throw new Error("'slice' is an abstract method");
}
public slice(this: number[], start = 0, end = this.length) {
throw new Error("'slice' is an abstract method");
}
public map(this: number[], cb: (val: number, i: number, self: this) => number, self?: any) {
throw new Error("'map' is an abstract method");
}
public filter(this: number[], cb: (val: number, i: number, self: this) => boolean, self?: any) {
throw new Error("'filter' is an abstract method");
}
public reduce(this: number[], cb: (a: number, b: number, i: number, self: number[]) => number, initial?: number) {
let i = 0;
if (arguments.length <= 1) initial = this[i++];
for (; i < this.length; i++) {
initial = cb(initial!, this[i], i, this);
}
return initial;
}
public some(this: number[], cb: (val: number, i: number, self: number[]) => boolean, self?: any) {
for (let i = 0; i < this.length; i++) {
if (func.invoke(cb, self, [this[i], i, this])) return true;
}
return false;
}
public every(this: number[], cb: (val: number, i: number, self: number[]) => boolean, self?: any) {
for (let i = 0; i < this.length; i++) {
if (!func.invoke(cb, self, [this[i], i, this])) return false;
}
return true;
}
public find(this: number[], cb: (val: number, i: number, self: number[]) => boolean, self?: any) {
for (let i = 0; i < this.length; i++) {
if (func.invoke(cb, self, [this[i], i, this])) return this[i];
}
return undefined;
}
public indexOf(this: number[], val: number, start = 0) {
start |= 0;
if (start < 0) start = 0;
for (let i = start; i < this.length; i++) {
if (this[i] === val) return i;
}
return -1;
}
public lastIndexOf(this: number[], val: number, start = 0) {
start |= 0;
if (start < 0) start = 0;
for (let i = this.length - 1; i >= start; i--) {
if (this[i] === val) return i;
}
return -1;
}
public includes(this: number[], val: number) {
for (let i = 0; i < this.length; i++) {
if (this[i] === val) return i;
}
return false;
}
public sort(this: number[], cb?: (a: number, b: number) => number) {
cb ||= (a, b) => a - b;
return object.sort(this, cb);
}
public reverse(this: number[]) {
const mid = this.length >> 1;
const end = this.length - 1;
for (let i = 0; i < mid; i++) {
const tmp = this[i];
this[i] = this[end - i];
this[end - i] = tmp;
}
return this;
}
public constructor(token?: typeof abstractIgnore) {
if (token !== abstractIgnore) {
throw new TypeError("TypedArray constructor can't be called");
}
}
}

View File

@@ -0,0 +1,32 @@
import { buffer } from "../primordials.ts";
import { abstractIgnore, TypedArray, typedArrayFuncs } from "./TypedArray.ts";
const factory = buffer.uint8;
const funcs = typedArrayFuncs(1, factory);
export class Uint8Array extends TypedArray {
public override get byteOffset() {
return funcs.byteOffset(this as any);
}
public override get byteLength() {
return funcs.byteLength(this as any);
}
public override subarray(this: number[], start?: number, end?: number) {
return funcs.subarray(this, start, end);
}
public override slice(this: any[], start?: number, end?: number) {
return funcs.slice(this, start, end);
}
public override map(this: any[], cb: (val: number, i: number, self: any) => number, self?: any) {
return funcs.map(this, cb, self);
}
public override filter(this: any[], cb: (val: number, i: number, self: any) => boolean, self?: any) {
return funcs.filter(this, cb, self);
}
public constructor(obj: any, start?: number, end?: number) {
super(abstractIgnore);
return funcs.construct(obj, start, end) as any;
}
}

View File

@@ -1,4 +1,4 @@
import { now, symbol } from "./primordials.ts"; import { now, symbol } from "../primordials.ts";
const timeKey: unique symbol = symbol.makeSymbol("") as any; const timeKey: unique symbol = symbol.makeSymbol("") as any;

View File

@@ -1,6 +1,6 @@
import { Array } from "./array.ts"; import { Array } from "../values/array.ts";
import { func, map, symbol } from "./primordials.ts"; import { func, map, symbol } from "../primordials.ts";
import { symbols } from "./utils.ts"; import { symbols } from "../utils.ts";
const mapKey: unique symbol = symbol.makeSymbol("Map.impl") as any; const mapKey: unique symbol = symbol.makeSymbol("Map.impl") as any;

View File

@@ -1,4 +1,4 @@
import { func, next, object, symbol } from "./primordials.ts"; import { func, next, object, symbol } from "../primordials.ts";
enum PromiseState { enum PromiseState {
Pending = "pend", Pending = "pend",

View File

@@ -1,6 +1,6 @@
import { Array } from "./array.ts"; import { Array } from "../values/array.ts";
import { func, map, symbol } from "./primordials.ts"; import { func, map, symbol } from "../primordials.ts";
import { symbols } from "./utils.ts"; import { symbols } from "../utils.ts";
const mapKey: unique symbol = symbol.makeSymbol("Set.impl") as any; const mapKey: unique symbol = symbol.makeSymbol("Set.impl") as any;

View File

@@ -1,4 +1,4 @@
import { func, json, object } from "./primordials"; import { func, json, object } from "../primordials.ts";
export const console = {}; export const console = {};

View File

@@ -1,4 +1,4 @@
import { json, object } from "./primordials"; import { json, object } from "../primordials.ts";
export const JSON = {}; export const JSON = {};

View File

@@ -1,4 +1,4 @@
import { number, object } from "./primordials"; import { number, object } from "../primordials.ts";
export const Math = {}; export const Math = {};

View File

@@ -1,2 +1 @@
export default function _possibleConstructorReturn() { export default function _possibleConstructorReturn(_, res) { return res; }
}

View File

@@ -1,3 +1,10 @@
const buffSymbol: unique symbol = undefined as any;
export interface InternalBuffer {
length: number;
[buffSymbol]: "buffer";
}
export interface SymbolPrimordials { export interface SymbolPrimordials {
makeSymbol(name: string): symbol; makeSymbol(name: string): symbol;
getSymbol(name: string): symbol; getSymbol(name: string): symbol;
@@ -46,6 +53,22 @@ export interface ObjectPrimordials {
memcpy(src: any[], dst: any[], srcI: number, dstI: number, n: number): void; memcpy(src: any[], dst: any[], srcI: number, dstI: number, n: number): void;
sort(arr: any[], cb: Function): any[]; sort(arr: any[], cb: Function): any[];
} }
export interface BufferPrimordials {
buff(n: number): InternalBuffer;
backer(arr: number[]): InternalBuffer;
start(arr: number[]): number;
end(arr: number[]): number;
uint8(buff: InternalBuffer, start: number, end: number): number[];
int8(buff: InternalBuffer, start: number, end: number): number[];
int32(buff: InternalBuffer, start: number, end: number): number[];
isUint8(val: any): val is number[];
isInt8(val: any): val is number[];
isInt32(val: any): val is number[];
is(val: any): val is number[];
isBuff(val: any): val is InternalBuffer;
}
export interface FunctionPrimordials { export interface FunctionPrimordials {
invokeType(args: IArguments, self: any): "new" | "call"; invokeType(args: IArguments, self: any): "new" | "call";
invokeTypeInfer(): "new" | "call"; invokeTypeInfer(): "new" | "call";
@@ -67,6 +90,7 @@ export interface Primordials {
object: ObjectPrimordials; object: ObjectPrimordials;
function: FunctionPrimordials; function: FunctionPrimordials;
json: JSONPrimordials; json: JSONPrimordials;
buffer: BufferPrimordials;
map: new (weak?: boolean) => { map: new (weak?: boolean) => {
get(key: any): any; get(key: any): any;
has(key: any): boolean; has(key: any): boolean;
@@ -88,7 +112,8 @@ export interface Primordials {
schedule(func: () => void, delay: number): () => void; schedule(func: () => void, delay: number): () => void;
} }
globalThis.undefined = void 0; // prevent optimization to "undefined", which doesn't exist yet
globalThis.undefined = ({} as any).bogus;
export const target = (globalThis as any).target; export const target = (globalThis as any).target;
export const primordials: Primordials = (globalThis as any).primordials; export const primordials: Primordials = (globalThis as any).primordials;
@@ -97,6 +122,7 @@ export const {
number, number,
string, string,
object, object,
buffer,
function: func, function: func,
json, json,
map, map,

View File

@@ -25,7 +25,7 @@ export interface TypeMap {
export function unwrapThis<T extends keyof TypeMap>(self: any, type: T, constr: Function, name: string, arg = "this", defaultVal?: TypeMap[T]): TypeMap[T] { export function unwrapThis<T extends keyof TypeMap>(self: any, type: T, constr: Function, name: string, arg = "this", defaultVal?: TypeMap[T]): TypeMap[T] {
if (typeof self === type) return self; if (typeof self === type) return self;
if (self instanceof constr && valueKey in self) self = (self as any)[valueKey]; if (self instanceof constr && valueKey in self) self = self[valueKey];
if (typeof self === type) return self; if (typeof self === type) return self;
if (defaultVal !== undefined) return defaultVal; if (defaultVal !== undefined) return defaultVal;
throw new TypeError(name + " requires that '" + arg + "' be a " + constr.name); throw new TypeError(name + " requires that '" + arg + "' be a " + constr.name);

View File

@@ -1,7 +1,7 @@
import { Error } from "./errors.ts"; import { Error } from "../values/errors.ts";
import { func, object, string } from "./primordials.ts"; import { func, object, string } from "../primordials.ts";
import { String } from "./string.ts"; import { String } from "../values/string.ts";
import { limitI, symbols, wrapI } from "./utils.ts"; import { limitI, symbols, wrapI } from "../utils.ts";
export const Array = (() => { export const Array = (() => {
class Array { class Array {
@@ -33,7 +33,7 @@ export const Array = (() => {
for (let i = arguments.length - 1; i >= 0; i--) { for (let i = arguments.length - 1; i >= 0; i--) {
this[start + i] = arguments[i]; this[start + i] = arguments[i];
} }
return arguments.length; return this.length;
} }
public pop(this: any[]) { public pop(this: any[]) {
if (this.length === 0) return undefined; if (this.length === 0) return undefined;
@@ -51,7 +51,7 @@ export const Array = (() => {
for (let i = 0; i < arguments.length; i++) { for (let i = 0; i < arguments.length; i++) {
this[i] = arguments[i]; this[i] = arguments[i];
} }
return arguments.length; return this.length;
} }
public shift(this: any[]) { public shift(this: any[]) {
if (this.length === 0) return undefined; if (this.length === 0) return undefined;
@@ -71,7 +71,7 @@ export const Array = (() => {
const res: any[] = []; const res: any[] = [];
function add(arr: any) { function add(arr: any) {
if (Array.isArray(arr) || symbols.isConcatSpreadable in arr) { if (Array.isArray(arr) || arr != null && typeof arr === "object" && symbols.isConcatSpreadable in arr) {
const start = res.length; const start = res.length;
res.length += arr.length; res.length += arr.length;
@@ -209,7 +209,7 @@ export const Array = (() => {
} }
public includes(this: any[], val: any) { public includes(this: any[], val: any) {
for (let i = 0; i < this.length; i++) { for (let i = 0; i < this.length; i++) {
if (i in this && this[i] === val) return i; if (i in this && this[i] === val) return true;
} }
return false; return false;

View File

@@ -1,5 +1,5 @@
import { func } from "./primordials.ts"; import { func } from "../primordials.ts";
import { unwrapThis, valueKey } from "./utils.ts"; import { unwrapThis, valueKey } from "../utils.ts";
export const Boolean = (() => { export const Boolean = (() => {
class Boolean { class Boolean {

View File

@@ -1,4 +1,4 @@
import { func, object } from "./primordials.ts"; import { func, object } from "../primordials.ts";
import { String } from "./string.ts"; import { String } from "./string.ts";
export class Error { export class Error {

View File

@@ -1,4 +1,4 @@
import { compile, func, string } from "./primordials.ts"; import { compile, func, string } from "../primordials.ts";
import { String } from "./string.ts"; import { String } from "./string.ts";
export const Function = (() => { export const Function = (() => {

View File

@@ -1,5 +1,5 @@
import { func, number, object } from "./primordials.ts"; import { func, number, object } from "../primordials.ts";
import { unwrapThis, valueKey } from "./utils.ts"; import { unwrapThis, valueKey } from "../utils.ts";
export const Number = (() => { export const Number = (() => {
class Number { class Number {

View File

@@ -1,10 +1,10 @@
import { Boolean } from "./boolean.ts"; import { Boolean } from "./boolean.ts";
import { TypeError } from "./errors.ts"; import { TypeError } from "./errors.ts";
import { Number } from "./number.ts"; import { Number } from "./number.ts";
import { func, object } from "./primordials.ts"; import { func, object } from "../primordials.ts";
import { String } from "./string.ts"; import { String } from "./string.ts";
import { symbols, valueKey } from "./utils.ts"; import { symbols, valueKey } from "../utils.ts";
import { Symbol } from "./symbol.ts"; import { Symbol } from "../values/symbol.ts";
export const Object = (() => { export const Object = (() => {
class Object { class Object {
@@ -29,6 +29,13 @@ export const Object = (() => {
return object.getOwnMember(this, key) != null; return object.getOwnMember(this, key) != null;
} }
public get __proto__() {
return object.getPrototype(this);
}
public set __proto__(val) {
object.setPrototype(this, val);
}
public constructor (value?: unknown) { public constructor (value?: unknown) {
if (typeof value === 'object' && value !== null) return value as any; if (typeof value === 'object' && value !== null) return value as any;
if (typeof value === 'string') return new String(value) as any; if (typeof value === 'string') return new String(value) as any;
@@ -75,13 +82,13 @@ export const Object = (() => {
res.s = set; res.s = set;
} }
if ("enumerable" in desc) res.e = !!desc.enumerable; if ("enumerable" in desc) res.e = !!desc.enumerable;
if ("configurable" in desc) res.e = !!desc.configurable; if ("configurable" in desc) res.c = !!desc.configurable;
if (!object.defineProperty(obj, key, res)) throw new TypeError("Cannot redefine property: " + String(key)); if (!object.defineProperty(obj, key, res)) throw new TypeError("Cannot redefine property: " + String(key));
} }
else { else {
if ("enumerable" in desc) res.e = !!desc.enumerable; if ("enumerable" in desc) res.e = !!desc.enumerable;
if ("configurable" in desc) res.e = !!desc.configurable; if ("configurable" in desc) res.c = !!desc.configurable;
if ("writable" in desc) res.w = !!desc.writable; if ("writable" in desc) res.w = !!desc.writable;
if ("value" in desc) res.v = desc.value; if ("value" in desc) res.v = desc.value;
@@ -190,6 +197,7 @@ export const Object = (() => {
} }
} }
object.defineProperty(Object.prototype, "__proto__", { e: false });
object.setPrototype(Object.prototype, undefined); object.setPrototype(Object.prototype, undefined);
func.setCallable(Object, true); func.setCallable(Object, true);

View File

@@ -1,9 +1,9 @@
import { func, regex, symbol } from "./primordials.ts"; import { func, regex, symbol } from "../primordials.ts";
import { String } from "./string.ts"; import { String } from "./string.ts";
import { type ReplaceRange } from "./utils.ts"; import { type ReplaceRange } from "../utils.ts";
import { applyReplaces } from "./utils.ts"; import { applyReplaces } from "../utils.ts";
import { applySplits } from "./utils.ts"; import { applySplits } from "../utils.ts";
import { symbols } from "./utils.ts"; import { symbols } from "../utils.ts";
const regexKey: unique symbol = symbol.makeSymbol("RegExp.impl") as any; const regexKey: unique symbol = symbol.makeSymbol("RegExp.impl") as any;

View File

@@ -1,7 +1,7 @@
import { TypeError } from "./errors.ts"; import { TypeError } from "./errors.ts";
import { func, number, regex, string } from "./primordials.ts"; import { func, number, regex, string } from "../primordials.ts";
import { RegExp } from "./regex.ts"; import { RegExp } from "./regex.ts";
import { applyReplaces, applySplits, limitI, type ReplaceRange, symbols, unwrapThis, valueKey, wrapI } from "./utils.ts"; import { applyReplaces, applySplits, limitI, type ReplaceRange, symbols, unwrapThis, valueKey, wrapI } from "../utils.ts";
const trimStartRegex = new regex("^\\s+", false, false, false, false, false); const trimStartRegex = new regex("^\\s+", false, false, false, false, false);
const trimEndRegex = new regex("\\s+$", false, false, false, false, false); const trimEndRegex = new regex("\\s+$", false, false, false, false, false);
@@ -41,8 +41,9 @@ export const String = (() => {
offset = +offset; offset = +offset;
return string.indexOf(self, search, offset, false); return string.indexOf(self, search, offset, false);
} }
public lastIndexOf(search: string, offset = 0) { public lastIndexOf(search: string, offset?: number) {
const self = unwrapThis(this, "string", String, "String.prototype.lastIndexOf"); const self = unwrapThis(this, "string", String, "String.prototype.lastIndexOf");
if (offset == null) offset = self.length;
offset = +offset; offset = +offset;
return string.indexOf(self, search, offset, true); return string.indexOf(self, search, offset, true);
} }

View File

@@ -1,5 +1,5 @@
import { func, object, symbol } from "./primordials.ts"; import { func, object, symbol } from "../primordials.ts";
import { symbols, unwrapThis, valueKey } from "./utils.ts"; import { symbols, unwrapThis, valueKey } from "../utils.ts";
export const Symbol = (() => { export const Symbol = (() => {
class Symbol { class Symbol {

View File

@@ -1,6 +1,5 @@
import { SourceMap } from "./map.ts"; import { SourceMap } from "./map.ts";
import { transform } from "@babel/standalone"; import { transform, availablePresets } from "@babel/standalone";
// import presetEnv from "@babel/preset-env";
export default function babel(next: Compiler): Compiler { export default function babel(next: Compiler): Compiler {
print("Loaded babel!"); print("Loaded babel!");
@@ -9,6 +8,7 @@ export default function babel(next: Compiler): Compiler {
const res = transform(code, { const res = transform(code, {
filename, filename,
sourceMaps: true, sourceMaps: true,
presets: [availablePresets.env],
}); });
const map = SourceMap.parse({ const map = SourceMap.parse({
@@ -17,9 +17,8 @@ export default function babel(next: Compiler): Compiler {
sources: [filename], sources: [filename],
}); });
const compiled = next("babel-internal://" + filename, res.code!, SourceMap.chain(map, prevMap));
registerSource(filename, code); registerSource(filename, code);
return compiled; return next("babel-internal://" + filename, res.code!, SourceMap.chain(map, prevMap));
}; };
} }

View File

@@ -20,9 +20,8 @@ export default function coffee(next: Compiler): Compiler {
sources: [filename], sources: [filename],
}); });
const compiled = next("coffee-internal://" + filename, result, SourceMap.chain(map, prevMap));
registerSource(filename, code); registerSource(filename, code);
return compiled; return next("coffee-internal://" + filename, result, SourceMap.chain(map, prevMap));
}; };
} }

View File

@@ -6,15 +6,24 @@ for (let i = 97; i <= 122; i++) map[i] = j++;
map[43] = j++; map[43] = j++;
map[47] = j++; map[47] = j++;
export type Location = readonly [file: string, line: number, start: number];
export function decodeVLQ(val: string): number[][][] { export function decodeVLQ(val: string): number[][][] {
const lines: number[][][] = []; const lines: number[][][] = [];
for (const line of val.split(";", -1)) { const fileParts = val.split(";", -1);
const elements: number[][] = [];
for (let i = 0; i < fileParts.length; i++) {
const line = fileParts[i];
if (line.length === 0) {
lines.push([]);
continue;
}
const elements: number[][] = [];
const lineParts = line.split(",", -1);
for (let i = 0; i < lineParts.length; i++) {
const el = lineParts[i];
for (const el of line.split(",", -1)) {
if (el.length === 0) elements.push([]); if (el.length === 0) elements.push([]);
else { else {
const list: number[] = []; const list: number[] = [];
@@ -72,10 +81,6 @@ export namespace Location {
} }
} }
export interface SourceMap {
(loc: Location): Location | undefined;
}
export class VLQSourceMap { export class VLQSourceMap {
public constructor( public constructor(
public readonly array: Map<string, [start: number, dst: Location][][]>, public readonly array: Map<string, [start: number, dst: Location][][]>,
@@ -98,7 +103,7 @@ export class VLQSourceMap {
const mid = (a + b) >> 1; const mid = (a + b) >> 1;
const el = line[mid]; const el = line[mid];
const cmp = el[0] - src[1]; const cmp = el[0] - src[2];
if (cmp < 0) { if (cmp < 0) {
if (done) { if (done) {
@@ -132,10 +137,13 @@ export class VLQSourceMap {
const lastCols = new Set<number>(); const lastCols = new Set<number>();
for (let compiledRow = 0; compiledRow < mapping.length; compiledRow++) { for (let compiledRow = 0; compiledRow < mapping.length; compiledRow++) {
const line = file[compiledRow] ??= []; const line: [start: number, dst: Location][] = file[compiledRow] = [];
let compiledCol = 0; let compiledCol = 0;
for (const rawSeg of mapping[compiledRow]) { const rowData = mapping[compiledRow];
for (let i = 0; i < rowData.length; i++) {
const rawSeg = rowData[i];
compiledCol += rawSeg.length > 0 ? rawSeg[0] : 0; compiledCol += rawSeg.length > 0 ? rawSeg[0] : 0;
originalFile += rawSeg.length > 1 ? rawSeg[1] : 0; originalFile += rawSeg.length > 1 ? rawSeg[1] : 0;
originalRow += rawSeg.length > 2 ? rawSeg[2] : 0; originalRow += rawSeg.length > 2 ? rawSeg[2] : 0;

10
src/lib/transpiler/transpiler.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
type Location = [file: string, line: number, start: number];
type SourceMap = (loc: Location) => Location | undefined;
type CompilerFactory = (next: Compiler) => Compiler;
type Compiler = (filename: string, src: string, mapper: SourceMap) => (this: any, ...args: any[]) => any;
declare function getResource(name: string): string | undefined;
declare function print(...args: any[]): void;
declare function register(factory: CompilerFactory): void;
declare function registerSource(filename: string, src: string): void;

View File

@@ -1,10 +0,0 @@
import { type SourceMap } from "./map.ts";
declare global {
type CompilerFactory = (next: Compiler) => Compiler;
type Compiler = (filename: string, src: string, mapper: SourceMap) => Function;
function print(...args: any[]): void;
function register(factory: CompilerFactory): void;
function registerSource(filename: string, src: string): void;
}

View File

@@ -1,17 +1,8 @@
import { createDocumentRegistry, createLanguageService, ModuleKind, ScriptSnapshot, ScriptTarget, type Diagnostic, type CompilerOptions, type IScriptSnapshot, flattenDiagnosticMessageText, CompilerHost, LanguageService } from "typescript"; import { createDocumentRegistry, createLanguageService, ModuleKind, ScriptSnapshot, ScriptTarget, type Diagnostic, type CompilerOptions, type IScriptSnapshot, flattenDiagnosticMessageText, CompilerHost, LanguageService } from "typescript";
import { SourceMap } from "./map.ts"; import { SourceMap } from "./map.ts";
declare function getResource(name: string): string | undefined;
declare function print(...args: any[]): void;
declare function register(factory: CompilerFactory): void;
declare function registerSource(filename: string, src: string): void;
type CompilerFactory = (next: Compiler) => Compiler;
type Compiler = (filename: string, src: string, mapper: SourceMap) => Function;
const resources: Record<string, string | undefined> = {}; const resources: Record<string, string | undefined> = {};
function resource(name: string) { function resource(name: string) {
if (name in resources) return resources[name]; if (name in resources) return resources[name];
else return resources[name] = getResource(name); else return resources[name] = getResource(name);
@@ -115,8 +106,8 @@ export default function typescript(next: Compiler): Compiler {
const result = outputs["/src.js"]; const result = outputs["/src.js"];
const declaration = outputs["/src.d.ts"]; const declaration = outputs["/src.d.ts"];
const compiled = next("ts-internal://" + filename, result, SourceMap.chain(map, prevMap));
registerSource(filename, code); registerSource(filename, code);
const compiled = next("ts-internal://" + filename, result, SourceMap.chain(map, prevMap));
return function (this: any) { return function (this: any) {
const res = compiled.apply(this, arguments); const res = compiled.apply(this, arguments);

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common; package me.topchetoeu.j2s.common;
public class FunctionBody { public class FunctionBody {
public final FunctionBody[] children; public final FunctionBody[] children;

View File

@@ -1,10 +1,10 @@
package me.topchetoeu.jscript.common; package me.topchetoeu.j2s.common;
import java.util.HashMap; import java.util.HashMap;
import java.util.function.IntFunction; import java.util.function.IntFunction;
import java.util.function.IntSupplier; import java.util.function.IntSupplier;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
public class Instruction { public class Instruction {
public static enum Type { public static enum Type {

View File

@@ -1,6 +1,6 @@
package me.topchetoeu.jscript.common; package me.topchetoeu.j2s.common;
import me.topchetoeu.jscript.common.json.JSON; import me.topchetoeu.j2s.common.json.JSON;
public class Metadata { public class Metadata {
private static final String VERSION; private static final String VERSION;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common; package me.topchetoeu.j2s.common;
import java.util.HashMap; import java.util.HashMap;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common; package me.topchetoeu.j2s.common;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;

View File

@@ -1,6 +1,6 @@
package me.topchetoeu.jscript.common; package me.topchetoeu.j2s.common;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
public class SyntaxException extends RuntimeException { public class SyntaxException extends RuntimeException {
public final Location loc; public final Location loc;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.environment; package me.topchetoeu.j2s.common.environment;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;

View File

@@ -0,0 +1,3 @@
package me.topchetoeu.j2s.common.environment;
public final class Key<T> { }

View File

@@ -1,15 +1,16 @@
package me.topchetoeu.jscript.common.json; package me.topchetoeu.j2s.common.json;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import me.topchetoeu.jscript.common.SyntaxException; import me.topchetoeu.j2s.common.Metadata;
import me.topchetoeu.jscript.common.parsing.Filename; import me.topchetoeu.j2s.common.SyntaxException;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Filename;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.j2s.common.parsing.Source;
public class JSON { public class JSON {
public static ParseRes<JSONElement> parseString(Source src, int i) { public static ParseRes<JSONElement> parseString(Source src, int i) {
@@ -100,7 +101,7 @@ public class JSON {
return ParseRes.res(JSONElement.list(values), n); return ParseRes.res(JSONElement.list(values), n);
} }
public static JSONElement parse(Filename filename, String raw) { public static JSONElement parse(Filename filename, String raw) {
if (filename == null) filename = new Filename("jscript", "json"); if (filename == null) filename = new Filename(Metadata.name(), "json");
var res = parseValue(new Source(null, filename, raw), 0); var res = parseValue(new Source(null, filename, raw), 0);
if (res.isFailed()) throw new SyntaxException(Location.of(filename, 0, 0), "Invalid JSON given"); if (res.isFailed()) throw new SyntaxException(Location.of(filename, 0, 0), "Invalid JSON given");

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.json; package me.topchetoeu.j2s.common.json;
public class JSONElement { public class JSONElement {
public static enum Type { public static enum Type {

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.json; package me.topchetoeu.j2s.common.json;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.json; package me.topchetoeu.j2s.common.json;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.mapping; package me.topchetoeu.j2s.common.mapping;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@@ -13,9 +13,9 @@ import java.util.function.Function;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Filename; import me.topchetoeu.j2s.common.parsing.Filename;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
public class FunctionMap { public class FunctionMap {
public static class FunctionMapBuilder { public static class FunctionMapBuilder {

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.parsing; package me.topchetoeu.j2s.common.parsing;
import java.io.File; import java.io.File;

View File

@@ -1,10 +1,12 @@
package me.topchetoeu.jscript.common.parsing; package me.topchetoeu.j2s.common.parsing;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import me.topchetoeu.j2s.common.Metadata;
public abstract class Location implements Comparable<Location> { public abstract class Location implements Comparable<Location> {
public static final Location INTERNAL = Location.of(new Filename("jscript", "native"), -1, -1); public static final Location INTERNAL = Location.of(new Filename(Metadata.name(), "native"), -1, -1);
public abstract int line(); public abstract int line();
public abstract int start(); public abstract int start();

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.parsing; package me.topchetoeu.j2s.common.parsing;
public class ParseRes<T> { public class ParseRes<T> {
public static enum State { public static enum State {

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.parsing; package me.topchetoeu.j2s.common.parsing;
public interface Parser<T> { public interface Parser<T> {
public ParseRes<T> parse(Source src, int i); public ParseRes<T> parse(Source src, int i);

View File

@@ -1,7 +1,7 @@
package me.topchetoeu.jscript.common.parsing; package me.topchetoeu.j2s.common.parsing;
import me.topchetoeu.jscript.common.SyntaxException; import me.topchetoeu.j2s.common.SyntaxException;
import me.topchetoeu.jscript.compilation.values.constants.NumberNode; import me.topchetoeu.j2s.compilation.values.constants.NumberNode;
public class Parsing { public class Parsing {
public static boolean isDigit(Character c) { public static boolean isDigit(Character c) {

View File

@@ -1,8 +1,8 @@
package me.topchetoeu.jscript.common.parsing; package me.topchetoeu.j2s.common.parsing;
import java.util.function.Predicate; import java.util.function.Predicate;
import me.topchetoeu.jscript.common.environment.Environment; import me.topchetoeu.j2s.common.environment.Environment;
public class Source { public class Source {
public final Environment env; public final Environment env;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.common.parsing; package me.topchetoeu.j2s.common.parsing;
import java.util.Objects; import java.util.Objects;

View File

@@ -1,24 +1,25 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import me.topchetoeu.j2s.common.FunctionBody;
import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.j2s.common.environment.Environment;
import me.topchetoeu.j2s.common.environment.Key;
import me.topchetoeu.j2s.common.mapping.FunctionMap;
import me.topchetoeu.j2s.common.mapping.FunctionMap.FunctionMapBuilder;
import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.j2s.compilation.control.TryNode;
import me.topchetoeu.j2s.compilation.scope.FunctionScope;
import me.topchetoeu.j2s.compilation.scope.Variable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import me.topchetoeu.jscript.common.FunctionBody;
import me.topchetoeu.jscript.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.environment.Environment;
import me.topchetoeu.jscript.common.environment.Key;
import me.topchetoeu.jscript.common.mapping.FunctionMap;
import me.topchetoeu.jscript.common.mapping.FunctionMap.FunctionMapBuilder;
import me.topchetoeu.jscript.common.parsing.Location;
import me.topchetoeu.jscript.compilation.control.TryNode;
import me.topchetoeu.jscript.compilation.scope.FunctionScope;
import me.topchetoeu.jscript.compilation.scope.Variable;
public final class CompileResult { public final class CompileResult {
public static final Key<Void> DEBUG_LOG = new Key<>(); public static final Key<Void> DEBUG_LOG = new Key<>();

View File

@@ -1,15 +1,15 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
public class CompoundNode extends Node { public class CompoundNode extends Node {

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.function.IntSupplier; import java.util.function.IntSupplier;

View File

@@ -1,16 +1,16 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.List; import java.util.List;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.environment.Environment; import me.topchetoeu.j2s.common.environment.Environment;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.scope.FunctionScope; import me.topchetoeu.j2s.compilation.scope.FunctionScope;
import me.topchetoeu.jscript.compilation.values.VariableNode; import me.topchetoeu.j2s.compilation.values.VariableNode;
public abstract class FunctionNode extends Node { public abstract class FunctionNode extends Node {
public final CompoundNode body; public final CompoundNode body;

View File

@@ -1,12 +1,12 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.List; import java.util.List;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.compilation.scope.Variable; import me.topchetoeu.j2s.compilation.scope.Variable;
import me.topchetoeu.jscript.compilation.values.VariableNode; import me.topchetoeu.j2s.compilation.values.VariableNode;
public class FunctionStatementNode extends FunctionNode { public class FunctionStatementNode extends FunctionNode {
public final String name; public final String name;

View File

@@ -1,11 +1,11 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.List; import java.util.List;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.compilation.values.VariableNode; import me.topchetoeu.j2s.compilation.values.VariableNode;
public class FunctionValueNode extends FunctionNode { public class FunctionValueNode extends FunctionNode {
public final String name; public final String name;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@@ -6,45 +6,45 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import me.topchetoeu.jscript.common.SyntaxException; import me.topchetoeu.j2s.common.SyntaxException;
import me.topchetoeu.jscript.common.environment.Environment; import me.topchetoeu.j2s.common.environment.Environment;
import me.topchetoeu.jscript.common.environment.Key; import me.topchetoeu.j2s.common.environment.Key;
import me.topchetoeu.jscript.common.parsing.Filename; import me.topchetoeu.j2s.common.parsing.Filename;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.control.BreakNode; import me.topchetoeu.j2s.compilation.control.BreakNode;
import me.topchetoeu.jscript.compilation.control.ContinueNode; import me.topchetoeu.j2s.compilation.control.ContinueNode;
import me.topchetoeu.jscript.compilation.control.DebugNode; import me.topchetoeu.j2s.compilation.control.DebugNode;
import me.topchetoeu.jscript.compilation.control.DeleteNode; import me.topchetoeu.j2s.compilation.control.DeleteNode;
import me.topchetoeu.jscript.compilation.control.DoWhileNode; import me.topchetoeu.j2s.compilation.control.DoWhileNode;
import me.topchetoeu.jscript.compilation.control.ForInNode; import me.topchetoeu.j2s.compilation.control.ForInNode;
import me.topchetoeu.jscript.compilation.control.ForNode; import me.topchetoeu.j2s.compilation.control.ForNode;
import me.topchetoeu.jscript.compilation.control.IfNode; import me.topchetoeu.j2s.compilation.control.IfNode;
import me.topchetoeu.jscript.compilation.control.ReturnNode; import me.topchetoeu.j2s.compilation.control.ReturnNode;
import me.topchetoeu.jscript.compilation.control.SwitchNode; import me.topchetoeu.j2s.compilation.control.SwitchNode;
import me.topchetoeu.jscript.compilation.control.ThrowNode; import me.topchetoeu.j2s.compilation.control.ThrowNode;
import me.topchetoeu.jscript.compilation.control.TryNode; import me.topchetoeu.j2s.compilation.control.TryNode;
import me.topchetoeu.jscript.compilation.control.WhileNode; import me.topchetoeu.j2s.compilation.control.WhileNode;
import me.topchetoeu.jscript.compilation.scope.FunctionScope; import me.topchetoeu.j2s.compilation.scope.FunctionScope;
import me.topchetoeu.jscript.compilation.values.ArgumentsNode; import me.topchetoeu.j2s.compilation.values.ArgumentsNode;
import me.topchetoeu.jscript.compilation.values.ArrayNode; import me.topchetoeu.j2s.compilation.values.ArrayNode;
import me.topchetoeu.jscript.compilation.values.GlobalThisNode; import me.topchetoeu.j2s.compilation.values.GlobalThisNode;
import me.topchetoeu.jscript.compilation.values.ObjectNode; import me.topchetoeu.j2s.compilation.values.ObjectNode;
import me.topchetoeu.jscript.compilation.values.RegexNode; import me.topchetoeu.j2s.compilation.values.RegexNode;
import me.topchetoeu.jscript.compilation.values.ThisNode; import me.topchetoeu.j2s.compilation.values.ThisNode;
import me.topchetoeu.jscript.compilation.values.VariableNode; import me.topchetoeu.j2s.compilation.values.VariableNode;
import me.topchetoeu.jscript.compilation.values.constants.BoolNode; import me.topchetoeu.j2s.compilation.values.constants.BoolNode;
import me.topchetoeu.jscript.compilation.values.constants.NullNode; import me.topchetoeu.j2s.compilation.values.constants.NullNode;
import me.topchetoeu.jscript.compilation.values.constants.NumberNode; import me.topchetoeu.j2s.compilation.values.constants.NumberNode;
import me.topchetoeu.jscript.compilation.values.constants.StringNode; import me.topchetoeu.j2s.compilation.values.constants.StringNode;
import me.topchetoeu.jscript.compilation.values.operations.CallNode; import me.topchetoeu.j2s.compilation.values.operations.CallNode;
import me.topchetoeu.jscript.compilation.values.operations.ChangeNode; import me.topchetoeu.j2s.compilation.values.operations.ChangeNode;
import me.topchetoeu.jscript.compilation.values.operations.DiscardNode; import me.topchetoeu.j2s.compilation.values.operations.DiscardNode;
import me.topchetoeu.jscript.compilation.values.operations.IndexNode; import me.topchetoeu.j2s.compilation.values.operations.IndexNode;
import me.topchetoeu.jscript.compilation.values.operations.OperationNode; import me.topchetoeu.j2s.compilation.values.operations.OperationNode;
import me.topchetoeu.jscript.compilation.values.operations.PostfixNode; import me.topchetoeu.j2s.compilation.values.operations.PostfixNode;
import me.topchetoeu.jscript.compilation.values.operations.TypeofNode; import me.topchetoeu.j2s.compilation.values.operations.TypeofNode;
public final class JavaScript { public final class JavaScript {
public static enum DeclarationType { public static enum DeclarationType {

View File

@@ -1,15 +1,15 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.function.IntSupplier; import java.util.function.IntSupplier;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.SyntaxException; import me.topchetoeu.j2s.common.SyntaxException;
import me.topchetoeu.jscript.common.environment.Environment; import me.topchetoeu.j2s.common.environment.Environment;
import me.topchetoeu.jscript.common.environment.Key; import me.topchetoeu.j2s.common.environment.Key;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
public class LabelContext { public class LabelContext {
public static final Key<LabelContext> BREAK_CTX = new Key<>(); public static final Key<LabelContext> BREAK_CTX = new Key<>();

View File

@@ -1,7 +1,7 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
public abstract class Node { public abstract class Node {
private Location loc; private Location loc;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;

View File

@@ -1,6 +1,6 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
public final class Parameter { public final class Parameter {
public final Location loc; public final Location loc;

View File

@@ -1,16 +1,16 @@
package me.topchetoeu.jscript.compilation; package me.topchetoeu.j2s.compilation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.github.bsideup.jabel.Desugar; import com.github.bsideup.jabel.Desugar;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.values.VariableNode; import me.topchetoeu.j2s.compilation.values.VariableNode;
public class VariableDeclareNode extends Node { public class VariableDeclareNode extends Node {
@Desugar @Desugar

View File

@@ -1,15 +1,15 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.SyntaxException; import me.topchetoeu.j2s.common.SyntaxException;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class BreakNode extends Node { public class BreakNode extends Node {
public final String label; public final String label;

View File

@@ -1,15 +1,15 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.SyntaxException; import me.topchetoeu.j2s.common.SyntaxException;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class ContinueNode extends Node { public class ContinueNode extends Node {
public final String label; public final String label;

View File

@@ -1,13 +1,13 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class DebugNode extends Node { public class DebugNode extends Node {
@Override public void compileFunctions(CompileResult target) { @Override public void compileFunctions(CompileResult target) {

View File

@@ -1,16 +1,16 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
import me.topchetoeu.jscript.compilation.values.VariableNode; import me.topchetoeu.j2s.compilation.values.VariableNode;
import me.topchetoeu.jscript.compilation.values.constants.BoolNode; import me.topchetoeu.j2s.compilation.values.constants.BoolNode;
import me.topchetoeu.jscript.compilation.values.operations.IndexNode; import me.topchetoeu.j2s.compilation.values.operations.IndexNode;
public class DeleteNode extends Node { public class DeleteNode extends Node {
public final Node key; public final Node key;

View File

@@ -1,16 +1,16 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.DeferredIntSupplier; import me.topchetoeu.j2s.compilation.DeferredIntSupplier;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class DoWhileNode extends Node { public class DoWhileNode extends Node {
public final Node condition, body; public final Node condition, body;

View File

@@ -1,17 +1,17 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.DeferredIntSupplier;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.DeferredIntSupplier; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
import me.topchetoeu.jscript.compilation.values.VariableNode; import me.topchetoeu.j2s.compilation.values.VariableNode;
public class ForInNode extends Node { public class ForInNode extends Node {
public final boolean isDecl; public final boolean isDecl;
@@ -21,7 +21,9 @@ public class ForInNode extends Node {
@Override public void resolve(CompileResult target) { @Override public void resolve(CompileResult target) {
body.resolve(target); body.resolve(target);
binding.resolve(target); if (isDecl) {
target.scope.define(binding.name);
}
} }
@Override public void compileFunctions(CompileResult target) { @Override public void compileFunctions(CompileResult target) {

View File

@@ -1,17 +1,17 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.DeferredIntSupplier; import me.topchetoeu.j2s.compilation.DeferredIntSupplier;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
import me.topchetoeu.jscript.compilation.VariableDeclareNode; import me.topchetoeu.j2s.compilation.VariableDeclareNode;
public class ForNode extends Node { public class ForNode extends Node {
public final Node declaration, assignment, condition, body; public final Node declaration, assignment, condition, body;

View File

@@ -1,16 +1,16 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.DeferredIntSupplier; import me.topchetoeu.j2s.compilation.DeferredIntSupplier;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class IfNode extends Node { public class IfNode extends Node {
public final Node condition, body, elseBody; public final Node condition, body, elseBody;

View File

@@ -1,13 +1,13 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class ReturnNode extends Node { public class ReturnNode extends Node {
public final Node value; public final Node value;

View File

@@ -1,20 +1,20 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Operation; import me.topchetoeu.j2s.common.Operation;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.DeferredIntSupplier; import me.topchetoeu.j2s.compilation.DeferredIntSupplier;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class SwitchNode extends Node { public class SwitchNode extends Node {
public static class SwitchCase { public static class SwitchCase {

View File

@@ -1,13 +1,13 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class ThrowNode extends Node { public class ThrowNode extends Node {
public final Node value; public final Node value;

View File

@@ -1,17 +1,17 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.CompoundNode; import me.topchetoeu.j2s.compilation.CompoundNode;
import me.topchetoeu.jscript.compilation.DeferredIntSupplier; import me.topchetoeu.j2s.compilation.DeferredIntSupplier;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class TryNode extends Node { public class TryNode extends Node {
public final CompoundNode tryBody; public final CompoundNode tryBody;

View File

@@ -1,16 +1,16 @@
package me.topchetoeu.jscript.compilation.control; package me.topchetoeu.j2s.compilation.control;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.DeferredIntSupplier; import me.topchetoeu.j2s.compilation.DeferredIntSupplier;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.LabelContext; import me.topchetoeu.j2s.compilation.LabelContext;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class WhileNode extends Node { public class WhileNode extends Node {
public final Node condition, body; public final Node condition, body;

View File

@@ -1,14 +1,14 @@
package me.topchetoeu.jscript.compilation.members; package me.topchetoeu.j2s.compilation.members;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
import me.topchetoeu.jscript.compilation.values.ObjectNode; import me.topchetoeu.j2s.compilation.values.ObjectNode;
public class FieldMemberNode implements Member { public class FieldMemberNode implements Member {
public final Location loc; public final Location loc;
@@ -29,7 +29,7 @@ public class FieldMemberNode implements Member {
if (value == null) target.add(Instruction.pushUndefined()); if (value == null) target.add(Instruction.pushUndefined());
else value.compile(target, true); else value.compile(target, true);
target.add(Instruction.defField()); target.add(Instruction.storeMember());
} }
public FieldMemberNode(Location loc, Node key, Node value) { public FieldMemberNode(Location loc, Node key, Node value) {

View File

@@ -0,0 +1,11 @@
package me.topchetoeu.j2s.compilation.members;
import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.j2s.compilation.CompileResult;
public interface Member {
Location loc();
void compileFunctions(CompileResult target);
void compile(CompileResult target, boolean pollute);
}

View File

@@ -1,21 +1,21 @@
package me.topchetoeu.jscript.compilation.members; package me.topchetoeu.j2s.compilation.members;
import java.util.Arrays; import java.util.Arrays;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.Instruction.BreakpointType; import me.topchetoeu.j2s.common.Instruction.BreakpointType;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.CompoundNode; import me.topchetoeu.j2s.compilation.CompoundNode;
import me.topchetoeu.jscript.compilation.FunctionNode; import me.topchetoeu.j2s.compilation.FunctionNode;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
import me.topchetoeu.jscript.compilation.values.ObjectNode; import me.topchetoeu.j2s.compilation.values.ObjectNode;
import me.topchetoeu.jscript.compilation.values.VariableNode; import me.topchetoeu.j2s.compilation.values.VariableNode;
import me.topchetoeu.jscript.compilation.values.constants.StringNode; import me.topchetoeu.j2s.compilation.values.constants.StringNode;
public final class PropertyMemberNode extends FunctionNode implements Member { public final class PropertyMemberNode extends FunctionNode implements Member {
public final Node key; public final Node key;

View File

@@ -1,7 +1,7 @@
package me.topchetoeu.jscript.compilation.patterns; package me.topchetoeu.j2s.compilation.patterns;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
/** /**
* Represents all nodes that can be assign targets * Represents all nodes that can be assign targets

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.compilation.patterns; package me.topchetoeu.j2s.compilation.patterns;
/** /**
* Represents all nodes that can be converted to assign targets * Represents all nodes that can be converted to assign targets

View File

@@ -0,0 +1,7 @@
package me.topchetoeu.j2s.compilation.patterns;
import me.topchetoeu.j2s.compilation.CompileResult;
public interface ChangeTarget extends AssignTarget {
void beforeChange(CompileResult target);
}

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.compilation.scope; package me.topchetoeu.j2s.compilation.scope;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@@ -1,4 +1,4 @@
package me.topchetoeu.jscript.compilation.scope; package me.topchetoeu.j2s.compilation.scope;
import java.util.function.Supplier; import java.util.function.Supplier;

View File

@@ -1,6 +1,6 @@
package me.topchetoeu.jscript.compilation.scope; package me.topchetoeu.j2s.compilation.scope;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
public final class VariableIndex { public final class VariableIndex {
public static enum IndexType { public static enum IndexType {

View File

@@ -1,11 +1,11 @@
package me.topchetoeu.jscript.compilation.scope; package me.topchetoeu.j2s.compilation.scope;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.function.IntSupplier; import java.util.function.IntSupplier;
import java.util.function.Supplier; import java.util.function.Supplier;
import me.topchetoeu.jscript.compilation.scope.VariableIndex.IndexType; import me.topchetoeu.j2s.compilation.scope.VariableIndex.IndexType;
public final class VariableList implements Iterable<Variable> { public final class VariableList implements Iterable<Variable> {
private final class VariableNode implements Supplier<VariableIndex> { private final class VariableNode implements Supplier<VariableIndex> {

View File

@@ -1,9 +1,9 @@
package me.topchetoeu.jscript.compilation.values; package me.topchetoeu.j2s.compilation.values;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class ArgumentsNode extends Node { public class ArgumentsNode extends Node {

View File

@@ -1,15 +1,15 @@
package me.topchetoeu.jscript.compilation.values; package me.topchetoeu.j2s.compilation.values;
import java.util.ArrayList; import java.util.ArrayList;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class ArrayNode extends Node { public class ArrayNode extends Node {

View File

@@ -1,9 +1,9 @@
package me.topchetoeu.jscript.compilation.values; package me.topchetoeu.j2s.compilation.values;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class GlobalThisNode extends Node { public class GlobalThisNode extends Node {

View File

@@ -1,21 +1,21 @@
package me.topchetoeu.jscript.compilation.values; package me.topchetoeu.j2s.compilation.values;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
import me.topchetoeu.jscript.compilation.members.FieldMemberNode; import me.topchetoeu.j2s.compilation.members.FieldMemberNode;
import me.topchetoeu.jscript.compilation.members.Member; import me.topchetoeu.j2s.compilation.members.Member;
import me.topchetoeu.jscript.compilation.members.PropertyMemberNode; import me.topchetoeu.j2s.compilation.members.PropertyMemberNode;
import me.topchetoeu.jscript.compilation.values.constants.NumberNode; import me.topchetoeu.j2s.compilation.values.constants.NumberNode;
import me.topchetoeu.jscript.compilation.values.constants.StringNode; import me.topchetoeu.j2s.compilation.values.constants.StringNode;
public class ObjectNode extends Node { public class ObjectNode extends Node {
public final List<Member> members; public final List<Member> members;

View File

@@ -1,12 +1,12 @@
package me.topchetoeu.jscript.compilation.values; package me.topchetoeu.j2s.compilation.values;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class RegexNode extends Node { public class RegexNode extends Node {
public final String pattern, flags; public final String pattern, flags;

View File

@@ -1,9 +1,9 @@
package me.topchetoeu.jscript.compilation.values; package me.topchetoeu.j2s.compilation.values;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class ThisNode extends Node { public class ThisNode extends Node {

View File

@@ -1,14 +1,14 @@
package me.topchetoeu.jscript.compilation.values; package me.topchetoeu.j2s.compilation.values;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.j2s.common.parsing.ParseRes;
import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.j2s.common.parsing.Parsing;
import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.j2s.common.parsing.Source;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.j2s.compilation.JavaScript;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
import me.topchetoeu.jscript.compilation.patterns.ChangeTarget; import me.topchetoeu.j2s.compilation.patterns.ChangeTarget;
public class VariableNode extends Node implements ChangeTarget { public class VariableNode extends Node implements ChangeTarget {
public final String name; public final String name;

View File

@@ -1,9 +1,9 @@
package me.topchetoeu.jscript.compilation.values.constants; package me.topchetoeu.j2s.compilation.values.constants;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class BoolNode extends Node { public class BoolNode extends Node {
public final boolean value; public final boolean value;

View File

@@ -1,9 +1,9 @@
package me.topchetoeu.jscript.compilation.values.constants; package me.topchetoeu.j2s.compilation.values.constants;
import me.topchetoeu.jscript.common.Instruction; import me.topchetoeu.j2s.common.Instruction;
import me.topchetoeu.jscript.common.parsing.Location; import me.topchetoeu.j2s.common.parsing.Location;
import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.j2s.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.Node; import me.topchetoeu.j2s.compilation.Node;
public class NullNode extends Node { public class NullNode extends Node {
@Override public void compileFunctions(CompileResult target) { @Override public void compileFunctions(CompileResult target) {

Some files were not shown because too many files have changed in this diff Show More