diff options
| author | Mel <einebeere@gmail.com> | 2022-07-28 22:11:02 +0000 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-07-28 22:11:02 +0000 |
| commit | 5a6d4664e4417763b4a7d9f215e42102fa1b3fd4 (patch) | |
| tree | 525f8151bd1bb604ce015425126c5f3dfc84a32c /pkg/lang/compiler/scope/scope_chain.go | |
| parent | 95c742ef729a657198be43dc2f295f249860332f (diff) | |
| download | jinx-5a6d4664e4417763b4a7d9f215e42102fa1b3fd4.tar.zst jinx-5a6d4664e4417763b4a7d9f215e42102fa1b3fd4.zip | |
Compile type declarations correctly
Diffstat (limited to 'pkg/lang/compiler/scope/scope_chain.go')
| -rw-r--r-- | pkg/lang/compiler/scope/scope_chain.go | 10 |
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() |
