# Martes 2023/03/28
# Summary
type checking
# Announcements
Cambios en el Plan Docente de la Asignatura
El profesor Javier Hernández se incorpora a la docencia práctica de la asignatura en esta semana
# Tópicos
En esta clase hablamos de:
Lab Functions
The lookup method:
// ... class Scope { // ... // Returns the scope where the variable is declared or null if not found lookup(name) { if (this.has(name)) return this; if (this.parent) return this.parent.lookup(name); return null; } // Return the set of not declared variables notDeclared() { let notDeclared = difference(this.used, this.initialized); for(let v of this.used) { let s = this.lookup(v); if (s) notDeclared.delete(v); } return notDeclared; } notDeclaredMessage() { let d = this.notDeclared(); if (d.size > 0) { return Array.from(d). map(x => x.replace(/^[$]/, '')). map(x => `Not declared variable '${x}'`).join(',') } return null; } // ... } module.exports = Scope;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Related labs
Prácticas en curso: