@@ -32,19 +32,25 @@ type identifiers []identifier
32
32
33
33
type astNode interface {
34
34
Loc () * LocationRange
35
+ FreeVariables () identifiers
35
36
}
36
37
type astNodes []astNode
37
38
38
39
// ---------------------------------------------------------------------------
39
40
40
41
type astNodeBase struct {
41
- loc LocationRange
42
+ loc LocationRange
43
+ freeVariables identifiers
42
44
}
43
45
44
46
func (n * astNodeBase ) Loc () * LocationRange {
45
47
return & n .loc
46
48
}
47
49
50
+ func (n * astNodeBase ) FreeVariables () identifiers {
51
+ return n .freeVariables
52
+ }
53
+
48
54
// ---------------------------------------------------------------------------
49
55
50
56
// +gen stringer
@@ -386,7 +392,15 @@ type astObjectField struct {
386
392
expr2 , expr3 astNode // In scope of the object (can see self).
387
393
}
388
394
389
- // TODO(jbeda): Add constructor helpers here
395
+ // TODO(jbeda): Add the remaining constructor helpers here
396
+
397
+ func astObjectFieldLocal (methodSugar bool , id * identifier , ids identifiers , trailingComma bool , body astNode ) astObjectField {
398
+ return astObjectField {astObjectLocal , astObjectFieldVisible , false , methodSugar , nil , id , ids , trailingComma , body , nil }
399
+ }
400
+
401
+ func astObjectFieldLocalNoMethod (id * identifier , body astNode ) astObjectField {
402
+ return astObjectField {astObjectLocal , astObjectFieldVisible , false , false , nil , id , identifiers {}, false , body , nil }
403
+ }
390
404
391
405
type astObjectFields []astObjectField
392
406
@@ -503,8 +517,7 @@ type astUnary struct {
503
517
// astVar represents variables.
504
518
type astVar struct {
505
519
astNodeBase
506
- id identifier
507
- original identifier
520
+ id identifier
508
521
}
509
522
510
523
// ---------------------------------------------------------------------------
0 commit comments