-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
631 additions
and
248 deletions.
There are no files selected for viewing
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
7 changes: 3 additions & 4 deletions
7
...ect.wollok.codeGenerator/src/org/uqbar/project/wollok/codeGenerator/ModelExtensions.xtend
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package org.uqbar.project.wollok.codeGenerator | ||
|
||
import org.uqbar.project.wollok.codeGenerator.model.Context | ||
import org.uqbar.project.wollok.codeGenerator.model.Expression | ||
import org.uqbar.project.wollok.codeGenerator.model.MethodContext | ||
|
||
class ModelExtensions { | ||
static def dispatch Context findContext(Expression expression){ | ||
static def dispatch MethodContext findContext(Expression expression){ | ||
expression.parent.findContext | ||
} | ||
|
||
static def dispatch Context findContext(Context context){ | ||
static def dispatch MethodContext findContext(MethodContext context){ | ||
context | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
...oject.wollok.codeGenerator/src/org/uqbar/project/wollok/codeGenerator/StringLiteral.xtend
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.uqbar.project.wollok.codeGenerator | ||
|
||
import org.eclipse.xtend.lib.annotations.Accessors | ||
import org.uqbar.project.wollok.codeGenerator.model.Expression | ||
import org.uqbar.project.wollok.codeGenerator.model.types.context.TypeContext | ||
import org.uqbar.project.wollok.codeGenerator.model.types.StringType | ||
|
||
@Accessors | ||
class StringLiteral implements Expression { | ||
val String value | ||
val Expression parent | ||
|
||
new(String value, Expression parent){ | ||
this.value = value | ||
this.parent = parent | ||
} | ||
|
||
override typeFor(TypeContext tc) { | ||
new StringType | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...ect.wollok.codeGenerator/src/org/uqbar/project/wollok/codeGenerator/ThrowExpression.xtend
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.uqbar.project.wollok.codeGenerator | ||
|
||
import org.eclipse.xtend.lib.annotations.Accessors | ||
import org.uqbar.project.wollok.codeGenerator.model.Expression | ||
import org.uqbar.project.wollok.codeGenerator.model.types.context.TypeContext | ||
|
||
@Accessors | ||
class ThrowExpression implements Expression { | ||
val Expression parent | ||
new(Expression parent){ | ||
this.parent = parent | ||
} | ||
|
||
override typeFor(TypeContext tc) { | ||
throw new UnsupportedOperationException("TODO: auto-generated method stub") | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...llok.codeGenerator/src/org/uqbar/project/wollok/codeGenerator/model/ClassDefinition.xtend
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.uqbar.project.wollok.codeGenerator.model | ||
|
||
import org.eclipse.xtend.lib.annotations.Accessors | ||
import org.uqbar.project.wollok.codeGenerator.model.types.context.TypeContext | ||
|
||
@Accessors | ||
class ClassDefinition extends AbstractMethodContext { | ||
|
||
val Program parent | ||
val String name | ||
val ClassDefinition superClass | ||
|
||
val methods = <String,Method>newHashMap | ||
|
||
new(Program parent, String name, ClassDefinition superClass){ | ||
this.parent = parent | ||
this.name = name | ||
this.superClass = superClass | ||
} | ||
|
||
override typeFor(TypeContext tc) { | ||
throw new UnsupportedOperationException("TODO: auto-generated method stub") | ||
} | ||
|
||
def Method getMethodNamed(String name) { | ||
if(methods.containsKey(name)){ | ||
return methods.get(name) | ||
} | ||
|
||
if(superClass != null) | ||
superClass.getMethodNamed(name) | ||
else | ||
throw new RuntimeException("Unknown method:" + name) | ||
} | ||
|
||
def putMethodNamed(String name, Method method) { | ||
methods.put(name, method) | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...llok.codeGenerator/src/org/uqbar/project/wollok/codeGenerator/model/ConstructorCall.xtend
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.uqbar.project.wollok.codeGenerator.model | ||
|
||
import org.eclipse.xtend.lib.annotations.Accessors | ||
import org.uqbar.project.wollok.codeGenerator.model.types.context.TypeContext | ||
|
||
@Accessors | ||
class ConstructorCall implements Expression { | ||
val Expression parent | ||
|
||
new(Expression parent){ | ||
this.parent = parent | ||
} | ||
|
||
override typeFor(TypeContext tc) { | ||
throw new UnsupportedOperationException("TODO: auto-generated method stub") | ||
} | ||
|
||
} |
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
17 changes: 17 additions & 0 deletions
17
....wollok.codeGenerator/src/org/uqbar/project/wollok/codeGenerator/model/IfExpression.xtend
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.uqbar.project.wollok.codeGenerator.model | ||
|
||
import org.eclipse.xtend.lib.annotations.Accessors | ||
import org.uqbar.project.wollok.codeGenerator.model.types.context.TypeContext | ||
|
||
@Accessors | ||
class IfExpression implements Expression { | ||
val Expression parent | ||
new(Expression parent){ | ||
this.parent = parent | ||
} | ||
|
||
override typeFor(TypeContext tc) { | ||
throw new UnsupportedOperationException("TODO: auto-generated method stub") | ||
} | ||
|
||
} |
Oops, something went wrong.