1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //
- // XCTLRuntimeAbstractContext.swift
- // notebook
- //
- // Created by 邢铖 on 2023/5/25.
- //
- import Foundation
- internal class XCTLRuntimeVariableStackFrame {
-
- private var stack = [XCTLRuntimeVariable]()
-
- internal func pushVariable(_ variable: XCTLRuntimeVariable) {
- self.stack.append(variable)
- }
-
- internal func popVariable() -> XCTLRuntimeVariable? {
- self.stack.popLast()
- }
-
- internal var isEmpty: Bool {
- return self.stack.isEmpty
- }
-
- }
- internal protocol XCTLRuntimeAbstractContext: AnyObject {
-
- var nativeObjectInstance: NSObject { get }
-
- func valueDefined(_ name: String) -> Bool
- func value(forName name: String) -> XCTLRuntimeVariable?
- func setValue(_ value: XCTLRuntimeVariable, forName name: String)
- func setValueToRoot(_ value: XCTLRuntimeVariable, forName name: String, assumeExport export: Bool)
- func setValueToRootAssumeExport(_ value: XCTLRuntimeVariable, forName name: String)
- func setValueIgnoreParent(_ value: XCTLRuntimeVariable, forName name: String)
-
- func addImport(name: String)
- func addExport(name: String)
- func hasExport(name: String) -> Bool
-
- func allocateObject(name: String, args: [XCTLRuntimeVariable]) throws -> XCTLRuntimeVariable
- func addLazyStatement(_ stmt: XCTLReferencedVariableStatement)
-
- func makeSubContext() -> XCTLRuntimeAbstractContext
-
- func findConditionFrame() -> XCTLConditionParentStatementFrame?
- func findListFrame() -> XCTLListStatementFrame?
- func findForFrame() -> XCTLForStatementFrame?
- func recordConditionFrame(_ frame: XCTLConditionParentStatementFrame?)
- func recordListFrame(_ frame: XCTLListStatementFrame?)
- func recordForFrame(_ frame: XCTLForStatementFrame?)
-
- func getParentContext() -> XCTLRuntimeAbstractContext?
-
- var variableStack: XCTLRuntimeVariableStackFrame { get set }
-
- }
|