Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed May 1, 2024
1 parent 3f684ea commit df875cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion WDL/Expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,8 @@ class Get(Base):

def __init__(self, pos: SourcePosition, expr: Base, member: Optional[str]) -> None:
super().__init__(pos)
assert expr
assert isinstance(expr, Base)
assert isinstance(member, (str, type(None)))
self.expr = expr
self.member = member

Expand Down
2 changes: 1 addition & 1 deletion WDL/Value.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def from_json(type: Type.Base, value: Any) -> Base:
raise Error.InputError(
f"couldn't initialize struct {str(type)} {type.members[k]} {k} from {json.dumps(v)}"
) from None
return Struct(Type.Object(type.members), items, extra=extra)
return Struct(type, items, extra=extra)
if type.optional and value is None:
return Null()
raise Error.InputError(f"couldn't construct {str(type)} from {json.dumps(value)}")
Expand Down
4 changes: 2 additions & 2 deletions WDL/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ def left_name(self, meta, items) -> Expr.Base:
return Expr.Get(self._sp(meta), Expr._LeftName(self._sp(meta), items[0]), None)

def get_name(self, meta, items) -> Expr.Base:
assert len(items) == 2 and isinstance(items[0], Expr.Base) and isinstance(items[1], str)
return Expr.Get(self._sp(meta), items[0], items[1])
assert len(items) == 2 and isinstance(items[0], Expr.Base) and isinstance(items[1].value, str)
return Expr.Get(self._sp(meta), items[0], items[1].value)


# _ExprTransformer infix operators
Expand Down

0 comments on commit df875cd

Please sign in to comment.