about summary refs log tree commit diff
path: root/pkg/lang/compiler/scope/scope_chain.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/lang/compiler/scope/scope_chain.go')
-rw-r--r--pkg/lang/compiler/scope/scope_chain.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/lang/compiler/scope/scope_chain.go b/pkg/lang/compiler/scope/scope_chain.go
index 1b83c75..f386017 100644
--- a/pkg/lang/compiler/scope/scope_chain.go
+++ b/pkg/lang/compiler/scope/scope_chain.go
@@ -72,6 +72,16 @@ func (sc *ScopeChain) EnterFunction(unit code.Marker) {
 	sc.functionScopes = append(sc.functionScopes, NewFunctionScope(sc.CurrentScopeID(), unit))
 }
 
+func (sc *ScopeChain) EnterConstructor(unit code.Marker, thisLocal int) {
+	sc.Enter()
+	sc.functionScopes = append(sc.functionScopes, NewMethodFunctionScope(sc.CurrentScopeID(), unit, thisLocal))
+}
+
+func (sc *ScopeChain) EnterMethod(unit code.Marker) {
+	sc.Enter()
+	sc.functionScopes = append(sc.functionScopes, NewMethodFunctionScope(sc.CurrentScopeID(), unit, -1))
+}
+
 func (sc *ScopeChain) EnterLoop() (code.Marker, code.Marker) {
 	parentMarker := sc.CreateAnonymousFunctionSubUnit()