greybel-interpreter 5.0.4 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,8 @@ export interface ParseCodeFunction {
6
6
  }
7
7
  export interface IBytecodeStatementGenerator {
8
8
  process(node: ASTBase): Promise<void>;
9
+ processBinaryExpression(node: ASTBinaryExpression): Promise<void>;
10
+ processLogicalExpression(node: ASTLogicalExpression): Promise<void>;
9
11
  processMemberExpression(node: ASTMemberExpression, context?: LineCallableContext): Promise<void>;
10
12
  processIndexExpression(node: ASTIndexExpression, context?: LineCallableContext): Promise<void>;
11
13
  processIdentifier(node: ASTIdentifier, context?: LineIdentifierContext): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { ASTFeatureImportExpression, ASTFeatureIncludeExpression } from 'greybel-core';
2
- import { ASTAssignmentStatement, ASTBase, ASTCallExpression, ASTForGenericStatement, ASTIdentifier, ASTIfStatement, ASTIndexExpression, ASTListConstructorExpression, ASTMapConstructorExpression, ASTMemberExpression, ASTReturnStatement, ASTUnaryExpression, ASTWhileStatement } from 'miniscript-core';
2
+ import { ASTAssignmentStatement, ASTBase, ASTCallExpression, ASTForGenericStatement, ASTIdentifier, ASTIfStatement, ASTIndexExpression, ASTListConstructorExpression, ASTLogicalExpression, ASTMapConstructorExpression, ASTMemberExpression, ASTReturnStatement, ASTUnaryExpression, ASTBinaryExpression, ASTWhileStatement } from 'miniscript-core';
3
3
  import { Context } from './context';
4
4
  import { LineCallableContext, LineIdentifierContext } from './line';
5
5
  import { IBytecodeExpressionGenerator, IBytecodeStatementGenerator, ParseCodeFunction } from './models';
@@ -9,6 +9,8 @@ export declare class BytecodeStatementGenerator implements IBytecodeStatementGen
9
9
  protected parseCode: ParseCodeFunction;
10
10
  constructor(context: Context, parseCodeFunction: ParseCodeFunction);
11
11
  process(node: ASTBase): Promise<void>;
12
+ processBinaryExpression(node: ASTBinaryExpression): Promise<void>;
13
+ processLogicalExpression(node: ASTLogicalExpression): Promise<void>;
12
14
  processMemberExpression(node: ASTMemberExpression, context?: LineCallableContext): Promise<void>;
13
15
  processIndexExpression(node: ASTIndexExpression, context?: LineCallableContext): Promise<void>;
14
16
  processIdentifier(node: ASTIdentifier, context?: LineIdentifierContext): Promise<void>;
@@ -62,9 +62,10 @@ class BytecodeStatementGenerator {
62
62
  return;
63
63
  case miniscript_core_1.ASTType.IsaExpression:
64
64
  case miniscript_core_1.ASTType.BinaryExpression:
65
+ yield this.processBinaryExpression(node);
65
66
  return;
66
67
  case miniscript_core_1.ASTType.LogicalExpression:
67
- yield this.exprGenerator.processLogicalExpression(node);
68
+ yield this.processLogicalExpression(node);
68
69
  return;
69
70
  case miniscript_core_1.ASTType.ReturnStatement:
70
71
  yield this.processReturn(node);
@@ -133,6 +134,22 @@ class BytecodeStatementGenerator {
133
134
  }
134
135
  });
135
136
  }
137
+ processBinaryExpression(node) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ yield this.exprGenerator.processBinaryExpression(node);
140
+ this.context.pushCode({
141
+ op: instruction_1.OpCode.POP
142
+ }, node);
143
+ });
144
+ }
145
+ processLogicalExpression(node) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ yield this.exprGenerator.processLogicalExpression(node);
148
+ this.context.pushCode({
149
+ op: instruction_1.OpCode.POP
150
+ }, node);
151
+ });
152
+ }
136
153
  processMemberExpression(node, context) {
137
154
  return __awaiter(this, void 0, void 0, function* () {
138
155
  const base = (0, utils_1.unwrap)(node.base);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",
@@ -49,9 +49,9 @@
49
49
  "typescript": "^5.0.4"
50
50
  },
51
51
  "dependencies": {
52
- "greybel-core": "~2.0.4",
52
+ "greybel-core": "~2.0.5",
53
53
  "hyperid": "^3.2.0",
54
- "non-blocking-schedule": "^0.1.0"
54
+ "non-blocking-schedule": "^0.2.0"
55
55
  },
56
56
  "keywords": [
57
57
  "miniscript"