File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -1267,11 +1267,6 @@ def validate(self):
12671267 if not isinstance (self .target , Name ):
12681268 raise VariableDeclarationException ("Invalid variable declaration" , self .target )
12691269
1270- if self .value is None :
1271- raise VariableDeclarationException (
1272- "Local variables must be declared with an initial value" , self
1273- )
1274-
12751270
12761271class VariableDecl (VyperNode ):
12771272 """
Original file line number Diff line number Diff line change 1717 StructureException ,
1818 TypeCheckFailure ,
1919 TypeMismatch ,
20+ VariableDeclarationException ,
2021 VyperException ,
2122)
2223from vyper .semantics .analysis .base import (
@@ -325,12 +326,12 @@ def visit(self, node):
325326 super ().visit (node )
326327
327328 def visit_AnnAssign (self , node ):
328- name = node .target .id
329-
330- # sanity check postconditions of AnnAssign.validate()
331- assert isinstance (node .target , vy_ast .Name )
332- assert node .value is not None
329+ if node .value is None :
330+ raise VariableDeclarationException (
331+ "Local variables must be declared with an initial value"
332+ )
333333
334+ name = node .target .id
334335 typ = type_from_annotation (node .annotation , DataLocation .MEMORY )
335336
336337 # validate the value before adding it to the namespace
You can’t perform that action at this time.
0 commit comments