summaryrefslogtreecommitdiff
path: root/vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2012-08-03 09:38:11 +0200
committerJürg Billeter <j@bitron.ch>2012-08-06 13:19:26 +0200
commit5ea6dc05d62c71ba4e633f70b86e4dd0a5e9c089 (patch)
treeca4d1a4dfb85ceab88339dbc15e165d2f5c564bc /vala
parent6a6a2cf59b7302b0b3b111c6a0c879c00d36ddce (diff)
downloadvala-5ea6dc05d62c71ba4e633f70b86e4dd0a5e9c089.tar.gz
Drop Dova profile
Diffstat (limited to 'vala')
-rw-r--r--vala/Makefile.am3
-rw-r--r--vala/valaarraytype.vala2
-rw-r--r--vala/valabinaryexpression.vala45
-rw-r--r--vala/valacharacterliteral.vala10
-rw-r--r--vala/valaclass.vala30
-rw-r--r--vala/valacodecontext.vala5
-rw-r--r--vala/valacodevisitor.vala24
-rw-r--r--vala/valacodewriter.vala13
-rw-r--r--vala/valadatatype.vala5
-rw-r--r--vala/valaelementaccess.vala36
-rw-r--r--vala/valaenum.vala2
-rw-r--r--vala/valaflowanalyzer.vala8
-rw-r--r--vala/valaforeachstatement.vala2
-rw-r--r--vala/valagenerictype.vala7
-rw-r--r--vala/valaintegerliteral.vala10
-rw-r--r--vala/valainterface.vala2
-rw-r--r--vala/valalambdaexpression.vala12
-rw-r--r--vala/valalistliteral.vala140
-rw-r--r--vala/valamapliteral.vala151
-rw-r--r--vala/valamethod.vala2
-rw-r--r--vala/valamethodcall.vala6
-rw-r--r--vala/valanamespace.vala2
-rw-r--r--vala/valaobjectcreationexpression.vala6
-rw-r--r--vala/valaobjecttype.vala5
-rw-r--r--vala/valaparser.vala227
-rw-r--r--vala/valapointertype.vala12
-rw-r--r--vala/valaprofile.vala3
-rw-r--r--vala/valapropertyaccessor.vala22
-rw-r--r--vala/valarealliteral.vala2
-rw-r--r--vala/valareturnstatement.vala5
-rw-r--r--vala/valascanner.vala9
-rw-r--r--vala/valasemanticanalyzer.vala41
-rw-r--r--vala/valasetliteral.vala124
-rw-r--r--vala/valastruct.vala5
-rw-r--r--vala/valasymbolresolver.vala32
-rw-r--r--vala/valatemplate.vala15
-rw-r--r--vala/valatuple.vala20
37 files changed, 79 insertions, 966 deletions
diff --git a/vala/Makefile.am b/vala/Makefile.am
index 999a63a1d..d6df89422 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -85,13 +85,11 @@ libvalacore_la_VALASOURCES = \
valainterfacetype.vala \
valainvalidtype.vala \
valalambdaexpression.vala \
- valalistliteral.vala \
valaliteral.vala \
valalocalvariable.vala \
valalockable.vala \
valalockstatement.vala \
valaloop.vala \
- valamapliteral.vala \
valamarkupreader.vala \
valamemberaccess.vala \
valamemberinitializer.vala \
@@ -123,7 +121,6 @@ libvalacore_la_VALASOURCES = \
valascanner.vala \
valascope.vala \
valasemanticanalyzer.vala \
- valasetliteral.vala \
valasignal.vala \
valasignaltype.vala \
valasizeofexpression.vala \
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index ecd8a0e5c..c190d1d84 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -245,8 +245,6 @@ public class Vala.ArrayType : ReferenceType {
public override bool is_disposable () {
if (fixed_length) {
return element_type.is_disposable ();
- } else if (CodeContext.get ().profile == Profile.DOVA) {
- return false;
} else {
return base.is_disposable ();
}
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index 1457de335..22c448384 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -263,14 +263,6 @@ public class Vala.BinaryExpression : Expression {
&& operator == BinaryOperator.PLUS) {
// string concatenation
- if (context.profile == Profile.DOVA) {
- var concat_call = new MethodCall (new MemberAccess (left, "concat", source_reference), source_reference);
- concat_call.add_argument (right);
- concat_call.target_type = target_type;
- parent_node.replace_expression (this, concat_call);
- return concat_call.check (context);
- }
-
if (right.value_type == null || right.value_type.data_type != context.analyzer.string_type.data_type) {
error = true;
Report.error (source_reference, "Operands must be strings");
@@ -283,16 +275,7 @@ public class Vala.BinaryExpression : Expression {
} else {
value_type.value_owned = true;
}
- } else if (context.profile == Profile.DOVA && left.value_type.data_type == context.analyzer.list_type.data_type
- && operator == BinaryOperator.PLUS) {
- // list concatenation
-
- var concat_call = new MethodCall (new MemberAccess (left, "concat", source_reference), source_reference);
- concat_call.add_argument (right);
- concat_call.target_type = target_type;
- parent_node.replace_expression (this, concat_call);
- return concat_call.check (context);
- } else if (context.profile != Profile.DOVA && left.value_type is ArrayType && operator == BinaryOperator.PLUS) {
+ } else if (left.value_type is ArrayType && operator == BinaryOperator.PLUS) {
// array concatenation
var array_type = (ArrayType) left.value_type;
@@ -329,11 +312,7 @@ public class Vala.BinaryExpression : Expression {
}
} else if (right.value_type is PointerType) {
// pointer arithmetic: pointer - pointer
- if (context.profile == Profile.DOVA) {
- value_type = context.analyzer.long_type;
- } else {
- value_type = context.analyzer.size_t_type;
- }
+ value_type = context.analyzer.size_t_type;
}
} else {
left.target_type.nullable = false;
@@ -427,26 +406,6 @@ public class Vala.BinaryExpression : Expression {
}
}
- if (left.value_type.compatible (context.analyzer.string_type)
- && right.value_type.compatible (context.analyzer.string_type)) {
- // string comparison
- if (context.profile == Profile.DOVA) {
- var string_ma = new MemberAccess.simple ("string", source_reference);
- string_ma.qualified = true;
- var equals_call = new MethodCall (new MemberAccess (string_ma, "equals", source_reference), source_reference);
- equals_call.add_argument (left);
- equals_call.add_argument (right);
- if (operator == BinaryOperator.EQUALITY) {
- parent_node.replace_expression (this, equals_call);
- return equals_call.check (context);
- } else {
- var not = new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, equals_call, source_reference);
- parent_node.replace_expression (this, not);
- return not.check (context);
- }
- }
- }
-
value_type = context.analyzer.bool_type;
} else if (operator == BinaryOperator.BITWISE_AND
|| operator == BinaryOperator.BITWISE_OR) {
diff --git a/vala/valacharacterliteral.vala b/vala/valacharacterliteral.vala
index d38a0e6de..71bed95a1 100644
--- a/vala/valacharacterliteral.vala
+++ b/vala/valacharacterliteral.vala
@@ -90,14 +90,10 @@ public class Vala.CharacterLiteral : Literal {
checked = true;
- if (context.profile == Profile.DOVA) {
- value_type = new IntegerType ((Struct) context.analyzer.root_symbol.scope.lookup ("char"), get_char ().to_string (), "int");
+ if (get_char () < 128) {
+ value_type = new IntegerType ((Struct) context.analyzer.root_symbol.scope.lookup ("char"));
} else {
- if (get_char () < 128) {
- value_type = new IntegerType ((Struct) context.analyzer.root_symbol.scope.lookup ("char"));
- } else {
- value_type = new IntegerType ((Struct) context.analyzer.root_symbol.scope.lookup ("unichar"));
- }
+ value_type = new IntegerType ((Struct) context.analyzer.root_symbol.scope.lookup ("unichar"));
}
return !error;
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index 87a044187..678c643a9 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -254,32 +254,6 @@ public class Vala.Class : ObjectTypeSymbol {
* @param f a field
*/
public override void add_field (Field f) {
- if (CodeContext.get ().profile == Profile.DOVA &&
- f.binding == MemberBinding.INSTANCE &&
- (f.access == SymbolAccessibility.PUBLIC || f.access == SymbolAccessibility.PROTECTED) &&
- name != "any" /* temporary workaround */) {
- // public/protected instance fields not supported, convert to automatic property
-
- var prop = new Property (f.name, f.variable_type.copy (), null, null, f.source_reference, comment);
- prop.access = access;
-
- var get_type = prop.property_type.copy ();
- get_type.value_owned = true;
- var set_type = prop.property_type.copy ();
- set_type.value_owned = false;
-
- prop.get_accessor = new PropertyAccessor (true, false, false, get_type, null, f.source_reference);
-
- prop.set_accessor = new PropertyAccessor (false, true, false, set_type, null, f.source_reference);
-
- f.name = "_%s".printf (f.name);
- f.access = SymbolAccessibility.PRIVATE;
- prop.field = f;
-
- add_property (prop);
- return;
- }
-
fields.add (f);
if (f.access == SymbolAccessibility.PRIVATE && f.binding == MemberBinding.INSTANCE) {
has_private_fields = true;
@@ -320,7 +294,7 @@ public class Vala.Class : ObjectTypeSymbol {
m.this_parameter = new Parameter ("this", get_this_type ());
m.scope.add (m.this_parameter.name, m.this_parameter);
}
- if (!(m.return_type is VoidType) && (CodeContext.get ().profile == Profile.DOVA || m.get_postconditions ().size > 0)) {
+ if (!(m.return_type is VoidType) && m.get_postconditions ().size > 0) {
if (m.result_var != null) {
m.scope.remove (m.result_var.name);
}
@@ -560,8 +534,6 @@ public class Vala.Class : ObjectTypeSymbol {
public bool is_fundamental () {
if (!is_compact && base_class == null) {
return true;
- } else if (CodeContext.get ().profile == Profile.DOVA && base_class.base_class == null) {
- return true;
}
return false;
}
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index f2b8b5991..6167b5597 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -417,11 +417,6 @@ public class Vala.CodeContext {
var ns_ref = new UsingDirective (new UnresolvedSymbol (null, "GLib", null));
source_file.add_using_directive (ns_ref);
root.add_using_directive (ns_ref);
- } else if (profile == Profile.DOVA) {
- // import the Dova namespace by default (namespace of backend-specific standard library)
- var ns_ref = new UsingDirective (new UnresolvedSymbol (null, "Dova", null));
- source_file.add_using_directive (ns_ref);
- root.add_using_directive (ns_ref);
}
add_source_file (source_file);
diff --git a/vala/valacodevisitor.vala b/vala/valacodevisitor.vala
index 395009d89..c9b158694 100644
--- a/vala/valacodevisitor.vala
+++ b/vala/valacodevisitor.vala
@@ -486,30 +486,6 @@ public abstract class Vala.CodeVisitor {
}
/**
- * Visit operation called for list literals.
- *
- * @param lit a list literal
- */
- public virtual void visit_list_literal (ListLiteral lit) {
- }
-
- /**
- * Visit operation called for set literals.
- *
- * @param lit a set literal
- */
- public virtual void visit_set_literal (SetLiteral lit) {
- }
-
- /**
- * Visit operation called for map literals.
- *
- * @param lit a map literal
- */
- public virtual void visit_map_literal (MapLiteral lit) {
- }
-
- /**
* Visit operation called for tuples.
*
* @param tuple a tuple
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 3986e706f..7a7961495 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -724,9 +724,7 @@ public class Vala.CodeWriter : CodeVisitor {
write_params (m.get_parameters ());
- if (context.profile != Profile.DOVA) {
- write_error_domains (m.get_error_types ());
- }
+ write_error_domains (m.get_error_types ());
write_code_block (m.body);
@@ -767,7 +765,7 @@ public class Vala.CodeWriter : CodeVisitor {
write_property_accessor_accessibility (prop.get_accessor);
- if (context.profile != Profile.DOVA && prop.get_accessor.value_type.is_disposable ()) {
+ if (prop.get_accessor.value_type.is_disposable ()) {
write_string (" owned");
}
@@ -779,7 +777,7 @@ public class Vala.CodeWriter : CodeVisitor {
write_property_accessor_accessibility (prop.set_accessor);
- if (context.profile != Profile.DOVA && prop.set_accessor.value_type.value_owned) {
+ if (prop.set_accessor.value_type.value_owned) {
write_string (" owned");
}
@@ -1429,9 +1427,8 @@ public class Vala.CodeWriter : CodeVisitor {
private void write_identifier (string s) {
char* id = (char*)s;
int id_length = (int)s.length;
- if (context.profile != Profile.DOVA &&
- (Vala.Scanner.get_identifier_or_keyword (id, id_length) != Vala.TokenType.IDENTIFIER ||
- s.get_char ().isdigit ())) {
+ if (Vala.Scanner.get_identifier_or_keyword (id, id_length) != Vala.TokenType.IDENTIFIER ||
+ s.get_char ().isdigit ()) {
stream.putc ('@');
}
write_string (s);
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index c553dcf19..e48d12d2d 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -274,11 +274,6 @@ public abstract class Vala.DataType : CodeNode {
}
}
- if (this is ValueType && target_type.data_type != null && target_type.data_type.get_full_name () == "Dova.Value") {
- // allow implicit conversion to Dova.Value
- return true;
- }
-
if (target_type is DelegateType && this is DelegateType) {
return ((DelegateType) target_type).delegate_symbol == ((DelegateType) this).delegate_symbol;
}
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index 58f0e4dd3..8210e47e6 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -115,8 +115,6 @@ public class Vala.ElementAccess : Expression {
return false;
}
- var container_type = container.value_type.data_type;
-
if (container is MemberAccess && container.symbol_reference is Signal) {
// signal detail access
if (get_indices ().size != 1) {
@@ -163,40 +161,6 @@ public class Vala.ElementAccess : Expression {
}
} else if (pointer_type != null && !pointer_type.base_type.is_reference_type_or_type_parameter ()) {
value_type = pointer_type.base_type.copy ();
- } else if (context.profile == Profile.DOVA && container_type == context.analyzer.tuple_type.data_type) {
- if (get_indices ().size != 1) {
- error = true;
- Report.error (source_reference, "Element access with more than one dimension is not supported for tuples");
- return false;
- }
- var index = get_indices ().get (0) as IntegerLiteral;
- if (index == null) {
- error = true;
- Report.error (source_reference, "Element access with non-literal index is not supported for tuples");
- return false;
- }
- int i = int.parse (index.value);
- if (container.value_type.get_type_arguments ().size == 0) {
- error = true;
- Report.error (source_reference, "Element access is not supported for untyped tuples");
- return false;
- }
- if (i < 0 || i >= container.value_type.get_type_arguments ().size) {
- error = true;
- Report.error (source_reference, "Index out of range");
- return false;
- }
-
- value_type = container.value_type.get_type_arguments ().get (i);
-
- // replace element access by call to generic get method
- var ma = new MemberAccess (container, "get", source_reference);
- ma.add_type_argument (value_type);
- var get_call = new MethodCall (ma, source_reference);
- get_call.add_argument (index);
- get_call.target_type = this.target_type;
- parent_node.replace_expression (this, get_call);
- return get_call.check (context);
} else if (container is MemberAccess && container.symbol_reference is Signal) {
index_int_type_check = false;
diff --git a/vala/valaenum.vala b/vala/valaenum.vala
index eeabda917..acb8eb35c 100644
--- a/vala/valaenum.vala
+++ b/vala/valaenum.vala
@@ -83,7 +83,7 @@ public class Vala.Enum : TypeSymbol {
m.this_parameter = new Parameter ("this", new EnumValueType (this));
m.scope.add (m.this_parameter.name, m.this_parameter);
}
- if (!(m.return_type is VoidType) && (CodeContext.get ().profile == Profile.DOVA || m.get_postconditions ().size > 0)) {
+ if (!(m.return_type is VoidType) && m.get_postconditions ().size > 0) {
m.result_var = new LocalVariable (m.return_type.copy (), "result", null, source_reference);
m.result_var.is_result = true;
}
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala
index ada3254d3..57453ee03 100644
--- a/vala/valaflowanalyzer.vala
+++ b/vala/valaflowanalyzer.vala
@@ -193,12 +193,6 @@ public class Vala.FlowAnalyzer : CodeVisitor {
m.return_block.connect (m.exit_block);
- if (context.profile == Profile.DOVA && m.result_var != null) {
- // ensure result is defined at end of method
- var result_ma = new MemberAccess.simple ("result", m.source_reference);
- result_ma.symbol_reference = m.result_var;
- m.return_block.add_node (result_ma);
- }
if (m is Method) {
// ensure out parameters are defined at end of method
foreach (var param in ((Method) m).get_parameters ()) {
@@ -224,7 +218,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
if (current_block != null) {
// end of method body reachable
- if (context.profile != Profile.DOVA && m.has_result) {
+ if (m.has_result) {
Report.error (m.source_reference, "missing return statement at end of subroutine body");
m.error = true;
}
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 319968af6..f27e30371 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -167,7 +167,7 @@ public class Vala.ForeachStatement : Block {
var collection_type = collection.value_type.copy ();
collection.target_type = collection_type.copy ();
- if (context.profile != Profile.DOVA && collection_type.is_array ()) {
+ if (collection_type.is_array ()) {
var array_type = (ArrayType) collection_type;
// can't use inline-allocated array for temporary variable
diff --git a/vala/valagenerictype.vala b/vala/valagenerictype.vala
index c7d7991c6..49a4c5723 100644
--- a/vala/valagenerictype.vala
+++ b/vala/valagenerictype.vala
@@ -47,13 +47,6 @@ public class Vala.GenericType : DataType {
}
public override Symbol? get_member (string member_name) {
- if (CodeContext.get ().profile == Profile.DOVA) {
- if (member_name == "equals") {
- return CodeContext.get ().root.scope.lookup ("Dova").scope.lookup ("Object").scope.lookup ("equals");
- } else if (member_name == "hash") {
- return CodeContext.get ().root.scope.lookup ("Dova").scope.lookup ("Object").scope.lookup ("hash");
- }
- }
return null;
}
}
diff --git a/vala/valaintegerliteral.vala b/vala/valaintegerliteral.vala
index e16c4577e..879bd2a7c 100644
--- a/vala/valaintegerliteral.vala
+++ b/vala/valaintegerliteral.vala
@@ -96,14 +96,6 @@ public class Vala.IntegerLiteral : Literal {
type_suffix = "";
type_name = "int";
}
- } else if (CodeContext.get ().profile == Profile.DOVA) {
- if (u) {
- type_suffix = "UL";
- type_name = "uint64";
- } else {
- type_suffix = "L";
- type_name = "int64";
- }
} else if (l == 1) {
if (u) {
type_suffix = "UL";
@@ -123,7 +115,7 @@ public class Vala.IntegerLiteral : Literal {
}
var st = (Struct) context.analyzer.root_symbol.scope.lookup (type_name);
- // ensure attributes are already processed in case of bootstrapping dova-core
+ // ensure attributes are already processed
st.check (context);
value_type = new IntegerType (st, value, type_name);
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index 548304f07..5780837ff 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -133,7 +133,7 @@ public class Vala.Interface : ObjectTypeSymbol {
m.this_parameter = new Parameter ("this", get_this_type ());
m.scope.add (m.this_parameter.name, m.this_parameter);
}
- if (!(m.return_type is VoidType) && (CodeContext.get ().profile == Profile.DOVA || m.get_postconditions ().size > 0)) {
+ if (!(m.return_type is VoidType) && m.get_postconditions ().size > 0) {
m.result_var = new LocalVariable (m.return_type.copy (), "result", null, source_reference);
m.result_var.is_result = true;
}
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index 027beaf05..61482f42a 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -164,11 +164,6 @@ public class Vala.LambdaExpression : Expression {
}
method.owner = context.analyzer.current_symbol.scope;
- if (!(method.return_type is VoidType) && CodeContext.get ().profile == Profile.DOVA) {
- method.result_var = new LocalVariable (method.return_type.copy (), "result", null, source_reference);
- method.result_var.is_result = true;
- }
-
var lambda_params = get_parameters ();
Iterator<Parameter> lambda_param_it = lambda_params.iterator ();
@@ -208,12 +203,7 @@ public class Vala.LambdaExpression : Expression {
block.scope.parent_scope = method.scope;
if (method.return_type.data_type != null) {
- if (context.profile == Profile.DOVA) {
- block.add_statement (new ExpressionStatement (new Assignment (new MemberAccess.simple ("result", source_reference), expression_body, AssignmentOperator.SIMPLE, source_reference), source_reference));
- block.add_statement (new ReturnStatement (null, source_reference));
- } else {
- block.add_statement (new ReturnStatement (expression_body, source_reference));
- }
+ block.add_statement (new ReturnStatement (expression_body, source_reference));
} else {
block.add_statement (new ExpressionStatement (expression_body, source_reference));
}
diff --git a/vala/valalistliteral.vala b/vala/valalistliteral.vala
deleted file mode 100644
index 7438ca7d5..000000000
--- a/vala/valalistliteral.vala
+++ /dev/null
@@ -1,140 +0,0 @@
-/* valalistliteral.vala
- *
- * Copyright (C) 2009-2010 Jürg Billeter
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Jürg Billeter <j@bitron.ch>
- */
-
-public class Vala.ListLiteral : Literal {
- private List<Expression> expression_list = new ArrayList<Expression> ();
-
- public DataType element_type { get; private set; }
-
- public ListLiteral (SourceReference? source_reference = null) {
- this.source_reference = source_reference;
- }
-
- public override void accept_children (CodeVisitor visitor) {
- foreach (Expression expr in expression_list) {
- expr.accept (visitor);
- }
- }
-
- public override void accept (CodeVisitor visitor) {
- visitor.visit_list_literal (this);
-
- visitor.visit_expression (this);
- }
-
- public void add_expression (Expression expr) {
- expression_list.add (expr);
- expr.parent_node = this;
- }
-
- public List<Expression> get_expressions () {
- return expression_list;
- }
-
- public override bool is_pure () {
- return false;
- }
-
- public override void replace_expression (Expression old_node, Expression new_node) {
- for (int i = 0; i < expression_list.size; i++) {
- if (expression_list[i] == old_node) {
- expression_list[i] = new_node;
- }
- }
- }
-
- public override bool check (CodeContext context) {
- if (checked) {
- return !error;
- }
-
- checked = true;
-
- // list literals are also allowed for constant arrays,
- // however, they are currently handled by InitializerList
- // therefore transform this expression if necessary
- var array_type = target_type as ArrayType;
- if (array_type != null && array_type.inline_allocated) {
- var initializer = new InitializerList (source_reference);
- initializer.target_type = target_type;
- foreach (var expr in expression_list) {
- initializer.append (expr);
- }
-
- context.analyzer.replaced_nodes.add (this);
- parent_node.replace_expression (this, initializer);
- return initializer.check (context);
- }
-
- var list_type = new ObjectType ((Class) context.root.scope.lookup ("Dova").scope.lookup ("List"));
- list_type.value_owned = true;
-
- bool fixed_element_type = false;
- if (target_type != null && target_type.data_type == list_type.data_type && target_type.get_type_arguments ().size == 1) {
- element_type = target_type.get_type_arguments ().get (0).copy ();
- element_type.value_owned = false;
- fixed_element_type = true;
- }
-
- for (int i = 0; i < expression_list.size; i++) {
- var expr = expression_list[i];
-
- if (fixed_element_type) {
- expr.target_type = element_type;
- }
- if (!expr.check (context)) {
- return false;
- }
-
- // expression might have been replaced in the list
- expr = expression_list[i];
-
- if (element_type == null) {
- element_type = expr.value_type.copy ();
- element_type.value_owned = false;
- }
- }
-
- if (element_type == null) {
- error = true;
- Report.error (source_reference, "cannot infer element type for list literal");
- return false;
- }
-
- element_type = element_type.copy ();
- element_type.value_owned = true;
- list_type.add_type_argument (element_type);
- value_type = list_type;
-
- return !error;
- }
-
- public override void emit (CodeGenerator codegen) {
- foreach (Expression expr in expression_list) {
- expr.emit (codegen);
- }
-
- codegen.visit_list_literal (this);
-
- codegen.visit_expression (this);
- }
-}
diff --git a/vala/valamapliteral.vala b/vala/valamapliteral.vala
deleted file mode 100644
index e9eca0b5d..000000000
--- a/vala/valamapliteral.vala
+++ /dev/null
@@ -1,151 +0,0 @@
-/* valamapliteral.vala
- *
- * Copyright (C) 2009-2010 Jürg Billeter
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Jürg Billeter <j@bitron.ch>
- */
-
-public class Vala.MapLiteral : Literal {
- private List<Expression> keys = new ArrayList<Expression> ();
- private List<Expression> values = new ArrayList<Expression> ();
-
- public DataType map_key_type { get; private set; }
- public DataType map_value_type { get; private set; }
-
- public MapLiteral (SourceReference? source_reference = null) {
- this.source_reference = source_reference;
- }
-
- public override void accept_children (CodeVisitor visitor) {
- for (int i = 0; i < keys.size; i++) {
- keys[i].accept (visitor);
- values[i].accept (visitor);
- }
- }
-
- public override void accept (CodeVisitor visitor) {
- visitor.visit_map_literal (this);
-
- visitor.visit_expression (this);
- }
-
- public void add_key (Expression expr) {
- keys.add (expr);
- expr.parent_node = this;
- }
-
- public void add_value (Expression expr) {
- values.add (expr);
- expr.parent_node = this;
- }
-
- public List<Expression> get_keys () {
- return keys;
- }
-
- public List<Expression> get_values () {
- return values;
- }
-
- public override bool is_pure () {
- return false;
- }
-
- public override void replace_expression (Expression old_node, Expression new_node) {
- for (int i = 0; i < keys.size; i++) {
- if (keys[i] == old_node) {
- keys[i] = new_node;
- }
- if (values[i] == old_node) {
- values[i] = new_node;
- }
- }
- }
-
- public override bool check (CodeContext context) {
- if (checked) {
- return !error;
- }
-
- checked = true;
-
- var map_type = new ObjectType ((Class) context.root.scope.lookup ("Dova").scope.lookup ("Map"));
- map_type.value_owned = true;
-
- bool fixed_element_type = false;
- if (target_type != null && target_type.data_type == map_type.data_type && target_type.get_type_arguments ().size == 2) {
- map_key_type = target_type.get_type_arguments ().get (0).copy ();
- map_key_type.value_owned = false;
- map_value_type = target_type.get_type_arguments ().get (1).copy ();
- map_value_type.value_owned = false;
- fixed_element_type = true;
- }
-
- for (int i = 0; i < keys.size; i++) {
- if (fixed_element_type) {
- keys[i].target_type = map_key_type;
- values[i].target_type = map_value_type;
- }
- if (!keys[i].check (context)) {
- return false;
- }
- if (!values[i].check (context)) {
- return false;
- }
- if (map_key_type == null) {
- map_key_type = keys[i].value_type.copy ();
- map_key_type.value_owned = false;
- map_value_type = values[i].value_type.copy ();
- map_value_type.value_owned = false;
- }
- }
-
- if (map_key_type == null) {
- error = true;
- Report.error (source_reference, "cannot infer key type for map literal");
- return false;
- }
-
- if (map_value_type == null) {
- error = true;
- Report.error (source_reference, "cannot infer value type for map literal");
- return false;
- }
-
- map_key_type = map_key_type.copy ();
- map_key_type.value_owned = true;
- map_value_type = map_value_type.copy ();
- map_value_type.value_owned = true;
- map_type.add_type_argument (map_key_type);
- map_type.add_type_argument (map_value_type);
- value_type = map_type;
-
- return !error;
- }
-
- public override void emit (CodeGenerator codegen) {
- for (int i = 0; i < keys.size; i++) {
- keys[i].emit (codegen);
- values[i].emit (codegen);
- }
-
- codegen.visit_map_literal (this);
-
- codegen.visit_expression (this);
- }
-}
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 2a1bf81a2..942f0d2fd 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -769,7 +769,7 @@ public class Vala.Method : Subroutine {
entry_point = true;
context.entry_point = this;
- if (tree_can_fail && context.profile != Profile.DOVA) {
+ if (tree_can_fail) {
Report.error (source_reference, "\"main\" method cannot throw errors");
}
}
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 0c6705e4c..0cb8cac04 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -724,10 +724,8 @@ public class Vala.MethodCall : Expression {
if (parent_node is LocalVariable || parent_node is ExpressionStatement) {
// simple statements, no side effects after method call
} else if (!(context.analyzer.current_symbol is Block)) {
- if (context.profile != Profile.DOVA) {
- // can't handle errors in field initializers
- Report.error (source_reference, "Field initializers must not throw errors");
- }
+ // can't handle errors in field initializers
+ Report.error (source_reference, "Field initializers must not throw errors");
} else {
// store parent_node as we need to replace the expression in the old parent node later on
var old_parent_node = parent_node;
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index b605ac646..47dd4eee1 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -438,7 +438,7 @@ public class Vala.Namespace : Symbol {
m.error = true;
return;
}
- if (!(m.return_type is VoidType) && (CodeContext.get ().profile == Profile.DOVA || m.get_postconditions ().size > 0)) {
+ if (!(m.return_type is VoidType) && m.get_postconditions ().size > 0) {
m.result_var = new LocalVariable (m.return_type.copy (), "result", null, source_reference);
m.result_var.is_result = true;
}
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 400bc4c32..7384746d0 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -407,10 +407,8 @@ public class Vala.ObjectCreationExpression : Expression {
if (parent_node is LocalVariable || parent_node is ExpressionStatement) {
// simple statements, no side effects after method call
} else if (!(context.analyzer.current_symbol is Block)) {
- if (context.profile != Profile.DOVA) {
- // can't handle errors in field initializers
- Report.error (source_reference, "Field initializers must not throw errors");
- }
+ // can't handle errors in field initializers
+ Report.error (source_reference, "Field initializers must not throw errors");
} else {
// store parent_node as we need to replace the expression in the old parent node later on
var old_parent_node = parent_node;
diff --git a/vala/valaobjecttype.vala b/vala/valaobjecttype.vala
index 6d440b181..7019719b3 100644
--- a/vala/valaobjecttype.vala
+++ b/vala/valaobjecttype.vala
@@ -100,11 +100,6 @@ public class Vala.ObjectType : ReferenceType {
return false;
}
- if (context.profile == Profile.DOVA && type_symbol.get_full_name () == "Dova.Tuple") {
- // tuples have variadic generics
- return true;
- }
-
int n_type_args = get_type_arguments ().size;
if (n_type_args > 0 && n_type_args < type_symbol.get_type_parameters ().size) {
Report.error (source_reference, "too few type arguments");
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index d01558b21..0f7d0e378 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -409,11 +409,7 @@ public class Vala.Parser : CodeVisitor {
bool value_owned = owned_by_default;
if (owned_by_default) {
- if (context.profile == Profile.DOVA) {
- if (can_weak_ref && accept (TokenType.WEAK)) {
- value_owned = false;
- }
- } else if (accept (TokenType.UNOWNED)) {
+ if (accept (TokenType.UNOWNED)) {
value_owned = false;
} else if (accept (TokenType.WEAK)) {
if (!can_weak_ref && !context.deprecated) {
@@ -422,7 +418,7 @@ public class Vala.Parser : CodeVisitor {
value_owned = false;
}
} else {
- value_owned = (context.profile != Profile.DOVA && accept (TokenType.OWNED));
+ value_owned = accept (TokenType.OWNED);
}
DataType type;
@@ -463,7 +459,7 @@ public class Vala.Parser : CodeVisitor {
// only used for parsing, reject use as real type
invalid_array = true;
}
- } while (context.profile != Profile.DOVA && accept (TokenType.COMMA));
+ } while (accept (TokenType.COMMA));
expect (TokenType.CLOSE_BRACKET);
// arrays contain strong references by default
@@ -481,7 +477,7 @@ public class Vala.Parser : CodeVisitor {
}
if (!owned_by_default) {
- if (context.profile != Profile.DOVA && accept (TokenType.HASH)) {
+ if (accept (TokenType.HASH)) {
if (!context.deprecated) {
Report.warning (get_last_src (), "deprecated syntax, use `owned` modifier");
}
@@ -579,18 +575,10 @@ public class Vala.Parser : CodeVisitor {
expr = parse_literal ();
break;
case TokenType.OPEN_BRACE:
- if (context.profile == Profile.DOVA) {
- expr = parse_set_literal ();
- } else {
- expr = parse_initializer ();
- }
+ expr = parse_initializer ();
break;
case TokenType.OPEN_BRACKET:
- if (context.profile == Profile.DOVA) {
- expr = parse_list_literal ();
- } else {
- expr = parse_simple_name ();
- }
+ expr = parse_simple_name ();
break;
case TokenType.OPEN_PARENS:
expr = parse_tuple ();
@@ -632,11 +620,7 @@ public class Vala.Parser : CodeVisitor {
expr = parse_member_access (begin, expr);
break;
case TokenType.OP_PTR:
- if (context.profile == Profile.DOVA) {
- found = false;
- } else {
- expr = parse_pointer_member_access (begin, expr);
- }
+ expr = parse_pointer_member_access (begin, expr);
break;
case TokenType.OPEN_PARENS:
expr = parse_method_call (begin, expr);
@@ -644,14 +628,6 @@ public class Vala.Parser : CodeVisitor {
case TokenType.OPEN_BRACKET:
expr = parse_element_access (begin, expr);
break;
- case TokenType.OPEN_BRACE:
- var ma = expr as MemberAccess;
- if (context.profile == Profile.DOVA && ma != null) {
- expr = parse_object_literal (begin, ma);
- } else {
- found = false;
- }
- break;
case TokenType.OP_INC:
expr = parse_post_increment_expression (begin, expr);
break;
@@ -877,27 +853,6 @@ public class Vala.Parser : CodeVisitor {
return expr;
}
- Expression parse_object_literal (SourceLocation begin, MemberAccess member) throws ParseError {
- member.creation_member = true;
-
- var expr = new ObjectCreationExpression (member, get_src (begin));
-
- expect (TokenType.OPEN_BRACE);
-
- do {
- var member_begin = get_location ();
- string id = parse_identifier ();
- expect (TokenType.COLON);
- var member_expr = parse_expression ();
-
- expr.add_member_initializer (new MemberInitializer (id, member_expr, get_src (member_begin)));
- } while (accept (TokenType.COMMA));
-
- expect (TokenType.CLOSE_BRACE);
-
- return expr;
- }
-
Expression parse_array_creation_expression () throws ParseError {
var begin = get_location ();
expect (TokenType.NEW);
@@ -939,12 +894,12 @@ public class Vala.Parser : CodeVisitor {
size_specified = true;
}
size_specifier_list.add (size);
- } while (context.profile != Profile.DOVA && accept (TokenType.COMMA));
+ } while (accept (TokenType.COMMA));
expect (TokenType.CLOSE_BRACKET);
} while (accept (TokenType.OPEN_BRACKET));
InitializerList initializer = null;
- if (context.profile != Profile.DOVA && current () == TokenType.OPEN_BRACE) {
+ if (current () == TokenType.OPEN_BRACE) {
initializer = parse_initializer ();
}
var expr = new ArrayCreationExpression (element_type, size_specifier_list.size, initializer, get_src (begin));
@@ -958,7 +913,7 @@ public class Vala.Parser : CodeVisitor {
List<MemberInitializer> parse_object_initializer () throws ParseError {
var list = new ArrayList<MemberInitializer> ();
- if (context.profile != Profile.DOVA && accept (TokenType.OPEN_BRACE)) {
+ if (accept (TokenType.OPEN_BRACE)) {
do {
list.add (parse_member_initializer ());
} while (accept (TokenType.COMMA));
@@ -1568,19 +1523,6 @@ public class Vala.Parser : CodeVisitor {
}
if (!is_decl) {
- if (context.profile == Profile.DOVA && stmt is ReturnStatement) {
- // split
- // return foo;
- // into
- // result = foo;
- // return;
- var ret_stmt = (ReturnStatement) stmt;
- if (ret_stmt.return_expression != null) {
- var assignment = new Assignment (new MemberAccess.simple ("result", stmt.source_reference), ret_stmt.return_expression, AssignmentOperator.SIMPLE, stmt.source_reference);
- ret_stmt.return_expression = null;
- block.add_statement (new ExpressionStatement (assignment, stmt.source_reference));
- }
- }
block.add_statement (stmt);
}
} catch (ParseError e) {
@@ -1683,19 +1625,6 @@ public class Vala.Parser : CodeVisitor {
var block = new Block (get_src (get_location ()));
var stmt = parse_embedded_statement_without_block ();
- if (context.profile == Profile.DOVA && stmt is ReturnStatement) {
- // split
- // return foo;
- // into
- // result = foo;
- // return;
- var ret_stmt = (ReturnStatement) stmt;
- if (ret_stmt.return_expression != null) {
- var assignment = new Assignment (new MemberAccess.simple ("result"), ret_stmt.return_expression);
- ret_stmt.return_expression = null;
- block.add_statement (new ExpressionStatement (assignment));
- }
- }
block.add_statement (stmt);
return block;
@@ -2187,7 +2116,7 @@ public class Vala.Parser : CodeVisitor {
method.body.source_reference.end = get_current_src ().end;
- if (!context.experimental && context.profile != Profile.DOVA) {
+ if (!context.experimental) {
Report.warning (method.source_reference, "main blocks are experimental");
}
@@ -2576,9 +2505,6 @@ public class Vala.Parser : CodeVisitor {
var begin = get_location ();
var access = parse_access_modifier ();
var flags = parse_member_declaration_modifiers ();
- if (context.profile == Profile.DOVA) {
- accept (TokenType.VOLATILE);
- }
var type = parse_type (true, true);
string id = parse_identifier ();
@@ -2627,58 +2553,6 @@ public class Vala.Parser : CodeVisitor {
return initializer;
}
- ListLiteral parse_list_literal () throws ParseError {
- var begin = get_location ();
- expect (TokenType.OPEN_BRACKET);
- var initializer = new ListLiteral (get_src (begin));
- if (current () != TokenType.CLOSE_BRACKET) {
- do {
- var init = parse_expression ();
- initializer.add_expression (init);
- } while (accept (TokenType.COMMA));
- }
- expect (TokenType.CLOSE_BRACKET);
- return initializer;
- }
-
- Expression parse_set_literal () throws ParseError {
- var begin = get_location ();
- expect (TokenType.OPEN_BRACE);
- var set = new SetLiteral (get_src (begin));
- bool first = true;
- if (current () != TokenType.CLOSE_BRACE) {
- do {
- var expr = parse_expression ();
- if (first && accept (TokenType.COLON)) {
- // found colon after expression, it's a map
- rollback (begin);
- return parse_map_literal ();
- }
- first = false;
- set.add_expression (expr);
- } while (accept (TokenType.COMMA));
- }
- expect (TokenType.CLOSE_BRACE);
- return set;
- }
-
- Expression parse_map_literal () throws ParseError {
- var begin = get_location ();
- expect (TokenType.OPEN_BRACE);
- var map = new MapLiteral (get_src (begin));
- if (current () != TokenType.CLOSE_BRACE) {
- do {
- var key = parse_expression ();
- map.add_key (key);
- expect (TokenType.COLON);
- var value = parse_expression ();
- map.add_value (value);
- } while (accept (TokenType.COMMA));
- }
- expect (TokenType.CLOSE_BRACE);
- return map;
- }
-
void parse_method_declaration (Symbol parent, List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
@@ -2741,21 +2615,10 @@ public class Vala.Parser : CodeVisitor {
} while (accept (TokenType.COMMA));
}
expect (TokenType.CLOSE_PARENS);
- if (context.profile == Profile.DOVA) {
- var error_type = new UnresolvedType.from_symbol (new UnresolvedSymbol (new UnresolvedSymbol (null, "Dova"), "Error"), method.source_reference);
- method.add_error_type (error_type);
- if (accept (TokenType.THROWS)) {
- do {
- parse_type (true, false);
- } while (accept (TokenType.COMMA));
- Report.warning (method.source_reference, "`throws' is ignored in the Dova profile");
- }
- } else {
- if (accept (TokenType.THROWS)) {
- do {
- method.add_error_type (parse_type (true, false));
- } while (accept (TokenType.COMMA));
- }
+ if (accept (TokenType.THROWS)) {
+ do {
+ method.add_error_type (parse_type (true, false));
+ } while (accept (TokenType.COMMA));
}
while (accept (TokenType.REQUIRES)) {
expect (TokenType.OPEN_PARENS);
@@ -2783,9 +2646,7 @@ public class Vala.Parser : CodeVisitor {
var type = parse_type (true, true);
bool getter_owned = false;
- if (context.profile == Profile.DOVA) {
- getter_owned = true;
- } else if (accept (TokenType.HASH)) {
+ if (accept (TokenType.HASH)) {
if (!context.deprecated) {
Report.warning (get_last_src (), "deprecated syntax, use `owned` modifier before `get'");
}
@@ -2819,14 +2680,11 @@ public class Vala.Parser : CodeVisitor {
if (ModifierFlags.EXTERN in flags || scanner.source_file.file_type == SourceFileType.PACKAGE) {
prop.external = true;
}
- if (context.profile == Profile.DOVA) {
- } else {
- if (accept (TokenType.THROWS)) {
- do {
- prop.add_error_type (parse_type (true, false));
- } while (accept (TokenType.COMMA));
- Report.error (prop.source_reference, "properties throwing errors are not supported yet");
- }
+ if (accept (TokenType.THROWS)) {
+ do {
+ prop.add_error_type (parse_type (true, false));
+ } while (accept (TokenType.COMMA));
+ Report.error (prop.source_reference, "properties throwing errors are not supported yet");
}
expect (TokenType.OPEN_BRACE);
while (current () != TokenType.CLOSE_BRACE) {
@@ -2845,7 +2703,7 @@ public class Vala.Parser : CodeVisitor {
var accessor_access = parse_access_modifier (SymbolAccessibility.PUBLIC);
var value_type = type.copy ();
- value_type.value_owned = (context.profile != Profile.DOVA && accept (TokenType.OWNED));
+ value_type.value_owned = accept (TokenType.OWNED);
if (accept (TokenType.GET)) {
if (prop.get_accessor != null) {
@@ -3292,9 +3150,6 @@ public class Vala.Parser : CodeVisitor {
direction = ParameterDirection.REF;
}
- if (context.profile == Profile.DOVA) {
- accept (TokenType.VOLATILE);
- }
DataType type;
if (direction == ParameterDirection.IN) {
// in parameters are unowned by default
@@ -3353,21 +3208,10 @@ public class Vala.Parser : CodeVisitor {
} while (accept (TokenType.COMMA));
}
expect (TokenType.CLOSE_PARENS);
- if (context.profile == Profile.DOVA) {
- var error_type = new UnresolvedType.from_symbol (new UnresolvedSymbol (new UnresolvedSymbol (null, "Dova"), "Error"), method.source_reference);
- method.add_error_type (error_type);
- if (accept (TokenType.THROWS)) {
- do {
- parse_type (true, false);
- } while (accept (TokenType.COMMA));
- Report.warning (method.source_reference, "`throws' is ignored in the Dova profile");
- }
- } else {
- if (accept (TokenType.THROWS)) {
- do {
- method.add_error_type (parse_type (true, false));
- } while (accept (TokenType.COMMA));
- }
+ if (accept (TokenType.THROWS)) {
+ do {
+ method.add_error_type (parse_type (true, false));
+ } while (accept (TokenType.COMMA));
}
while (accept (TokenType.REQUIRES)) {
expect (TokenType.OPEN_PARENS);
@@ -3425,21 +3269,10 @@ public class Vala.Parser : CodeVisitor {
} while (accept (TokenType.COMMA));
}
expect (TokenType.CLOSE_PARENS);
- if (context.profile == Profile.DOVA) {
- var error_type = new UnresolvedType.from_symbol (new UnresolvedSymbol (new UnresolvedSymbol (null, "Dova"), "Error"), d.source_reference);
- d.add_error_type (error_type);
- if (accept (TokenType.THROWS)) {
- do {
- parse_type (true, false);
- } while (accept (TokenType.COMMA));
- Report.warning (d.source_reference, "`throws' is ignored in the Dova profile");
- }
- } else {
- if (accept (TokenType.THROWS)) {
- do {
- d.add_error_type (parse_type (true, false));
- } while (accept (TokenType.COMMA));
- }
+ if (accept (TokenType.THROWS)) {
+ do {
+ d.add_error_type (parse_type (true, false));
+ } while (accept (TokenType.COMMA));
}
expect (TokenType.SEMICOLON);
diff --git a/vala/valapointertype.vala b/vala/valapointertype.vala
index fce8e9b6b..d0f938dc4 100644
--- a/vala/valapointertype.vala
+++ b/vala/valapointertype.vala
@@ -92,17 +92,7 @@ public class Vala.PointerType : DataType {
}
public override Symbol? get_member (string member_name) {
- if (CodeContext.get ().profile != Profile.DOVA) {
- return null;
- }
-
- Symbol base_symbol = base_type.data_type;
-
- if (base_symbol == null) {
- return null;
- }
-
- return SemanticAnalyzer.symbol_lookup_inherited (base_symbol, member_name);
+ return null;
}
public override Symbol? get_pointer_member (string member_name) {
diff --git a/vala/valaprofile.vala b/vala/valaprofile.vala
index 52108266e..677930fbb 100644
--- a/vala/valaprofile.vala
+++ b/vala/valaprofile.vala
@@ -22,6 +22,5 @@
public enum Vala.Profile {
POSIX,
- GOBJECT,
- DOVA
+ GOBJECT
}
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index 47a197772..466fe6c18 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -143,12 +143,7 @@ public class Vala.PropertyAccessor : Subroutine {
body = new Block (source_reference);
var ma = new MemberAccess.simple ("_%s".printf (prop.name), source_reference);
if (readable) {
- if (context.profile == Profile.DOVA) {
- body.add_statement (new ExpressionStatement (new Assignment (new MemberAccess.simple ("result", source_reference), ma, AssignmentOperator.SIMPLE, source_reference), source_reference));
- body.add_statement (new ReturnStatement (null, source_reference));
- } else {
- body.add_statement (new ReturnStatement (ma, source_reference));
- }
+ body.add_statement (new ReturnStatement (ma, source_reference));
} else {
Expression value = new MemberAccess.simple ("value", source_reference);
if (value_type.value_owned) {
@@ -161,23 +156,16 @@ public class Vala.PropertyAccessor : Subroutine {
}
if (body != null) {
- if (readable && context.profile == Profile.DOVA) {
- result_var = new LocalVariable (value_type.copy (), "result", null, source_reference);
- result_var.is_result = true;
-
- result_var.check (context);
- } else if (writable || construction) {
+ if (writable || construction) {
value_parameter = new Parameter ("value", value_type, source_reference);
body.scope.add (value_parameter.name, value_parameter);
}
body.check (context);
- if (context.profile != Profile.DOVA) {
- foreach (DataType body_error_type in body.get_error_types ()) {
- if (!((ErrorType) body_error_type).dynamic_error) {
- Report.warning (body_error_type.source_reference, "unhandled error `%s'".printf (body_error_type.to_string()));
- }
+ foreach (DataType body_error_type in body.get_error_types ()) {
+ if (!((ErrorType) body_error_type).dynamic_error) {
+ Report.warning (body_error_type.source_reference, "unhandled error `%s'".printf (body_error_type.to_string()));
}
}
}
diff --git a/vala/valarealliteral.vala b/vala/valarealliteral.vala
index 0acfb8893..0dc01add8 100644
--- a/vala/valarealliteral.vala
+++ b/vala/valarealliteral.vala
@@ -78,7 +78,7 @@ public class Vala.RealLiteral : Literal {
checked = true;
var st = (Struct) context.analyzer.root_symbol.scope.lookup (get_type_name ());
- // ensure attributes are already processed in case of bootstrapping dova-core
+ // ensure attributes are already processed
st.check (context);
value_type = new FloatingType (st);
diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala
index 6a5370580..e407aec4a 100644
--- a/vala/valareturnstatement.vala
+++ b/vala/valareturnstatement.vala
@@ -93,11 +93,6 @@ public class Vala.ReturnStatement : CodeNode, Statement {
return false;
}
- if (context.profile == Profile.DOVA) {
- // no return expressions in Dova profile
- return !error;
- }
-
if (return_expression == null) {
if (!(context.analyzer.current_return_type is VoidType)) {
error = true;
diff --git a/vala/valascanner.vala b/vala/valascanner.vala
index 926a5374e..ba4736966 100644
--- a/vala/valascanner.vala
+++ b/vala/valascanner.vala
@@ -774,7 +774,7 @@ public class Vala.Scanner {
len++;
}
type = get_identifier_or_keyword (begin, len);
- } else if (current[0] == '@' && source_file.context.profile != Profile.DOVA) {
+ } else if (current[0] == '@') {
if (current < end - 1 && current[1] == '"') {
type = TokenType.OPEN_TEMPLATE;
current += 2;
@@ -1129,13 +1129,6 @@ public class Vala.Scanner {
column = 1;
token_length_in_chars = 1;
} else {
- if (type == TokenType.STRING_LITERAL && source_file.context.profile == Profile.DOVA && current[0] == '$') {
- // string template
- type = TokenType.OPEN_TEMPLATE;
- current = begin;
- state_stack += State.TEMPLATE;
- break;
- }
unichar u = ((string) current).get_char_validated ((long) (end - current));
if (u != (unichar) (-1)) {
current += u.to_utf8 (null);
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 5e8c4f561..3d66b56f3 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -186,22 +186,15 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
int_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int"));
uint_type = new IntegerType ((Struct) root_symbol.scope.lookup ("uint"));
- if (context.profile != Profile.DOVA) {
- uchar_type = new IntegerType ((Struct) root_symbol.scope.lookup ("uchar"));
- int8_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int8"));
- short_type = new IntegerType ((Struct) root_symbol.scope.lookup ("short"));
- ushort_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ushort"));
- long_type = new IntegerType ((Struct) root_symbol.scope.lookup ("long"));
- ulong_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ulong"));
- size_t_type = new IntegerType ((Struct) root_symbol.scope.lookup ("size_t"));
- ssize_t_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ssize_t"));
- double_type = new FloatingType ((Struct) root_symbol.scope.lookup ("double"));
- } else {
- long_type = int_type;
- ulong_type = uint_type;
- size_t_type = uint_type;
- ssize_t_type = int_type;
- }
+ uchar_type = new IntegerType ((Struct) root_symbol.scope.lookup ("uchar"));
+ int8_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int8"));
+ short_type = new IntegerType ((Struct) root_symbol.scope.lookup ("short"));
+ ushort_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ushort"));
+ long_type = new IntegerType ((Struct) root_symbol.scope.lookup ("long"));
+ ulong_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ulong"));
+ size_t_type = new IntegerType ((Struct) root_symbol.scope.lookup ("size_t"));
+ ssize_t_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ssize_t"));
+ double_type = new FloatingType ((Struct) root_symbol.scope.lookup ("double"));
var unichar_struct = (Struct) root_symbol.scope.lookup ("unichar");
if (unichar_struct != null) {
@@ -223,14 +216,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
gerror_type = (Class) glib_ns.scope.lookup ("Error");
regex_type = new ObjectType ((Class) root_symbol.scope.lookup ("GLib").scope.lookup ("Regex"));
- } else if (context.profile == Profile.DOVA) {
- var dova_ns = root_symbol.scope.lookup ("Dova");
-
- object_type = (Class) dova_ns.scope.lookup ("Object");
- type_type = new ObjectType ((Class) dova_ns.scope.lookup ("Type"));
- list_type = new ObjectType ((Class) dova_ns.scope.lookup ("List"));
- tuple_type = new ObjectType ((Class) dova_ns.scope.lookup ("Tuple"));
- error_type = new ObjectType ((Class) dova_ns.scope.lookup ("Error"));
}
current_symbol = root_symbol;
@@ -631,14 +616,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
instance_type = instance_pointer_type.base_type;
}
- if (CodeContext.get ().profile == Profile.DOVA) {
- while (instance_type is ArrayType) {
- var instance_array_type = (ArrayType) instance_type;
- instance_type = new ObjectType ((Class) CodeContext.get ().root.scope.lookup ("Dova").scope.lookup ("Array"));
- instance_type.add_type_argument (instance_array_type.element_type);
- }
- }
-
if (instance_type is DelegateType && ((DelegateType) instance_type).delegate_symbol == type_symbol) {
return instance_type;
} else if (instance_type.data_type == type_symbol) {
diff --git a/vala/valasetliteral.vala b/vala/valasetliteral.vala
deleted file mode 100644
index bf10e0155..000000000
--- a/vala/valasetliteral.vala
+++ /dev/null
@@ -1,124 +0,0 @@
-/* valasetliteral.vala
- *
- * Copyright (C) 2009-2010 Jürg Billeter
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Jürg Billeter <j@bitron.ch>
- */
-
-public class Vala.SetLiteral : Literal {
- private List<Expression> expression_list = new ArrayList<Expression> ();
-
- public DataType element_type { get; private set; }
-
- public SetLiteral (SourceReference? source_reference = null) {
- this.source_reference = source_reference;
- }
-
- public override void accept_children (CodeVisitor visitor) {
- foreach (Expression expr in expression_list) {
- expr.accept (visitor);
- }
- }
-
- public override void accept (CodeVisitor visitor) {
- visitor.visit_set_literal (this);
-
- visitor.visit_expression (this);
- }
-
- public void add_expression (Expression expr) {
- expression_list.add (expr);
- expr.parent_node = this;
- }
-
- public List<Expression> get_expressions () {
- return expression_list;
- }
-
- public override bool is_pure () {
- return false;
- }
-
- public override void replace_expression (Expression old_node, Expression new_node) {
- for (int i = 0; i < expression_list.size; i++) {
- if (expression_list[i] == old_node) {
- expression_list[i] = new_node;
- }
- }
- }
-
- public override bool check (CodeContext context) {
- if (checked) {
- return !error;
- }
-
- checked = true;
-
- var set_type = new ObjectType ((Class) context.root.scope.lookup ("Dova").scope.lookup ("Set"));
- set_type.value_owned = true;
-
- bool fixed_element_type = false;
- if (target_type != null && target_type.data_type == set_type.data_type && target_type.get_type_arguments ().size == 1) {
- element_type = target_type.get_type_arguments ().get (0).copy ();
- element_type.value_owned = false;
- fixed_element_type = true;
- }
-
- for (int i = 0; i < expression_list.size; i++) {
- var expr = expression_list[i];
-
- if (fixed_element_type) {
- expr.target_type = element_type;
- }
- if (!expr.check (context)) {
- return false;
- }
-
- // expression might have been replaced in the list
- expr = expression_list[i];
-
- if (element_type == null) {
- element_type = expr.value_type.copy ();
- element_type.value_owned = false;
- }
- }
-
- if (element_type == null) {
- error = true;
- Report.error (source_reference, "cannot infer element type for set literal");
- return false;
- }
-
- element_type = element_type.copy ();
- element_type.value_owned = true;
- set_type.add_type_argument (element_type);
- value_type = set_type;
-
- return !error;
- }
-
- public override void emit (CodeGenerator codegen) {
- foreach (Expression expr in expression_list) {
- expr.emit (codegen);
- }
-
- codegen.visit_set_literal (this);
-
- codegen.visit_expression (this);
- }
-}
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index f913a019c..b9229e099 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -207,7 +207,7 @@ public class Vala.Struct : TypeSymbol {
m.this_parameter = new Parameter ("this", SemanticAnalyzer.get_data_type_for_symbol (this));
m.scope.add (m.this_parameter.name, m.this_parameter);
}
- if (!(m.return_type is VoidType) && (CodeContext.get ().profile == Profile.DOVA || m.get_postconditions ().size > 0)) {
+ if (!(m.return_type is VoidType) && m.get_postconditions ().size > 0) {
m.result_var = new LocalVariable (m.return_type.copy (), "result", null, source_reference);
m.result_var.is_result = true;
}
@@ -407,9 +407,6 @@ public class Vala.Struct : TypeSymbol {
* instances are passed by value.
*/
public bool is_simple_type () {
- if (CodeContext.get ().profile == Profile.DOVA) {
- return true;
- }
var st = base_struct;
if (st != null && st.is_simple_type ()) {
return true;
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index f11d74ee6..a269df453 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -75,18 +75,6 @@ public class Vala.SymbolResolver : CodeVisitor {
}
}
- if (context.profile == Profile.DOVA) {
- // classes derive from Object by default
- if (cl.base_class == null) {
- var any_class = (Class) root_symbol.scope.lookup ("any");
- if (cl != any_class) {
- var object_class = (Class) root_symbol.scope.lookup ("Dova").scope.lookup ("Object");
- cl.add_base_type (new ObjectType (object_class));
- cl.base_class = object_class;
- }
- }
- }
-
current_scope = current_scope.parent_scope;
}
@@ -122,14 +110,6 @@ public class Vala.SymbolResolver : CodeVisitor {
}
}
- if (context.profile == Profile.DOVA) {
- // all interfaces require Object
- if (iface.get_prerequisites ().size == 0) {
- var object_class = (Class) root_symbol.scope.lookup ("Dova").scope.lookup ("Object");
- iface.add_prerequisite (new ObjectType (object_class));
- }
- }
-
current_scope = current_scope.parent_scope;
}
@@ -483,18 +463,6 @@ public class Vala.SymbolResolver : CodeVisitor {
tmpl.accept_children (this);
}
- public override void visit_list_literal (ListLiteral lit) {
- lit.accept_children (this);
- }
-
- public override void visit_set_literal (SetLiteral lit) {
- lit.accept_children (this);
- }
-
- public override void visit_map_literal (MapLiteral lit) {
- lit.accept_children (this);
- }
-
public override void visit_tuple (Tuple tuple) {
tuple.accept_children (this);
}
diff --git a/vala/valatemplate.vala b/vala/valatemplate.vala
index d11c0c87c..5e27a7b8e 100644
--- a/vala/valatemplate.vala
+++ b/vala/valatemplate.vala
@@ -72,18 +72,11 @@ public class Vala.Template : Expression {
} else {
expr = stringify (expression_list[0]);
if (expression_list.size > 1) {
- if (context.profile == Profile.DOVA) {
- // varargs concat not yet supported
- for (int i = 1; i < expression_list.size; i++) {
- expr = new BinaryExpression (BinaryOperator.PLUS, expr, stringify (expression_list[i]), source_reference);
- }
- } else {
- var concat = new MethodCall (new MemberAccess (expr, "concat", source_reference), source_reference);
- for (int i = 1; i < expression_list.size; i++) {
- concat.add_argument (stringify (expression_list[i]));
- }
- expr = concat;
+ var concat = new MethodCall (new MemberAccess (expr, "concat", source_reference), source_reference);
+ for (int i = 1; i < expression_list.size; i++) {
+ concat.add_argument (stringify (expression_list[i]));
}
+ expr = concat;
}
}
expr.target_type = target_type;
diff --git a/vala/valatuple.vala b/vala/valatuple.vala
index 852215a4e..d35795a39 100644
--- a/vala/valatuple.vala
+++ b/vala/valatuple.vala
@@ -71,23 +71,9 @@ public class Vala.Tuple : Expression {
checked = true;
- if (context.profile != Profile.DOVA) {
- Report.error (source_reference, "tuples are not supported");
- error = true;
- return false;
- }
-
- value_type = new ObjectType ((Class) context.root.scope.lookup ("Dova").scope.lookup ("Tuple"));
- value_type.value_owned = true;
-
- foreach (var expr in expression_list) {
- if (!expr.check (context)) {
- return false;
- }
- value_type.add_type_argument (expr.value_type.copy ());
- }
-
- return !error;
+ Report.error (source_reference, "tuples are not supported");
+ error = true;
+ return false;
}
public override void emit (CodeGenerator codegen) {