Пример #1
0
class Decl(FooNode):
    names = Field()
    env_spec = EnvSpec(do(PropertyError(T.FooNode)), add_env())

    @langkit_property(public=True)
    def lookup(n=T.Name.entity):
        return Entity.node_env.get_first(n.symbol)
Пример #2
0
 def resolve(lhs=T.FooNode.entity, rhs=T.FooNode.entity):
     eq = Var(
         All([
             NPropagate(Self.v, T.Literal.combiner, Self.lhs.v, Self.rhs.v),
             Bind(Self.lhs.v, lhs),
             Bind(Self.rhs.v, rhs),
         ]))
     return If(eq.solve, Self.v.get_value,
               PropertyError(T.FooNode.entity, "unreachable"))
Пример #3
0
class Scope(Def):
    error = Field()
    name = Field()
    defs = Field()

    env_spec = EnvSpec(
        add_to_env(New(T.env_assoc, key=Self.name.symbol, val=Self)),
        add_env(),
        do(If(Self.error.as_bool, PropertyError(T.FooNode), No(T.FooNode))),
    )
Пример #4
0
 def raise_no_msg():
     return PropertyError(T.Bool)
Пример #5
0
 def raise_msg():
     return PropertyError(T.Bool, 'Custom error message!')
Пример #6
0
 def internal_mmz_prop(i=T.Int):
     return If(i == 0, PropertyError(T.Int), i)
Пример #7
0
 def failing_property():
     return PropertyError(T.Bool)
Пример #8
0
 def prop2():
     return PropertyError(Bool, 'Explicit error 2')
Пример #9
0
 def prop1():
     ignore(Var(Self.singleton))
     return PropertyError(Bool, 'Explicit error 1')
Пример #10
0
 def resolve():
     return PropertyError(T.LexicalEnv, "unconditionally raised")
Пример #11
0
 def resolve():
     return PropertyError(T.LexicalEnv)