hispano-lang 2.1.0 → 2.1.2
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.
- package/README.md +2 -2
- package/dist/evaluator.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -341,7 +341,7 @@ variable duplicar = funcion(x) {
|
|
|
341
341
|
mostrar duplicar(5) // 10
|
|
342
342
|
```
|
|
343
343
|
|
|
344
|
-
####
|
|
344
|
+
#### Funciones Flecha
|
|
345
345
|
|
|
346
346
|
Sintaxis concisa para funciones anónimas:
|
|
347
347
|
|
|
@@ -366,7 +366,7 @@ mostrar suma(3, 4) // 7
|
|
|
366
366
|
mostrar factorial(5) // 120
|
|
367
367
|
```
|
|
368
368
|
|
|
369
|
-
|
|
369
|
+
Funciones flecha son ideales para callbacks:
|
|
370
370
|
|
|
371
371
|
```
|
|
372
372
|
variable numeros = [1, 2, 3, 4, 5]
|
package/dist/evaluator.js
CHANGED
|
@@ -23,7 +23,7 @@ class Evaluator {
|
|
|
23
23
|
this.execute(statement);
|
|
24
24
|
}
|
|
25
25
|
} catch (error) {
|
|
26
|
-
throw new Error(
|
|
26
|
+
throw new Error(error.message);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
return this.output;
|
|
@@ -2411,6 +2411,8 @@ class Environment {
|
|
|
2411
2411
|
* @param {any} value - Variable value
|
|
2412
2412
|
*/
|
|
2413
2413
|
define(name, value) {
|
|
2414
|
+
// Remove from constants if it was previously defined as one
|
|
2415
|
+
this.constants.delete(name);
|
|
2414
2416
|
this.values[name] = value;
|
|
2415
2417
|
}
|
|
2416
2418
|
|
package/package.json
CHANGED