remove Value class, add NewExpression and separate out Any classes

This commit is contained in:
Dave Holoway
2020-06-17 13:00:04 +01:00
parent b9fd805a6d
commit 4f62b5a06e
9 changed files with 139 additions and 165 deletions

View File

@@ -1,6 +1,5 @@
const { ValueBase } = require("../body-types");
class Expression extends ValueBase {
class Expression {
}
exports.Expression = Expression;

View File

@@ -0,0 +1,35 @@
/**
* @typedef {import('../tokenizer').Token} Token
* @typedef {import('../body-types').ResolvedIdent} ResolvedIdent
* @typedef {import('java-mti').JavaType} JavaType
*/
const { Expression } = require("./Expression");
class NewArray extends Expression {
/**
* @param {JavaType} element_type
* @param {ResolvedIdent} dimensions
*/
constructor(element_type, dimensions) {
super();
this.element_type = element_type;
this.dimensions = dimensions;
}
}
class NewObject extends Expression {
/**
* @param {JavaType} object_type
* @param {ResolvedIdent[]} ctr_args
* @param {Token[]} type_body
*/
constructor(object_type, ctr_args, type_body) {
super();
this.element_type = object_type;
this.ctr_args = ctr_args;
this.type_body = type_body;
}
}
exports.NewArray = NewArray;
exports.NewObject = NewObject;

View File

@@ -0,0 +1,19 @@
/**
* @typedef {import('../../tokenizer').Token} Token
* @typedef {import('java-mti').CEIType} CEIType
*/
const { LiteralValue } = require('./LiteralValue');
class InstanceLiteral extends LiteralValue {
/**
*
* @param {Token} token 'this' or 'super' token
* @param {CEIType} scoped_type
*/
constructor(token, scoped_type) {
super(token);
this.scoped_type = scoped_type;
}
}
exports.InstanceLiteral = InstanceLiteral;