| 689 | | |
| 690 | | def _bindImp is override |
| 691 | | base._bindImp |
| | 671 | |
| | 672 | def _bindInt is override |
| | 673 | assert .compiler.codeMemberStack.peek is this |
| | 674 | base._bindInt |
| | 675 | assert .parentBox.didUnNilReturnTypes |
| | 676 | for param in _params, param.bindInt |
| | 677 | if _returnType is nil |
| | 678 | if _returnTypeNode, _returnType = _returnTypeNode.realType |
| | 679 | else, _returnType = .compiler.voidType |
| | 680 | assert _returnType, _returnTypeNode |
| | 681 | if _requirePart is nil and .willRequire, _requirePart = RequirePart(this) |
| | 682 | if _requirePart, _requirePart.bindInt |
| | 683 | if _ensurePart is nil and .willEnsure, _ensurePart = EnsurePart(this) |
| | 684 | if _ensurePart, _ensurePart.bindInt |
| | 685 | |
| | 686 | def bindImp as dynamic |
| 694 | | .computeMatchingBaseMember # cannot currently go in .bindInt because it uses .memberForName which triggers other things like generic construction completion |
| 695 | | if .matchingBaseMember and 'override' in .isNames and 'private' in .matchingBaseMember.isNames |
| 696 | | .recordError('Cannot override the base member which is declared "private".') |
| 697 | | for param in _params |
| 698 | | param.bindImp |
| 699 | | for local in _locals |
| 700 | | local.bindImp |
| 701 | | if _requirePart |
| 702 | | _requirePart.bindImp |
| 703 | | if _ensurePart and _returnType and _returnType is not .compiler.voidType |
| 704 | | _sharpResultVarName = '_lh_result' |
| 705 | | else |
| 706 | | _sharpResultVarName = '' |
| 707 | | _curStmtIndex = 0 |
| 708 | | for stmt in _stmts.toArray |
| 709 | | try |
| 710 | | stmt.bindImp |
| 711 | | stmt.afterStatementBindImp # to let expressions know when they are used as statements |
| 712 | | catch ne as NodeException |
| 713 | | .compiler.recordError(ne) |
| 714 | | _curStmtIndex += 1 |
| 715 | | for param in _params |
| 716 | | assert param.ifInheritsStack.count == 0 |
| 717 | | if _ensurePart |
| 718 | | _ensurePart.bindImp |
| 719 | | if _requirePart |
| 720 | | _requirePart.checkConnectToken |
| 721 | | if _ensurePart |
| 722 | | _ensurePart.checkConnectToken |
| 723 | | .checkForUnmarkedOverrideOrNew # have to do this after statements bindImp since using base can add `override` |
| 724 | | .checkForUnusedVariables |
| | 689 | return base.bindImp |
| | 692 | |
| | 693 | def _bindImp is override |
| | 694 | assert .compiler.codeMemberStack.peek is this |
| | 695 | base._bindImp |
| | 696 | .computeMatchingBaseMember # cannot currently go in .bindInt because it uses .memberForName which triggers other things like generic construction completion |
| | 697 | if .matchingBaseMember and 'override' in .isNames and 'private' in .matchingBaseMember.isNames |
| | 698 | .recordError('Cannot override the base member which is declared "private".') |
| | 699 | for param in _params |
| | 700 | param.bindImp |
| | 701 | for local in _locals |
| | 702 | local.bindImp |
| | 703 | if _requirePart |
| | 704 | _requirePart.bindImp |
| | 705 | if _ensurePart and _returnType and _returnType is not .compiler.voidType |
| | 706 | _sharpResultVarName = '_lh_result' |
| | 707 | else |
| | 708 | _sharpResultVarName = '' |
| | 709 | _curStmtIndex = 0 |
| | 710 | for stmt in _stmts.toArray |
| | 711 | try |
| | 712 | stmt.bindImp |
| | 713 | stmt.afterStatementBindImp # to let expressions know when they are used as statements |
| | 714 | catch ne as NodeException |
| | 715 | .compiler.recordError(ne) |
| | 716 | _curStmtIndex += 1 |
| | 717 | for param in _params |
| | 718 | assert param.ifInheritsStack.count == 0 |
| | 719 | if _ensurePart |
| | 720 | _ensurePart.bindImp |
| | 721 | if _requirePart |
| | 722 | _requirePart.checkConnectToken |
| | 723 | if _ensurePart |
| | 724 | _ensurePart.checkConnectToken |
| | 725 | .checkForUnmarkedOverrideOrNew # have to do this after statements bindImp since using base can add `override` |
| | 726 | .checkForUnusedVariables |
| 1016 | | .compiler.codeMemberStack.push(this) |
| 1017 | | try |
| 1018 | | assert .compiler.codeMemberStack.peek is this |
| 1019 | | for param in _genericParams |
| 1020 | | param.bindInt |
| 1021 | | base._bindInt |
| 1022 | | if .name == '__init__' |
| 1023 | | .compiler.warning(this, 'Initializers are named "init" with no surrounding underscores.') |
| 1024 | | finally |
| 1025 | | .compiler.codeMemberStack.pop |
| | 1016 | assert .compiler.codeMemberStack.peek is this |
| | 1017 | for param in _genericParams, param.bindInt |
| | 1018 | base._bindInt |
| | 1019 | if .name == '__init__', .compiler.warning(this, 'Initializers are named "init" with no surrounding underscores.') |