--- a/compiler/TCompilerContext.st Wed Sep 23 22:21:44 2015 +0100
+++ b/compiler/TCompilerContext.st Fri Sep 25 03:51:15 2015 +0100
@@ -1,14 +1,45 @@
+"
+ Copyright (C) 2015-now Jan Vrany
+
+ This code is not an open-source (yet). You may use this code
+ for your own experiments and projects, given that:
+
+ * all modification to the code will be sent to the
+ original author for inclusion in future releases
+ * this is not used in any commercial software
+
+ This license is provisional and may (will) change in
+ a future.
+"
"{ Package: 'jv:tea/compiler' }"
"{ NameSpace: Smalltalk }"
-Object subclass:#TCompilerContext
- instanceVariableNames:'environment unit module'
+TObjectWithProperties subclass:#TCompilerContext
+ instanceVariableNames:'options environment unit'
classVariableNames:''
poolDictionaries:''
category:'Languages-Tea-Compiler'
!
+!TCompilerContext class methodsFor:'documentation'!
+
+copyright
+"
+ Copyright (C) 2015-now Jan Vrany
+
+ This code is not an open-source (yet). You may use this code
+ for your own experiments and projects, given that:
+
+ * all modification to the code will be sent to the
+ original author for inclusion in future releases
+ * this is not used in any commercial software
+
+ This license is provisional and may (will) change in
+ a future.
+"
+! !
+
!TCompilerContext methodsFor:'accessing'!
environment
@@ -19,13 +50,19 @@
environment := aTNamespaceDefinition.
!
-module
- module isNil ifTrue:[
- module := LLVMModule newWithName: unit name.
+options
+ options isNil ifTrue:[
+ options := TCompilerOptions new
].
- ^ module
+ ^ self.
+
+ "Created: / 24-09-2015 / 16:17:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
- "Modified: / 30-08-2015 / 09:25:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+options: aTCompilerOptions
+ options := aTCompilerOptions
+
+ "Created: / 24-09-2015 / 16:17:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
unit
@@ -36,6 +73,27 @@
unit := aTCompilationUnit.
! !
+!TCompilerContext methodsFor:'accessing - llvm'!
+
+llvmModule
+ | module |
+
+ module := self propertyAt: #llvmModule ifAbsentPut: [ nil ].
+ module isNil ifTrue:[
+ module := LLVMModule newWithName: unit name.
+ self llvmModule: module.
+ ].
+ ^ module.
+
+ "Created: / 24-09-2015 / 16:18:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+llvmModule: anLLVMModule
+ ^ self propertyAt: #llvmModule put: anLLVMModule
+
+ "Created: / 24-09-2015 / 17:05:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!TCompilerContext methodsFor:'error reporting'!
reportSemanticError: message