Created
November 24, 2011 17:51
-
-
Save realjenius/1391909 to your computer and use it in GitHub Desktop.
Method Inference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MethodDefinition | |
def infer(typer) | |
forced_type = @return_type | |
inferred_type = @body.infer(typer) | |
actual_type = if forced_type.nil? | |
inferred_type | |
else | |
forced_type | |
end | |
if !actual_type.is_parent(inferred_type) | |
raise "inference error" | |
end | |
return actual_type | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment