|
@@ -3,13 +3,13 @@ import { SemanticError } from "./semanticError";
|
|
|
import * as LocalizedStringsService from "./../../services/localizedStringsService";
|
|
|
import { LanguageDefinedFunction } from "../definedFunctions";
|
|
|
|
|
|
-const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
-
|
|
|
function createRuntimeError (i18n_id, context = []) {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
return new RuntimeError(LocalizedStrings.getError(i18n_id, context), i18n_id);
|
|
|
}
|
|
|
|
|
|
function createSemanticError (i18n_id, context = []) {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
return new SemanticError(
|
|
|
LocalizedStrings.getError(i18n_id, context),
|
|
|
i18n_id
|
|
@@ -85,6 +85,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
exp,
|
|
|
source_info
|
|
|
) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
if (source_info) {
|
|
|
const context = [
|
|
|
LocalizedStrings.translateType(left_type, left_dim),
|
|
@@ -106,6 +107,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
}
|
|
|
},
|
|
|
incompatible_types: (left_type, left_dim, right_type, right_dim, exp) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [
|
|
|
LocalizedStrings.translateType(left_type, left_dim),
|
|
|
exp,
|
|
@@ -114,6 +116,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
return createSemanticError("incompatible_types", context);
|
|
|
},
|
|
|
incompatible_types_array_full: (exp, type, dim, sourceInfo) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
if (sourceInfo) {
|
|
|
const context = [
|
|
|
exp,
|
|
@@ -132,6 +135,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
}
|
|
|
},
|
|
|
incompatible_types_array: (exp, type, dim) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [exp, LocalizedStrings.translateType(type, dim)];
|
|
|
return createSemanticError("incompatible_types_array", context);
|
|
|
},
|
|
@@ -187,6 +191,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
return createRuntimeError("not_implemented", context);
|
|
|
},
|
|
|
invalid_case_type_full: (exp, type, dim, sourceInfo) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
if (sourceInfo) {
|
|
|
const context = [
|
|
|
exp,
|
|
@@ -202,6 +207,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
}
|
|
|
},
|
|
|
invalid_case_type: (exp, type, dim) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [exp, LocalizedStrings.translateType(type, dim)];
|
|
|
return createSemanticError("invalid_case_type", context);
|
|
|
},
|
|
@@ -308,6 +314,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
return createSemanticError("function_no_return", context);
|
|
|
},
|
|
|
invalid_void_return_full: (id, type, dim, sourceInfo) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
if (sourceInfo) {
|
|
|
const context = [
|
|
|
sourceInfo.line,
|
|
@@ -322,10 +329,13 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
}
|
|
|
},
|
|
|
invalid_void_return: (id, type, dim) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [id, LocalizedStrings.translateType(type, dim)];
|
|
|
return createSemanticError("invalid_void_return_full", context);
|
|
|
},
|
|
|
invalid_return_type_full: (id, type, dim, sourceInfo) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
+
|
|
|
if (sourceInfo) {
|
|
|
const context = [
|
|
|
sourceInfo.line,
|
|
@@ -340,6 +350,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
}
|
|
|
},
|
|
|
invalid_return_type: (id, type, dim) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [id, LocalizedStrings.translateType(type, dim)];
|
|
|
return createSemanticError("invalid_return_type", context);
|
|
|
},
|
|
@@ -467,6 +478,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
return createRuntimeError("invalid_array_literal_column", context);
|
|
|
},
|
|
|
invalid_unary_op_full: (expString, opName, type, dim, sourceInfo) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
if (sourceInfo) {
|
|
|
const context = [
|
|
|
sourceInfo.line,
|
|
@@ -482,6 +494,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
}
|
|
|
},
|
|
|
invalid_unary_op: (expString, opName, type, dim) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [
|
|
|
expString,
|
|
|
LocalizedStrings.translateOp(opName),
|
|
@@ -498,6 +511,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
dimRight,
|
|
|
sourceInfo
|
|
|
) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
if (sourceInfo) {
|
|
|
const context = [
|
|
|
sourceInfo.line,
|
|
@@ -527,6 +541,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
typeRight,
|
|
|
dimRight
|
|
|
) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [
|
|
|
expString,
|
|
|
LocalizedStrings.translateOp(opName),
|
|
@@ -552,10 +567,13 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
return createSemanticError("array_dimension_not_positive");
|
|
|
},
|
|
|
invalid_type_conversion: (value, type, dim) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
+
|
|
|
const context = [value, LocalizedStrings.translateType(type, dim)];
|
|
|
return createRuntimeError("invalid_type_conversion", context);
|
|
|
},
|
|
|
invalid_read_type: (exp, type, dim, name, source_info) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [
|
|
|
source_info.line,
|
|
|
exp,
|
|
@@ -575,6 +593,7 @@ export const ProcessorErrorFactory = Object.freeze({
|
|
|
dimArray,
|
|
|
sourceInfo
|
|
|
) => {
|
|
|
+ const LocalizedStrings = LocalizedStringsService.getInstance();
|
|
|
const context = [
|
|
|
sourceInfo.line,
|
|
|
exp,
|