| OLD | NEW |
| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 // something other than declaration | 147 // something other than declaration |
| 148 break; | 148 break; |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 // apply comment to declaration | 151 // apply comment to declaration |
| 152 if (decl != null) { | 152 if (decl != null) { |
| 153 String commentStr = sourceCode.substring(comment.getSourceInfo().getOf
fset(), | 153 String commentStr = sourceCode.substring(comment.getSourceInfo().getOf
fset(), |
| 154 comment.getSourceInfo().getEnd()); | 154 comment.getSourceInfo().getEnd()); |
| 155 tokenizeComment(comment, commentStr); | 155 tokenizeComment(comment, commentStr); |
| 156 // may be @Metadata | |
| 157 if (commentStr.contains("@deprecated")) { | |
| 158 decl.setObsoleteMetadata(decl.getObsoleteMetadata().makeDeprecated()
); | |
| 159 } | |
| 160 if (commentStr.contains("@override")) { | |
| 161 decl.setObsoleteMetadata(decl.getObsoleteMetadata().makeOverride()); | |
| 162 } | |
| 163 // DartDoc | 156 // DartDoc |
| 164 if (comment.isDartDoc()) { | 157 if (comment.isDartDoc()) { |
| 165 decl.setDartDoc(comment); | 158 decl.setDartDoc(comment); |
| 166 } | 159 } |
| 167 } | 160 } |
| 168 } | 161 } |
| 169 } | 162 } |
| 170 } | 163 } |
| 171 | 164 |
| 172 private static void tokenizeComment(DartComment comment, String src) { | 165 private static void tokenizeComment(DartComment comment, String src) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 boolean hasMore1 = commentStart + 1 < sourceString.length(); | 280 boolean hasMore1 = commentStart + 1 < sourceString.length(); |
| 288 boolean hasMore2 = commentStart + 2 < sourceString.length(); | 281 boolean hasMore2 = commentStart + 2 < sourceString.length(); |
| 289 if (hasMore1 && sourceString.charAt(commentStart + 1) == '/') { | 282 if (hasMore1 && sourceString.charAt(commentStart + 1) == '/') { |
| 290 return DartComment.Style.END_OF_LINE; | 283 return DartComment.Style.END_OF_LINE; |
| 291 } else if (hasMore2 && sourceString.charAt(commentStart + 2) == '*') { | 284 } else if (hasMore2 && sourceString.charAt(commentStart + 2) == '*') { |
| 292 return DartComment.Style.DART_DOC; | 285 return DartComment.Style.DART_DOC; |
| 293 } | 286 } |
| 294 return DartComment.Style.BLOCK; | 287 return DartComment.Style.BLOCK; |
| 295 } | 288 } |
| 296 } | 289 } |
| OLD | NEW |