@designliquido/delegua 1.27.0 → 1.27.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/avaliador-sintatico/avaliador-sintatico-base.d.ts +7 -0
- package/avaliador-sintatico/avaliador-sintatico-base.d.ts.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico-base.js +27 -0
- package/avaliador-sintatico/avaliador-sintatico-base.js.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico.d.ts.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico.js +19 -1
- package/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-tenda.d.ts.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-tenda.js +4 -0
- package/avaliador-sintatico/dialetos/avaliador-sintatico-tenda.js.map +1 -1
- package/bin/package.json +1 -1
- package/interfaces/parametro-interface.d.ts +4 -0
- package/interfaces/parametro-interface.d.ts.map +1 -1
- package/interpretador/estruturas/delegua-funcao.d.ts.map +1 -1
- package/interpretador/estruturas/delegua-funcao.js +47 -1
- package/interpretador/estruturas/delegua-funcao.js.map +1 -1
- package/interpretador/interpretador-base.d.ts.map +1 -1
- package/interpretador/interpretador-base.js +4 -1
- package/interpretador/interpretador-base.js.map +1 -1
- package/interpretador/interpretador.d.ts.map +1 -1
- package/interpretador/interpretador.js +3 -0
- package/interpretador/interpretador.js.map +1 -1
- package/lexador/dialetos/lexador-portugol-ipt.d.ts.map +1 -1
- package/lexador/dialetos/lexador-portugol-ipt.js +3 -2
- package/lexador/dialetos/lexador-portugol-ipt.js.map +1 -1
- package/lexador/lexador-base-linha-unica.d.ts.map +1 -1
- package/lexador/lexador-base-linha-unica.js +3 -2
- package/lexador/lexador-base-linha-unica.js.map +1 -1
- package/lexador/lexador-base.d.ts.map +1 -1
- package/lexador/lexador-base.js +9 -2
- package/lexador/lexador-base.js.map +1 -1
- package/lexador/lexador.d.ts.map +1 -1
- package/lexador/lexador.js +3 -2
- package/lexador/lexador.js.map +1 -1
- package/lexador/micro-lexador-pitugues.d.ts.map +1 -1
- package/lexador/micro-lexador-pitugues.js +3 -2
- package/lexador/micro-lexador-pitugues.js.map +1 -1
- package/lexador/micro-lexador.d.ts.map +1 -1
- package/lexador/micro-lexador.js +3 -2
- package/lexador/micro-lexador.js.map +1 -1
- package/package.json +1 -1
- package/umd/delegua.js +129 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"micro-lexador.d.ts","sourceRoot":"","sources":["../../fontes/lexador/micro-lexador.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C;;;;GAIG;AACH,qBAAa,YAAY;IACrB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAInC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAoCrC,iBAAiB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO;IAI1C,cAAc,IAAI,OAAO;IAIzB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,GAAU,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"micro-lexador.d.ts","sourceRoot":"","sources":["../../fontes/lexador/micro-lexador.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C;;;;GAIG;AACH,qBAAa,YAAY;IACrB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAInC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAoCrC,iBAAiB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO;IAI1C,cAAc,IAAI,OAAO;IAIzB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,GAAU,GAAG,IAAI;IAWzD,aAAa,CAAC,WAAW,SAAM,GAAG,IAAI;IAkBtC,cAAc,IAAI,IAAI;IAkBtB,uBAAuB,IAAI,IAAI;IAe/B,aAAa,IAAI,IAAI;IAiHrB;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CAAC,gBAAgB,CAAC;CAiBpE"}
|
package/lexador/micro-lexador.js
CHANGED
|
@@ -56,8 +56,9 @@ class MicroLexador {
|
|
|
56
56
|
}
|
|
57
57
|
adicionarSimbolo(tipo, literal = null) {
|
|
58
58
|
const texto = this.codigo.substring(this.inicioSimbolo, this.atual);
|
|
59
|
-
|
|
60
|
-
const
|
|
59
|
+
// `lexema` deve sempre ser texto. Ver comentário equivalente em `LexadorBase.adicionarSimbolo`.
|
|
60
|
+
const lexema = (typeof literal === 'string' && literal.length > 0) ? literal : texto;
|
|
61
|
+
const comprimentoLexema = lexema.length;
|
|
61
62
|
const comprimento = Math.max(comprimentoLexema, texto.length) || 1;
|
|
62
63
|
const colunaInicio = this.inicioSimbolo + 1;
|
|
63
64
|
const colunaFim = this.inicioSimbolo + comprimento;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"micro-lexador.js","sourceRoot":"","sources":["../../fontes/lexador/micro-lexador.ts"],"names":[],"mappings":";;;;;;AAIA,+DAA+F;AAC/F,uCAAoC;AAEpC,2FAA2E;AAE3E;;;;GAIG;AACH,MAAa,YAAY;IAOrB,OAAO,CAAC,SAAiB;QACrB,OAAO,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;IAChD,CAAC;IAED,SAAS,CAAC,SAAiB;QACvB,MAAM,WAAW,GAAG;YAChB,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;YACH,GAAG;SACN,CAAC;QAEF,OAAO,CACH,CAAC,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;YACtC,CAAC,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;YACtC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAClC,CAAC;IACN,CAAC;IAED,iBAAiB,CAAC,SAAc;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC;IAC5C,CAAC;IAED,gBAAgB,CAAC,IAAY,EAAE,UAAe,IAAI;QAC9C,MAAM,KAAK,GAAW,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"micro-lexador.js","sourceRoot":"","sources":["../../fontes/lexador/micro-lexador.ts"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ChB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QAEvB,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;YAC5B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC;YAChC,IAAI,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC;QAED,OAAO;YACH,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;SACyB,CAAC;IACnD,CAAC;CACJ;AA3PD,oCA2PC"}
|
package/package.json
CHANGED
package/umd/delegua.js
CHANGED
|
@@ -2165,6 +2165,17 @@ class AvaliadorSintaticoBase {
|
|
|
2165
2165
|
this.blocos = 0;
|
|
2166
2166
|
}
|
|
2167
2167
|
erro(simbolo, mensagemDeErro, codigoDiagnostico, simboloRelacionado) {
|
|
2168
|
+
// Chamadores costumam passar `this.simbolos[this.atual]` diretamente. Se o
|
|
2169
|
+
// cursor já passou do último símbolo (ex.: código termina logo após um
|
|
2170
|
+
// token sem ';' ou EOF explícito), esse acesso devolve `undefined`, e o
|
|
2171
|
+
// construtor de `ErroAvaliadorSintatico` quebraria ao ler `simbolo.hashArquivo`.
|
|
2172
|
+
// Mesma lógica de fallback já usada em `consumir()`.
|
|
2173
|
+
if (!simbolo) {
|
|
2174
|
+
simbolo =
|
|
2175
|
+
this.simbolos.length === 0
|
|
2176
|
+
? { hashArquivo: this.hashArquivo, linha: 1 }
|
|
2177
|
+
: this.simbolos[this.simbolos.length - 1];
|
|
2178
|
+
}
|
|
2168
2179
|
const excecao = new erro_avaliador_sintatico_1.ErroAvaliadorSintatico(simbolo, mensagemDeErro, codigoDiagnostico, simboloRelacionado);
|
|
2169
2180
|
return excecao;
|
|
2170
2181
|
}
|
|
@@ -2217,6 +2228,22 @@ class AvaliadorSintaticoBase {
|
|
|
2217
2228
|
}
|
|
2218
2229
|
return false;
|
|
2219
2230
|
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Avança o cursor por quaisquer símbolos de comentário (de linha ou
|
|
2233
|
+
* multilinha) consecutivos, descartando-os. Usado em construtos onde
|
|
2234
|
+
* comentários podem aparecer entre elementos, mas não fazem sentido
|
|
2235
|
+
* como parte da árvore sintática resultante (ex.: dicionários).
|
|
2236
|
+
*/
|
|
2237
|
+
pularComentarios() {
|
|
2238
|
+
// Os tipos de símbolo de comentário não fazem parte do conjunto reduzido
|
|
2239
|
+
// de `tiposDeSimbolos` importado nesta classe base, por isso são usados
|
|
2240
|
+
// aqui como literais de texto (seus valores são idênticos às chaves do
|
|
2241
|
+
// conjunto completo, definido em `tipos-de-simbolos/delegua.ts`).
|
|
2242
|
+
while (this.simbolos[this.atual].tipo === 'COMENTARIO' ||
|
|
2243
|
+
this.simbolos[this.atual].tipo === 'LINHA_COMENTARIO') {
|
|
2244
|
+
this.avancarEDevolverAnterior();
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2220
2247
|
async declaracaoBloco() {
|
|
2221
2248
|
const simboloInicioBloco = this.consumir(comum_1.default.CHAVE_ESQUERDA, "Esperado '{' para abertura de bloco.");
|
|
2222
2249
|
return new declaracoes_1.Bloco(simboloInicioBloco.hashArquivo, Number(simboloInicioBloco.linha), await this.blocoEscopo());
|
|
@@ -2694,18 +2721,22 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
2694
2721
|
this.avancarEDevolverAnterior();
|
|
2695
2722
|
const chaves = [];
|
|
2696
2723
|
const valores = [];
|
|
2724
|
+
this.pularComentarios();
|
|
2697
2725
|
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CHAVE_DIREITA)) {
|
|
2698
2726
|
return new construtos_1.Dicionario(this.hashArquivo, Number(simboloChaveEsquerda.linha), [], []);
|
|
2699
2727
|
}
|
|
2700
2728
|
while (!this.verificarSeSimboloAtualEIgualA(delegua_2.default.CHAVE_DIREITA)) {
|
|
2701
2729
|
const chave = await this.obterChaveDicionario();
|
|
2702
2730
|
this.consumir(delegua_2.default.DOIS_PONTOS, "Esperado ':' entre chave e valor.");
|
|
2731
|
+
this.pularComentarios();
|
|
2703
2732
|
const valor = await this.atribuir();
|
|
2704
2733
|
chaves.push(chave);
|
|
2705
2734
|
valores.push(valor);
|
|
2735
|
+
this.pularComentarios();
|
|
2706
2736
|
if (this.simbolos[this.atual].tipo !== delegua_2.default.CHAVE_DIREITA) {
|
|
2707
2737
|
this.consumir(delegua_2.default.VIRGULA, 'Esperado vírgula antes da próxima expressão.');
|
|
2708
2738
|
}
|
|
2739
|
+
this.pularComentarios();
|
|
2709
2740
|
}
|
|
2710
2741
|
return new construtos_1.Dicionario(this.hashArquivo, Number(simboloChaveEsquerda.linha), chaves, valores);
|
|
2711
2742
|
}
|
|
@@ -4681,6 +4712,15 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
4681
4712
|
const parametros = [];
|
|
4682
4713
|
do {
|
|
4683
4714
|
const parametro = {};
|
|
4715
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CONSTANTE)) {
|
|
4716
|
+
const modificador = this.simbolos[this.atual - 1];
|
|
4717
|
+
if (modificador.lexema === 'fixo') {
|
|
4718
|
+
parametro.fixo = true;
|
|
4719
|
+
}
|
|
4720
|
+
else {
|
|
4721
|
+
parametro.imutavel = true;
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4684
4724
|
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.RETICENCIAS)) {
|
|
4685
4725
|
parametro.abrangencia = 'multiplo';
|
|
4686
4726
|
}
|
|
@@ -4752,7 +4792,12 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
4752
4792
|
}
|
|
4753
4793
|
}
|
|
4754
4794
|
const tiposRetornos = new Set(expressoesRetorna.filter((e) => e.tipo !== 'qualquer').map((e) => e.tipo));
|
|
4755
|
-
|
|
4795
|
+
// Não usar `tiposRetornos.size > 0` aqui: esse conjunto já descarta
|
|
4796
|
+
// retornos de tipo 'qualquer' (ex.: `retorna x * y` com parâmetros sem
|
|
4797
|
+
// tipo). Um `retorna` com valor de tipo indeterminado ainda conta como
|
|
4798
|
+
// retorno explícito, senão a função seria incorretamente inferida como
|
|
4799
|
+
// 'vazio' em vez de 'qualquer'.
|
|
4800
|
+
let retornaChamadoExplicitamente = expressoesRetorna.some((e) => e.valor !== undefined);
|
|
4756
4801
|
if (tiposRetornos.size > 1 && tipoRetorno !== 'qualquer') {
|
|
4757
4802
|
let tiposEncontrados = Array.from(tiposRetornos).reduce((acumulador, valor) => (acumulador += valor + ', '), '');
|
|
4758
4803
|
tiposEncontrados = tiposEncontrados.slice(0, -2);
|
|
@@ -10050,18 +10095,22 @@ class AvaliadorSintaticoTenda extends avaliador_sintatico_base_1.AvaliadorSintat
|
|
|
10050
10095
|
this.avancarEDevolverAnterior();
|
|
10051
10096
|
const chaves = [];
|
|
10052
10097
|
const valores = [];
|
|
10098
|
+
this.pularComentarios();
|
|
10053
10099
|
if (this.verificarSeSimboloAtualEIgualA(tenda_1.default.CHAVE_DIREITA)) {
|
|
10054
10100
|
return new construtos_1.Dicionario(this.hashArquivo, Number(simboloChaveEsquerda.linha), [], []);
|
|
10055
10101
|
}
|
|
10056
10102
|
while (!this.verificarSeSimboloAtualEIgualA(tenda_1.default.CHAVE_DIREITA)) {
|
|
10057
10103
|
const chave = await this.obterChaveDicionario();
|
|
10058
10104
|
this.consumir(tenda_1.default.DOIS_PONTOS, "Esperado ':' entre chave e valor.");
|
|
10105
|
+
this.pularComentarios();
|
|
10059
10106
|
const valor = await this.atribuir();
|
|
10060
10107
|
chaves.push(chave);
|
|
10061
10108
|
valores.push(valor);
|
|
10109
|
+
this.pularComentarios();
|
|
10062
10110
|
if (this.simbolos[this.atual].tipo !== tenda_1.default.CHAVE_DIREITA) {
|
|
10063
10111
|
this.consumir(tenda_1.default.VIRGULA, 'Esperado vírgula antes da próxima expressão.');
|
|
10064
10112
|
}
|
|
10113
|
+
this.pularComentarios();
|
|
10065
10114
|
}
|
|
10066
10115
|
return new construtos_1.Dicionario(this.hashArquivo, Number(simboloChaveEsquerda.linha), chaves, valores);
|
|
10067
10116
|
}
|
|
@@ -20960,6 +21009,8 @@ const espaco_memoria_1 = require("../espaco-memoria");
|
|
|
20960
21009
|
const quebras_1 = require("../../quebras");
|
|
20961
21010
|
const objeto_delegua_classe_1 = require("./objeto-delegua-classe");
|
|
20962
21011
|
const declaracoes_1 = require("../../declaracoes");
|
|
21012
|
+
const inferenciador_1 = require("../../inferenciador");
|
|
21013
|
+
const referencia_montao_1 = require("./referencia-montao");
|
|
20963
21014
|
/**
|
|
20964
21015
|
* Qualquer função declarada em código é uma DeleguaFuncao.
|
|
20965
21016
|
*/
|
|
@@ -21055,7 +21106,27 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
21055
21106
|
else {
|
|
21056
21107
|
valorFinal = null;
|
|
21057
21108
|
}
|
|
21058
|
-
|
|
21109
|
+
if (parametro.fixo) {
|
|
21110
|
+
// Vetores e dicionários vivem no montão; `valorFinal` é apenas
|
|
21111
|
+
// o ponteiro (`ReferenciaMontao`). É preciso congelar o valor
|
|
21112
|
+
// real armazenado no montão, não o ponteiro em si.
|
|
21113
|
+
if (valorFinal instanceof referencia_montao_1.ReferenciaMontao) {
|
|
21114
|
+
congelarProfundamente(visitante.resolverValor(valorFinal));
|
|
21115
|
+
}
|
|
21116
|
+
else {
|
|
21117
|
+
valorFinal = congelarProfundamente(valorFinal);
|
|
21118
|
+
}
|
|
21119
|
+
}
|
|
21120
|
+
if (parametro.imutavel || parametro.fixo) {
|
|
21121
|
+
ambiente.valores[nome] = {
|
|
21122
|
+
valor: valorFinal,
|
|
21123
|
+
tipo: (0, inferenciador_1.inferirTipoVariavel)(valorFinal),
|
|
21124
|
+
imutavel: true,
|
|
21125
|
+
};
|
|
21126
|
+
}
|
|
21127
|
+
else {
|
|
21128
|
+
ambiente.valores[nome] = valorFinal;
|
|
21129
|
+
}
|
|
21059
21130
|
// Se o argumento é `DeleguaFuncao`, para habilitar o recurso de _currying_,
|
|
21060
21131
|
// copiamos seu valor para o escopo atual. Nem sempre podemos contar com a tipagem explícita aqui.
|
|
21061
21132
|
if (valorFinal &&
|
|
@@ -21135,6 +21206,30 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
21135
21206
|
}
|
|
21136
21207
|
}
|
|
21137
21208
|
exports.DeleguaFuncao = DeleguaFuncao;
|
|
21209
|
+
/**
|
|
21210
|
+
* Congela recursivamente vetores e objetos (dicionários), usados para
|
|
21211
|
+
* implementar parâmetros `fixo`: qualquer tentativa de mutação do valor,
|
|
21212
|
+
* mesmo através de um alias, deve resultar em erro em tempo de execução.
|
|
21213
|
+
* Não congela instâncias de classe, funções ou outras estruturas de Delégua,
|
|
21214
|
+
* pois isso quebraria comportamento esperado (ex.: métodos, `isto`).
|
|
21215
|
+
*/
|
|
21216
|
+
function congelarProfundamente(valor) {
|
|
21217
|
+
if (valor === null || typeof valor !== 'object') {
|
|
21218
|
+
return valor;
|
|
21219
|
+
}
|
|
21220
|
+
if (!Array.isArray(valor) && valor.constructor !== Object) {
|
|
21221
|
+
return valor;
|
|
21222
|
+
}
|
|
21223
|
+
if (Object.isFrozen(valor)) {
|
|
21224
|
+
return valor;
|
|
21225
|
+
}
|
|
21226
|
+
Object.freeze(valor);
|
|
21227
|
+
const valores = Array.isArray(valor) ? valor : Object.values(valor);
|
|
21228
|
+
for (const item of valores) {
|
|
21229
|
+
congelarProfundamente(item);
|
|
21230
|
+
}
|
|
21231
|
+
return valor;
|
|
21232
|
+
}
|
|
21138
21233
|
/**
|
|
21139
21234
|
* Mapeia o tipo JS de um valor primitivo para o nome de tipo de Delégua.
|
|
21140
21235
|
*/
|
|
@@ -21154,7 +21249,7 @@ function tipoDeDados(valor) {
|
|
|
21154
21249
|
}
|
|
21155
21250
|
}
|
|
21156
21251
|
|
|
21157
|
-
},{"../../declaracoes":117,"../../quebras":253,"../espaco-memoria":206,"./chamavel":207,"./objeto-delegua-classe":220}],212:[function(require,module,exports){
|
|
21252
|
+
},{"../../declaracoes":117,"../../inferenciador":151,"../../quebras":253,"../espaco-memoria":206,"./chamavel":207,"./objeto-delegua-classe":220,"./referencia-montao":222}],212:[function(require,module,exports){
|
|
21158
21253
|
"use strict";
|
|
21159
21254
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21160
21255
|
exports.DescritorTipoClasse = void 0;
|
|
@@ -22650,10 +22745,13 @@ class InterpretadorBase {
|
|
|
22650
22745
|
return avaliacaoAgrupamento;
|
|
22651
22746
|
}
|
|
22652
22747
|
eVerdadeiro(objeto) {
|
|
22653
|
-
if (objeto === null)
|
|
22748
|
+
if (objeto === null || objeto === undefined)
|
|
22654
22749
|
return false;
|
|
22655
22750
|
if (typeof objeto === primitivos_1.default.BOOLEANO)
|
|
22656
22751
|
return Boolean(objeto);
|
|
22752
|
+
if (typeof objeto === primitivos_1.default.NUMERO || typeof objeto === 'bigint') {
|
|
22753
|
+
return Boolean(objeto);
|
|
22754
|
+
}
|
|
22657
22755
|
if (objeto.hasOwnProperty('valor')) {
|
|
22658
22756
|
return Boolean(objeto.valor);
|
|
22659
22757
|
}
|
|
@@ -25807,6 +25905,9 @@ class Interpretador extends interpretador_base_1.InterpretadorBase {
|
|
|
25807
25905
|
}
|
|
25808
25906
|
objeto = this.resolverValor(objeto);
|
|
25809
25907
|
indice = this.resolverValor(indice);
|
|
25908
|
+
if (objeto && typeof objeto === 'object' && Object.isFrozen(objeto)) {
|
|
25909
|
+
return Promise.reject(new excecoes_1.ErroEmTempoDeExecucao(expressao.objeto.simbolo, 'Não é possível mutar um valor fixo.', expressao.linha));
|
|
25910
|
+
}
|
|
25810
25911
|
// Se o valor é uma referência ao montão, e o índice que a recebe é
|
|
25811
25912
|
// de uma variável/constante que vive num escopo superior, a referência
|
|
25812
25913
|
// precisa ser transferida para o escopo correspondente.
|
|
@@ -27921,8 +28022,9 @@ class LexadorPortugolIpt {
|
|
|
27921
28022
|
}
|
|
27922
28023
|
adicionarSimbolo(tipo, literal) {
|
|
27923
28024
|
const texto = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
27924
|
-
|
|
27925
|
-
const
|
|
28025
|
+
// `lexema` deve sempre ser texto. Ver comentário equivalente em `LexadorBase.adicionarSimbolo`.
|
|
28026
|
+
const lexema = (typeof literal === 'string' && literal.length > 0) ? literal : texto;
|
|
28027
|
+
const comprimentoLexema = lexema.length;
|
|
27926
28028
|
const comprimento = Math.max(comprimentoLexema, texto.length) || 1;
|
|
27927
28029
|
const colunaInicio = this.inicioSimbolo + 1;
|
|
27928
28030
|
const colunaFim = this.inicioSimbolo + comprimento;
|
|
@@ -29374,8 +29476,9 @@ class LexadorBaseLinhaUnica {
|
|
|
29374
29476
|
}
|
|
29375
29477
|
adicionarSimbolo(tipo, literal) {
|
|
29376
29478
|
const texto = this.codigo.substring(this.inicioSimbolo, this.atual);
|
|
29377
|
-
|
|
29378
|
-
const
|
|
29479
|
+
// `lexema` deve sempre ser texto. Ver comentário equivalente em `LexadorBase.adicionarSimbolo`.
|
|
29480
|
+
const lexema = (typeof literal === 'string' && literal.length > 0) ? literal : texto;
|
|
29481
|
+
const comprimentoLexema = lexema.length;
|
|
29379
29482
|
const comprimento = Math.max(comprimentoLexema, texto.length) || 1;
|
|
29380
29483
|
const colunaInicio = this.inicioSimbolo + 1;
|
|
29381
29484
|
const colunaFim = this.inicioSimbolo + comprimento;
|
|
@@ -29513,8 +29616,15 @@ class LexadorBase {
|
|
|
29513
29616
|
}
|
|
29514
29617
|
adicionarSimbolo(tipo, literal, ehNumeroReal) {
|
|
29515
29618
|
const texto = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
29516
|
-
|
|
29517
|
-
|
|
29619
|
+
// `lexema` deve sempre ser texto (o token como aparece no código-fonte).
|
|
29620
|
+
// Para símbolos de um só avanço (operadores compostos, por exemplo), `literal`
|
|
29621
|
+
// é passado como string e usado como `lexema` porque `texto` ainda está vazio
|
|
29622
|
+
// nesse ponto. Mas `literal` também pode ser um valor já convertido (número,
|
|
29623
|
+
// BigInt) para tokens como NUMERO — nesse caso `texto` é que deve virar o lexema,
|
|
29624
|
+
// nunca o valor bruto (ver `verificarDefinicaoTipoAtual`, que chama `.toLowerCase()`
|
|
29625
|
+
// em `lexema` esperando sempre uma string).
|
|
29626
|
+
const lexema = (typeof literal === 'string' && literal.length > 0) ? literal : texto;
|
|
29627
|
+
const comprimentoLexema = lexema.length;
|
|
29518
29628
|
const comprimento = Math.max(comprimentoLexema, texto.length) || 1;
|
|
29519
29629
|
const colunaInicio = this.inicioSimbolo + 1;
|
|
29520
29630
|
const colunaFim = this.inicioSimbolo + comprimento;
|
|
@@ -29611,8 +29721,9 @@ class Lexador extends lexador_base_1.LexadorBase {
|
|
|
29611
29721
|
}
|
|
29612
29722
|
adicionarSimbolo(tipo, literal = null, ehNumeroReal) {
|
|
29613
29723
|
const texto = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
29614
|
-
|
|
29615
|
-
const
|
|
29724
|
+
// `lexema` deve sempre ser texto. Ver comentário equivalente em `LexadorBase.adicionarSimbolo`.
|
|
29725
|
+
const lexema = (typeof literal === 'string' && literal.length > 0) ? literal : texto;
|
|
29726
|
+
const comprimento = Math.max(lexema.length, texto.length) || 1;
|
|
29616
29727
|
this.simbolos.push(new simbolo_1.Simbolo(tipo, lexema, literal, this.linha + 1, this.hashArquivo, this.inicioSimbolo + 1, this.inicioSimbolo + comprimento, undefined, ehNumeroReal));
|
|
29617
29728
|
}
|
|
29618
29729
|
verificarEAvancar(esperado) {
|
|
@@ -30262,8 +30373,9 @@ class MicroLexadorPitugues {
|
|
|
30262
30373
|
}
|
|
30263
30374
|
adicionarSimbolo(tipo, literal = null) {
|
|
30264
30375
|
const texto = this.codigo.substring(this.inicioSimbolo, this.atual);
|
|
30265
|
-
|
|
30266
|
-
const
|
|
30376
|
+
// `lexema` deve sempre ser texto. Ver comentário equivalente em `LexadorBase.adicionarSimbolo`.
|
|
30377
|
+
const lexema = (typeof literal === 'string' && literal.length > 0) ? literal : texto;
|
|
30378
|
+
const comprimentoLexema = lexema.length;
|
|
30267
30379
|
const comprimento = Math.max(comprimentoLexema, texto.length) || 1;
|
|
30268
30380
|
const colunaInicio = this.inicioSimbolo + 1;
|
|
30269
30381
|
const colunaFim = this.inicioSimbolo + comprimento;
|
|
@@ -30478,8 +30590,9 @@ class MicroLexador {
|
|
|
30478
30590
|
}
|
|
30479
30591
|
adicionarSimbolo(tipo, literal = null) {
|
|
30480
30592
|
const texto = this.codigo.substring(this.inicioSimbolo, this.atual);
|
|
30481
|
-
|
|
30482
|
-
const
|
|
30593
|
+
// `lexema` deve sempre ser texto. Ver comentário equivalente em `LexadorBase.adicionarSimbolo`.
|
|
30594
|
+
const lexema = (typeof literal === 'string' && literal.length > 0) ? literal : texto;
|
|
30595
|
+
const comprimentoLexema = lexema.length;
|
|
30483
30596
|
const comprimento = Math.max(comprimentoLexema, texto.length) || 1;
|
|
30484
30597
|
const colunaInicio = this.inicioSimbolo + 1;
|
|
30485
30598
|
const colunaFim = this.inicioSimbolo + comprimento;
|