Skip to content

Commit

Permalink
export ObjFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
harpagon210 committed Dec 7, 2020
1 parent 038ac68 commit 1514100
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smartscript-vm",
"version": "0.0.1",
"version": "0.0.2",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import VM from './VM';
import InterpretResult from './InterpretResult';
import ObjFunction from './objects/ObjFunction';
import ObjArray from './objects/ObjArray';
import ObjBool from './objects/ObjBool';
import ObjNativeClass from './objects/ObjNativeClass';
Expand All @@ -14,6 +15,7 @@ import OpCode from './OpCode';

export {
VM, InterpretResult,
ObjArray, ObjBool, ObjNativeClass, ObjNativeFunction, ObjNull, ObjNumber, ObjInstance, ObjString,
ObjFunction, ObjArray, ObjBool, ObjNativeClass,
ObjNativeFunction, ObjNull, ObjNumber, ObjInstance, ObjString,
ArrayClass, MapClass, OpCode,
};
16 changes: 14 additions & 2 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,25 @@ async function run() {

const source = `
print(Api.sender);
Api.sender = 'me';
//Api.sender = 'me';
print(Api.sender);
{
let b = Api;
function test () {
return b;
}
test().sender = 'test';
print(test().sender);
}
`;

let result = VM.compile(source);

if (!result.result === InterpretResult.InterpretCompileError) {
if (result.result === InterpretResult.InterpretCompileError) {
console.error(result.errors);
process.exit(65);
}
Expand Down

0 comments on commit 1514100

Please sign in to comment.