From 9fa8d4219a893dabb453a89ac7bd8406ade746f6 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Thu, 9 Jul 2015 19:20:08 -0400 Subject: [PATCH] nitj: implement static frame to handle calls Signed-off-by: Alexandre Terrasa --- src/compiler/java_compiler.nit | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/compiler/java_compiler.nit b/src/compiler/java_compiler.nit index fa4df54..2521c08 100644 --- a/src/compiler/java_compiler.nit +++ b/src/compiler/java_compiler.nit @@ -317,6 +317,11 @@ class JavaCompilerVisitor return decl_var(name, mtype) end + # Calls handling + + # The current `JavaStaticFrame` + var frame: nullable JavaStaticFrame = null is writable + # Code generation # Add a line (will be suffixed by `\n`) @@ -492,6 +497,28 @@ class RuntimeVariable end end +# The static context of a visited property in a `JavaCompilerVisitor` +class JavaStaticFrame + # The associated visitor + var visitor: JavaCompilerVisitor + + # The executed property. + # A Method in case of a call, an attribute in case of a default initialization. + var mpropdef: MPropDef + + # The static type of the receiver + var receiver: MClassType + + # Arguments of the method (the first is the receiver) + var arguments: Array[RuntimeVariable] + + # The runtime_variable associated to the return (in a function) + var returnvar: nullable RuntimeVariable = null is writable + + # The label at the end of the property + var returnlabel: nullable String = null is writable +end + redef class MType # Return the Java type associated to a given Nit static type fun java_type: String do return "RTVal" -- 1.7.9.5