示例#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
文件: test.py 项目: pmderodat/langkit
 def resolve():
     return PropertyError(T.LexicalEnv, "unconditionally raised")
示例#11
0
 def resolve():
     return PropertyError(T.LexicalEnv)