Browse Source

Fix LocalizedStrings load for processor error factory

Bumb webpack, line-i18n and ts-loader modules
Lucas de Souza 11 months ago
parent
commit
bcbb05d98e
3 changed files with 1809 additions and 1575 deletions
  1. 21 2
      js/processor/error/processorErrorFactory.js
  2. 1785 1570
      package-lock.json
  3. 3 3
      package.json

+ 21 - 2
js/processor/error/processorErrorFactory.js

@@ -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,

File diff suppressed because it is too large
+ 1785 - 1570
package-lock.json


+ 3 - 3
package.json

@@ -39,10 +39,10 @@
     "eslint": "^8.5.0",
     "html-webpack-plugin": "^5.5.0",
     "http-server": "^14.0.0",
-    "ts-loader": "^5.4.5",
+    "ts-loader": "^6.x",
     "typescript": "^3.9.5",
-    "webpack": "^5",
-    "webpack-cli": "4.x"
+    "webpack": "^5.x",
+    "webpack-cli": "5.x"
   },
   "dependencies": {
     "@babel/runtime": "^7.10.2",