Skip to content

Commit 638fe5b

Browse files
committed
native_ast has a proper type on GlobalVariable's metadata.
1 parent f2e3ad7 commit 638fe5b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

typed_python/compiler/native_compiler/native_ast.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typed_python.compiler.native_compiler.global_variable_definition import (
16+
GlobalVariableMetadata
17+
)
1518
from typed_python import Tuple, TupleOf, Alternative, NamedTuple, OneOf, Forward
1619
import textwrap
1720

@@ -609,7 +612,7 @@ def expr_could_throw(self):
609612
Sequence={'vals': TupleOf(Expression)},
610613
ActivatesTeardown={'name': str},
611614
StackSlot={'name': str, 'type': Type},
612-
GlobalVariable={'name': str, 'type': Type, 'metadata': object},
615+
GlobalVariable={'name': str, 'type': Type, 'metadata': GlobalVariableMetadata},
613616
ApplyIntermediates={'base': Expression, 'intermediates': TupleOf(ExpressionIntermediate)},
614617
ElementPtrIntegers=lambda self, *offsets:
615618
Expression.ElementPtr(

typed_python/compiler/native_compiler/native_compiler_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def test_global_variable_pointers():
3333
arg=Expression.GlobalVariable(
3434
name="globalvar",
3535
type=Int64,
36-
metadata='aGlobal'
36+
metadata=GlobalVariableMetadata.StringConstant(
37+
value='aGlobal'
38+
)
3739
).load()
3840
)
3941
)
@@ -47,7 +49,9 @@ def test_global_variable_pointers():
4749
arg=Expression.GlobalVariable(
4850
name="globalvar",
4951
type=Int64,
50-
metadata='aGlobal'
52+
metadata=GlobalVariableMetadata.StringConstant(
53+
value='aGlobal'
54+
)
5155
)
5256
)
5357
)

0 commit comments

Comments
 (0)