Issue 4713. Support for 'static const' field in interfaces

http://code.google.com/p/dart/issues/detail?id=4713

R=brianwilkerson@google.com
BUG=

Review URL: https://chromiumcodereview.appspot.com//10874089

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11409 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com 2012-08-27 19:51:17 +00:00
parent 670d295e40
commit 618ff29a6d
5 changed files with 4 additions and 8 deletions

View file

@ -13,8 +13,9 @@ import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.ErrorCode;
import com.google.dart.compiler.InternalCompilerException;
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.Source;
import com.google.dart.compiler.PackageLibraryManager;
import com.google.dart.compiler.Source;
import com.google.dart.compiler.ast.DartAnnotation;
import com.google.dart.compiler.ast.DartArrayAccess;
import com.google.dart.compiler.ast.DartArrayLiteral;
import com.google.dart.compiler.ast.DartBinaryExpression;
@ -51,7 +52,6 @@ import com.google.dart.compiler.ast.DartLabel;
import com.google.dart.compiler.ast.DartLibraryDirective;
import com.google.dart.compiler.ast.DartMapLiteral;
import com.google.dart.compiler.ast.DartMapLiteralEntry;
import com.google.dart.compiler.ast.DartAnnotation;
import com.google.dart.compiler.ast.DartMethodDefinition;
import com.google.dart.compiler.ast.DartMethodInvocation;
import com.google.dart.compiler.ast.DartNamedExpression;
@ -1168,7 +1168,7 @@ public class DartParser extends CompletionHooksParserBase {
reportError(position(), ParserErrorCode.TOP_LEVEL_CANNOT_BE_STATIC);
} else {
if (isParsingInterface
&& (peek(0) != Token.FINAL)) {
&& peek(0) != Token.FINAL && peek(0) != Token.CONST) {
reportError(position(), ParserErrorCode.NON_FINAL_STATIC_MEMBER_IN_INTERFACE);
}
modifiers = modifiers.makeStatic();

View file

@ -108,7 +108,7 @@ public enum ParserErrorCode implements ErrorCode {
NO_SPACE_AFTER_PLUS("Cannot have space between plus and numeric literal"),
NO_SOUP_FOR_YOU("Too many errors"),
NO_UNARY_PLUS_OPERATOR("No unary plus operator in Dart"),
NON_FINAL_STATIC_MEMBER_IN_INTERFACE("Non-final static members are not allowed in interfaces"),
NON_FINAL_STATIC_MEMBER_IN_INTERFACE("Non-final/const static members are not allowed in interfaces"),
ONLY_FACTORIES_CAN_REDIRECT("Only factory constructors can redirect to another constructor"),
ONLY_ONE_LIBRARY_DIRECTIVE("Only one library directive may be declared in a file"),
OPERATOR_CANNOT_BE_STATIC("Operators cannot be static"),

View file

@ -27,7 +27,6 @@ spawn_function_negative_test: Fail, OK # Fails at runtime.
spawn_uri_negative_test: Fail, OK # Fails at runtime.
spawn_uri_vm_negative_test: Fail, OK # Fails at runtime.
unresolved_ports_negative_test: Fail, OK # Fails at runtime.
compute_this_script_browser_test: Fail # Issue 4713
[ $runtime == safari ]
cross_isolate_message_test: Skip # Depends on 32/64 bit Safari. See Issue 1120

View file

@ -81,8 +81,6 @@ const_syntax_test/09: Fail # Issue 4713
getter_no_setter_test/01: Fail # Fails to detect compile-time error.
instance_call_wrong_argument_count_negative_test: Fail # Runtime only test, rewrite as multitest
interface_factory1_negative_test: Fail # language change 1031
interface_constants_test: Fail # Issue 3549
ct_const_test: Fail # Issue 3549
is_not_class2_negative_test: Fail # Runtime only test, rewrite as multitest
library2_negative_test: Fail # still a valid test? Issue 3649
library4_negative_test: Fail # still a valid test? Issue 3530

View file

@ -17,7 +17,6 @@ dartdoc_test: Skip # http://dartbug.com/4541
[ $compiler == dartc ]
dummy_compiler_test: Fail # http://dartbug.com/4539
txt_layout_test: Fail # Issue 4713
[ $compiler == dart2js && $browser ]
*: Skip