def generate(self, spec: Spec, fp: IO) -> None: file = SourceFile([ Class("MyClass", [ DocComment("Member", [ Annotation.param("myProperty1", "This is a description") ]), Member([AccessModifier.public(), StaticModifier()], VariableDeclaration("myProperty1", Type.string())), Member([AccessModifier.public(), StaticModifier()], VariableDeclaration("myProperty2", Type.instance("Date"))), Member([AccessModifier.public(), StaticModifier()], VariableDeclaration("myProperty3", Type.null())), Member([AccessModifier.public(), StaticModifier()], VariableDeclaration("myProperty3", Type.undefined())), Method([AccessModifier.public()], FunctionDeclaration( "myMethod1", Type.instance("Date"), ArgumentList([ Argument("arg1", Type.string()), Argument("arg2", Type.boolean()), Argument("arg3", Type.instance("Date")), ])), [ UnaryAssignment( Accessor.series([ ThisAccessor( Scope(Type.instance("MyClass"))), Accessor("foo", Type.instance("Foo")), Accessor("bar", Type.instance("Bar")), Accessor("baz", Type.instance("Baz")), Accessor("val", Type.string()), ]), AnyEvaluation("123", Type.number())) ]) ]) ]) print(file.print())
def instanceof(): return UnaryOperator("instanceof", Type.boolean())
def not_double_equal(): return UnaryOperator("!=", Type.boolean())
def not_triple_equal(): return UnaryOperator("!==", Type.boolean())
def less_than_or_equal(): return UnaryOperator("<=", Type.boolean())
def less_than(): return UnaryOperator("<", Type.boolean())
def great_than_or_equal(): return UnaryOperator(">=", Type.boolean())
def great_than(): return UnaryOperator(">", Type.boolean())
def double_equal(): return UnaryOperator("==", Type.boolean())
def triple_equal(): return UnaryOperator("===", Type.boolean())