Codebase list golang-github-tdewolff-parse / e247035
JS: small speed improvement for typescript.js of ~1% Taco de Wolff 1 year, 11 months ago
1 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
280280 for i, vorig := range s.Undeclared {
281281 // no need to evaluate vorig.Link as vorig.Data stays the same
282282 if 0 < vorig.Uses && vorig.Decl == NoDecl {
283 if v := s.Parent.findDeclared(vorig.Data, false); v != nil {
284 // check if variable is declared in parent scope
283 if v := s.Parent.findUndeclared(vorig.Data); v != nil {
284 // check if variable is already used before in parent scope
285285 v.Uses += vorig.Uses
286286 vorig.Link = v
287287 s.Undeclared[i] = v // point reference to existing var (to avoid many Link chains)
288 } else if v := s.Parent.findUndeclared(vorig.Data); v != nil {
289 // check if variable is already used before in parent scope
288 } else if v := s.Parent.findDeclared(vorig.Data, false); v != nil {
289 // check if variable is declared in parent scope
290290 v.Uses += vorig.Uses
291291 vorig.Link = v
292292 s.Undeclared[i] = v // point reference to existing var (to avoid many Link chains)
305305 for _, vorig := range s.Declared {
306306 // no need to evaluate vorig.Link as vorig.Data stays the same, and Link is always nil in Declared
307307 // vorig.Uses will be atleast 1
308 if v := s.Parent.findDeclared(vorig.Data, false); v != nil {
309 // check if variable has been declared in this scope
308 if v := s.Parent.findUndeclared(vorig.Data); v != nil {
309 // check if variable is already used before in the current or lower scopes
310310 v.Uses += vorig.Uses
311311 vorig.Link = v
312 } else if v := s.Parent.findUndeclared(vorig.Data); v != nil {
313 // check if variable is already used before in the current or lower scopes
312 } else if v := s.Parent.findDeclared(vorig.Data, false); v != nil {
313 // check if variable has been declared in this scope
314314 v.Uses += vorig.Uses
315315 vorig.Link = v
316316 } else {