Class: Mirah::AST::JsniMethodDefinition
- Inherits:
-
MethodDefinition
- Object
- Node
- MethodDefinition
- Mirah::AST::JsniMethodDefinition
- Defined in:
- lib/mirah/plugin/gwt.rb
Instance Attribute Summary
Attributes inherited from MethodDefinition
#abstract, #defining_class, #exceptions, #return_type, #visibility
Attributes included from Scope
Attributes included from Named
Attributes included from Annotated
Attributes inherited from Node
#children, #inferred_type, #newline, #parent, #position
Instance Method Summary collapse
-
#abstract? ⇒ Boolean
JSNI can’t be abstract.
- #compile(compiler, expression) ⇒ Object
- #infer(typer, expression) ⇒ Object
-
#initialize(static, parent, line_number, name, annotations = [], &block) ⇒ JsniMethodDefinition
constructor
A new instance of JsniMethodDefinition.
- #static? ⇒ Boolean
Methods inherited from MethodDefinition
Methods included from Binding
#binding_type, #binding_type=, #has_binding?
Methods included from ClassScoped
Methods included from Scoped
Methods included from Named
#string_value, #to_s, #validate_name
Methods included from Annotated
Methods inherited from Node
#<<, ===, #[], #[]=, #_dump, _load, #_set_parent, child, child_name, #child_nodes, #each, #empty?, #expr?, #inferred_type!, #initialize_copy, #insert, #inspect, #inspect_children, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #string_value, #temp, #to_s, #top_level?, #validate_child, #validate_children
Constructor Details
#initialize(static, parent, line_number, name, annotations = [], &block) ⇒ JsniMethodDefinition
Returns a new instance of JsniMethodDefinition.
101 102 103 104 |
# File 'lib/mirah/plugin/gwt.rb', line 101 def initialize(static, parent, line_number, name, annotations=[], &block) super(parent, line_number, name, annotations, &block) @static = static end |
Instance Method Details
#abstract? ⇒ Boolean
JSNI can’t be abstract.
130 131 132 |
# File 'lib/mirah/plugin/gwt.rb', line 130 def abstract? false end |
#compile(compiler, expression) ⇒ Object
106 107 108 |
# File 'lib/mirah/plugin/gwt.rb', line 106 def compile(compiler, expression) compiler.define_jsni_method(self) end |
#infer(typer, expression) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/mirah/plugin/gwt.rb', line 110 def infer(typer, expression) @static ||= scope.static_scope.self_type. unless scope.nil? @defining_class ||= begin static_scope.self_node = :self static_scope.self_type = if static? scope.static_scope.self_type. else scope.static_scope.self_type end end resolve_if(typer) do argument_types = typer.infer(arguments, true) if argument_types.all? typer.learn_method_type(defining_class, name, argument_types, signature[:return], signature[:throws]) end end end |