Browse files

Re-enable hash_test.rb

  • Loading branch information...
1 parent c43ce7a commit 6223111e5f6d564da216b2b89b9e43de5be29254 @ribrdb ribrdb committed Apr 20, 2012
View
1 lib/mirah/compiler.rb
@@ -36,7 +36,6 @@ def compile_asts(nodes, scoper, typer)
end
def compile_ast(ast, scoper, typer, &block)
- typer.verifier.scan(ast, ast)
@compiler = compiler_class.new(scoper, typer)
compiler.visit(ast, nil)
compiler.generate(&block)
View
2 lib/mirah/generator.rb
@@ -65,8 +65,6 @@ def infer_asts(nodes, should_raise=false)
end
process_inference_errors(@typer, nodes, &error_handler)
rescue NativeException => ex
- ex.cause.printStackTrace
- sleep(1)
log("Caught exception during type inference", ex.cause)
raise ex
ensure
View
2 lib/mirah/jvm/types/boolean.rb
@@ -35,7 +35,7 @@ def add_intrinsics
end
def math_type
- Boolean
+ @type_system.type(nil, 'boolean')
end
# same as NumberType's
View
4 lib/mirah/jvm/types/factory.rb
@@ -80,9 +80,9 @@ def maybe_initialize_builtins(compiler)
begin
Builtins.initialize_builtins(compiler)
rescue NativeException => ex
- log("Error initializing builtins", ex.cause)
+ error("Error initializing builtins", ex.cause)
rescue => ex
- log("Error initializing builtins: #{ex.message}\n\t#{ex.backtrace.join("\n\t")}")
+ error("Error initializing builtins: #{ex.message}\n\t#{ex.backtrace.join("\n\t")}")
end
else
warning "Unable to initialize builtins"
View
30 src/org/mirah/typer/futures.mirah
@@ -251,36 +251,6 @@ class AssignableTypeFuture < BaseTypeFuture
end
end
-class MaybeInline < BaseTypeFuture
- def initialize(n:Node, type:TypeFuture, altNode:Node, altType:TypeFuture)
- super(n.position)
- node = n
- @inlined = false
- me = self
- altType.onUpdate do |x, value|
- if me.inlined || value.name != ':error'
- unless me.inlined
- me.inlined = true
- node.parent.replaceChild(node, altNode)
- end
- me.resolved(value)
- end
- end
- type.onUpdate do |x, value|
- unless me.inlined
- me.resolved(value)
- end
- end
- end
-
- def inlined=(inlined:boolean):void
- @inlined = inlined
- end
- def inlined:boolean
- @inlined
- end
-end
-
interface PickerListener do
def picked(selection:TypeFuture, value:Object):void; end
end
View
33 src/org/mirah/typer/typer.mirah
@@ -43,7 +43,6 @@ class Typer < SimpleNodeVisitor
@scopes = scopes
@closures = ClosureBuilder.new(self)
@macros = MacroBuilder.new(self, jvm_backend)
- @verifier = AstVerifier.new
end
def macro_compiler
@@ -58,10 +57,6 @@ class Typer < SimpleNodeVisitor
@scopes
end
- def verifier:NodeScanner
- @verifier
- end
-
def getInferredType(node:Node)
TypeFuture(@futures[node])
end
@@ -153,7 +148,6 @@ class Typer < SimpleNodeVisitor
typer.logger.fine("Unable to replace #{current_node} with #{node}")
else
node = current_node.parent.replaceChild(current_node, node)
- typer.verifier.scan(node, node)
future.type = typer.infer(node, expression != nil)
end
current_node = node
@@ -178,7 +172,6 @@ class Typer < SimpleNodeVisitor
typer.logger.fine("Expanding macro #{call}")
node = InlineCode(resolvedType).expand(call, typer)
node = call.parent.replaceChild(call, node)
- typer.verifier.scan(node, node)
delegate.type = typer.infer(node, expression != nil)
else
delegate.type = methodType
@@ -199,7 +192,6 @@ class Typer < SimpleNodeVisitor
if arg != nil
# We chose the cast.
call.parent.replaceChild(call, cast)
- typer.verifier.scan(cast, cast)
typer.infer(cast, expression != nil)
end
end)
@@ -224,7 +216,6 @@ class Typer < SimpleNodeVisitor
newNode = Node(call)
end
newNode = assignment.parent.replaceChild(assignment, newNode)
- @verifier.scan(newNode, newNode)
infer(newNode)
end
@@ -242,7 +233,6 @@ class Typer < SimpleNodeVisitor
typer.logger.fine("Expanding macro #{call}")
node = InlineCode(resolvedType).expand(call, typer)
node = call.parent.replaceChild(call, node)
- typer.verifier.scan(node, node)
delegate.type = typer.infer(node, expression != nil)
else
delegate.type = methodType
@@ -278,7 +268,6 @@ class Typer < SimpleNodeVisitor
TypeFuture(PickFirst.new(items) do |type, arg|
if arg != nil
call.parent.replaceChild(call, newNode)
- typer.verifier.scan(newNode, newNode)
typer.infer(newNode, expression != nil)
end
end)
@@ -675,12 +664,10 @@ class Typer < SimpleNodeVisitor
end
def visitScript(script, expression)
- @verifier.scan(script, script)
scope = @scopes.addScope(script)
@types.addDefaultImports(scope)
scope.selfType = @types.getMainType(scope, script)
type = infer(script.body, false)
- @verifier.scan(script, script)
type
end
@@ -731,7 +718,6 @@ class Typer < SimpleNodeVisitor
NodeList.new(node.position, nodes)
end
replacement = node.parent.replaceChild(node, replacement)
- @verifier.scan(replacement, replacement)
infer(replacement, expression != nil)
end
@@ -745,7 +731,6 @@ class Typer < SimpleNodeVisitor
replacement = LocalAssignment.new(node.position, node.name, node.value)
end
replacement = node.parent.replaceChild(node, replacement)
- @verifier.scan(replacement, replacement)
infer(replacement, expression != nil)
end
@@ -921,7 +906,6 @@ class Typer < SimpleNodeVisitor
else
new_node.setParent(nil)
parent.replaceChild(block, new_node)
- typer.verifier.scan(parent, parent)
end
typer.infer(new_node)
end
@@ -934,20 +918,3 @@ class Typer < SimpleNodeVisitor
@types.getVoidType()
end
end
-
-class AstVerifier < NodeScanner
- def enterScript(node, arg)
- raise IllegalArgumentException, "#{node.parent} -> #{node} " unless node.parent.nil?
- true
- end
- def enterDefault(node, arg)
- if node == arg
- raise IllegalArgumentException, "#{node}" if node.parent.nil?
- true
- else
- raise IllegalArgumentException, "#{node}.parent should be #{arg}, got #{node.parent}" unless node.parent == arg
- scan(node, node)
- false
- end
- end
-end
View
11 test.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# For some reason the builtins have to be on the JVM classpath to load properly.
+# This script runs rake with the right classpath
+if [ ! -e javalib/mirah-builtins.jar ]; then
+ jruby -S rake bootstrap
+fi
+CLASSPATH=javalib/mirah-parser.jar:javalib/mirah-bootstrap.jar:javalib/mirah-builtins.jar
+if [ $# = 0 ]; then
+ EXTRA_ARGS=test
+fi
+exec jruby -S rake "$@" $EXTRA_ARGS
View
6 test/jvm/hash_test.rb
@@ -14,11 +14,6 @@
# limitations under the License.
class HashTest < Test::Unit::TestCase
-if true
- def test_hashes
- raise "Hashes not implemented"
- end
-else
def test_hashes
cls, = compile(<<-EOF)
def foo1
@@ -247,4 +242,3 @@ def test_bool_inequality
end
end
end
-end

0 comments on commit 6223111

Please sign in to comment.