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

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

Issue 10860012: Add support for metadata annotation syntax (issue 4056) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.collect.Lists; 7 import com.google.common.collect.Lists;
8 import com.google.dart.compiler.DartCompilerListener; 8 import com.google.dart.compiler.DartCompilerListener;
9 import com.google.dart.compiler.Source; 9 import com.google.dart.compiler.Source;
10 import com.google.dart.compiler.ast.ASTVisitor; 10 import com.google.dart.compiler.ast.ASTVisitor;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // something other than declaration 142 // something other than declaration
143 break; 143 break;
144 } 144 }
145 } 145 }
146 // apply comment to declaration 146 // apply comment to declaration
147 if (decl != null) { 147 if (decl != null) {
148 String commentStr = sourceCode.substring(comment.getSourceInfo().getOf fset(), 148 String commentStr = sourceCode.substring(comment.getSourceInfo().getOf fset(),
149 comment.getSourceInfo().getEnd()); 149 comment.getSourceInfo().getEnd());
150 // may be @Metadata 150 // may be @Metadata
151 if (commentStr.contains("@deprecated")) { 151 if (commentStr.contains("@deprecated")) {
152 decl.setMetadata(decl.getMetadata().makeDeprecated()); 152 decl.setObsoleteMetadata(decl.getObsoleteMetadata().makeDeprecated() );
153 } 153 }
154 if (commentStr.contains("@override")) { 154 if (commentStr.contains("@override")) {
155 decl.setMetadata(decl.getMetadata().makeOverride()); 155 decl.setObsoleteMetadata(decl.getObsoleteMetadata().makeOverride());
156 } 156 }
157 // DartDoc 157 // DartDoc
158 if (comment.isDartDoc()) { 158 if (comment.isDartDoc()) {
159 decl.setDartDoc(comment); 159 decl.setDartDoc(comment);
160 } 160 }
161 } 161 }
162 } 162 }
163 } 163 }
164 } 164 }
165 165
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 boolean hasMore1 = commentStart + 1 < sourceString.length(); 224 boolean hasMore1 = commentStart + 1 < sourceString.length();
225 boolean hasMore2 = commentStart + 2 < sourceString.length(); 225 boolean hasMore2 = commentStart + 2 < sourceString.length();
226 if (hasMore1 && sourceString.charAt(commentStart + 1) == '/') { 226 if (hasMore1 && sourceString.charAt(commentStart + 1) == '/') {
227 return DartComment.Style.END_OF_LINE; 227 return DartComment.Style.END_OF_LINE;
228 } else if (hasMore2 && sourceString.charAt(commentStart + 2) == '*') { 228 } else if (hasMore2 && sourceString.charAt(commentStart + 2) == '*') {
229 return DartComment.Style.DART_DOC; 229 return DartComment.Style.DART_DOC;
230 } 230 }
231 return DartComment.Style.BLOCK; 231 return DartComment.Style.BLOCK;
232 } 232 }
233 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698