Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: compiler/java/com/google/dart/compiler/parser/DartParser.java

Issue 8769023: Add support for ignoring a string after the native keyword in a method, needed for compatability ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 package com.google.dart.compiler.parser; 5 package com.google.dart.compiler.parser;
6 6
7 import com.google.common.annotations.VisibleForTesting; 7 import com.google.common.annotations.VisibleForTesting;
8 import com.google.common.io.CharStreams; 8 import com.google.common.io.CharStreams;
9 import com.google.dart.compiler.DartCompilationError; 9 import com.google.dart.compiler.DartCompilationError;
10 import com.google.dart.compiler.DartCompilerListener; 10 import com.google.dart.compiler.DartCompilerListener;
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 return DartMethodDefinition.create(name, function, modifiers, initializers, null); 1106 return DartMethodDefinition.create(name, function, modifiers, initializers, null);
1107 } 1107 }
1108 1108
1109 private DartBlock parseNativeBlock(Modifiers modifiers) { 1109 private DartBlock parseNativeBlock(Modifiers modifiers) {
1110 beginNativeBody(); 1110 beginNativeBody();
1111 if (!optionalPseudoKeyword(NATIVE_KEYWORD)) { 1111 if (!optionalPseudoKeyword(NATIVE_KEYWORD)) {
1112 throw new AssertionError(); 1112 throw new AssertionError();
1113 } 1113 }
1114 if (optional(Token.SEMICOLON)) { 1114 if (optional(Token.SEMICOLON)) {
1115 return done(new DartNativeBlock()); 1115 return done(new DartNativeBlock());
1116 } else { 1116 } else if (match(Token.LBRACE) || match(Token.ARROW)) {
1117 if (!modifiers.isStatic()) { 1117 if (!modifiers.isStatic()) {
1118 reportError(position(), ParserErrorCode.EXPORTED_FUNCTIONS_MUST_BE_STATI C); 1118 reportError(position(), ParserErrorCode.EXPORTED_FUNCTIONS_MUST_BE_STATI C);
Bill Hesse 2011/12/05 12:27:54 This error, exported functions must be static, is
1119 } 1119 }
1120 return done(parseFunctionStatementBody(true)); 1120 return done(parseFunctionStatementBody(true));
1121 } else {
1122 parseString();
1123 expect(Token.SEMICOLON);
1124 return done(new DartNativeBlock());
1121 } 1125 }
1122 } 1126 }
1123 1127
1124 private DartNode parseMethodOrAccessor(Modifiers modifiers, DartTypeNode retur nType) { 1128 private DartNode parseMethodOrAccessor(Modifiers modifiers, DartTypeNode retur nType) {
1125 DartMethodDefinition method = done(parseMethod(modifiers, returnType)); 1129 DartMethodDefinition method = done(parseMethod(modifiers, returnType));
1126 if (method.getModifiers().isGetter() || method.getModifiers().isSetter()) { 1130 if (method.getModifiers().isGetter() || method.getModifiers().isSetter()) {
1127 DartField field = new DartField((DartIdentifier) method.getName(), 1131 DartField field = new DartField((DartIdentifier) method.getName(),
1128 method.getModifiers().makeAbstractField(), method, null); 1132 method.getModifiers().makeAbstractField(), method, null);
1129 field.setSourceInfo(method); 1133 field.setSourceInfo(method);
1130 DartFieldDefinition fieldDefinition = 1134 DartFieldDefinition fieldDefinition =
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
3667 } else { 3671 } else {
3668 ctx.error(dartError); 3672 ctx.error(dartError);
3669 errorHistory.add(dartError.hashCode()); 3673 errorHistory.add(dartError.hashCode());
3670 } 3674 }
3671 } 3675 }
3672 3676
3673 private void reportError(DartNode node, ErrorCode errorCode, Object... argumen ts) { 3677 private void reportError(DartNode node, ErrorCode errorCode, Object... argumen ts) {
3674 reportError(new DartCompilationError(node, errorCode, arguments)); 3678 reportError(new DartCompilationError(node, errorCode, arguments));
3675 } 3679 }
3676 } 3680 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698