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

Side by Side Diff: pkg/analyzer/lib/src/generated/ast.dart

Issue 632203002: More string literals getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | pkg/analyzer/test/generated/ast_test.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.ast; 8 library engine.ast;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 16027 matching lines...) Expand 10 before | Expand all | Expand 10 after
16038 */ 16038 */
16039 Element get toolkitElement => _toolkitElement; 16039 Element get toolkitElement => _toolkitElement;
16040 16040
16041 /** 16041 /**
16042 * Return the value of the literal. 16042 * Return the value of the literal.
16043 * 16043 *
16044 * @return the value of the literal 16044 * @return the value of the literal
16045 */ 16045 */
16046 String get value => _value; 16046 String get value => _value;
16047 16047
16048 /** 16048 @override
16049 * Return `true` if this string literal is a multi-line string.
16050 *
16051 * @return `true` if this string literal is a multi-line string
16052 */
16053 bool get isMultiline { 16049 bool get isMultiline {
16054 String lexeme = literal.lexeme; 16050 String lexeme = literal.lexeme;
16055 if (lexeme.length < 6) { 16051 if (lexeme.length < 6) {
16056 return false; 16052 return false;
16057 } 16053 }
16058 return StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || StringUtilitie s.endsWith3(lexeme, 0x27, 0x27, 0x27); 16054 return StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || StringUtilitie s.endsWith3(lexeme, 0x27, 0x27, 0x27);
16059 } 16055 }
16060 16056
16057 @override
16061 bool get isRaw => literal.lexeme.codeUnitAt(0) == 0x72; 16058 bool get isRaw => literal.lexeme.codeUnitAt(0) == 0x72;
16062 16059
16063 @override 16060 @override
16061 bool get isSingleQuoted {
16062 String lexeme = literal.lexeme;
16063 return StringUtilities.endsWithChar(lexeme, 0x27);
Paul Berry 2014/10/07 13:18:04 Would it be better to check the beginning of the s
Brian Wilkerson 2014/10/07 14:12:04 isMultiline (on line 16049) has the same potential
scheglov 2014/10/07 15:37:56 Done.
scheglov 2014/10/07 15:37:56 Done.
16064 }
16065
16066 @override
16064 bool get isSynthetic => literal.isSynthetic; 16067 bool get isSynthetic => literal.isSynthetic;
16065 16068
16066 /** 16069 /**
16067 * Set the toolkit specific, non-Dart, element associated with this literal. 16070 * Set the toolkit specific, non-Dart, element associated with this literal.
16068 * 16071 *
16069 * @param element the toolkit specific element to be associated with this lite ral 16072 * @param element the toolkit specific element to be associated with this lite ral
16070 */ 16073 */
16071 void set toolkitElement(Element element) { 16074 void set toolkitElement(Element element) {
16072 _toolkitElement = element; 16075 _toolkitElement = element;
16073 } 16076 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
16174 return element.contentsOffset; 16177 return element.contentsOffset;
16175 } 16178 }
16176 16179
16177 @override 16180 @override
16178 int get contentsEnd { 16181 int get contentsEnd {
16179 InterpolationString element = _elements.last; 16182 InterpolationString element = _elements.last;
16180 return element.contentsEnd; 16183 return element.contentsEnd;
16181 } 16184 }
16182 16185
16183 @override 16186 @override
16187 bool get isMultiline {
16188 InterpolationString element = _elements.last;
16189 String lexeme = element._contents.lexeme;
16190 if (lexeme.length < 6) {
16191 return false;
16192 }
16193 return StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) ||
Paul Berry 2014/10/07 13:18:04 Similar concern here.
scheglov 2014/10/07 15:37:56 Done.
16194 StringUtilities.endsWith3(lexeme, 0x27, 0x27, 0x27);
16195 }
16196
16197 @override
16184 bool get isRaw => false; 16198 bool get isRaw => false;
16199
16200
16201 @override
16202 bool get isSingleQuoted {
16203 InterpolationString lastString = _elements.last;
16204 String lexeme = lastString._contents.lexeme;
16205 return StringUtilities.endsWithChar(lexeme, 0x27);
Paul Berry 2014/10/07 13:18:04 And here.
scheglov 2014/10/07 15:37:56 Done.
16206 }
16185 } 16207 }
16186 16208
16187 /** 16209 /**
16188 * Instances of the class `StringLiteral` represent a string literal expression. 16210 * Instances of the class `StringLiteral` represent a string literal expression.
16189 * 16211 *
16190 * <pre> 16212 * <pre>
16191 * stringLiteral ::= 16213 * stringLiteral ::=
16192 * [SimpleStringLiteral] 16214 * [SimpleStringLiteral]
16193 * | [AdjacentStrings] 16215 * | [AdjacentStrings]
16194 * | [StringInterpolation] 16216 * | [StringInterpolation]
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
16236 * Return the offset of the first contents character. 16258 * Return the offset of the first contents character.
16237 */ 16259 */
16238 int get contentsOffset; 16260 int get contentsOffset;
16239 16261
16240 /** 16262 /**
16241 * Return the offset of the after-last contents character. 16263 * Return the offset of the after-last contents character.
16242 */ 16264 */
16243 int get contentsEnd; 16265 int get contentsEnd;
16244 16266
16245 /** 16267 /**
16268 * Return `true` if this string literal is a multi-line string.
16269 */
16270 bool get isMultiline;
16271
16272 /**
16246 * Return `true` if this string literal is a raw string. 16273 * Return `true` if this string literal is a raw string.
16247 */ 16274 */
16248 bool get isRaw; 16275 bool get isRaw;
16276
16277 /**
16278 * Return `true` if this string literal uses single qoutes (' or ''').
16279 * Return `false` if this string literal uses double qoutes (" or """).
16280 */
16281 bool get isSingleQuoted;
16249 } 16282 }
16250 16283
16251 /** 16284 /**
16252 * Instances of the class `SuperConstructorInvocation` represent the invocation of a 16285 * Instances of the class `SuperConstructorInvocation` represent the invocation of a
16253 * superclass' constructor from within a constructor's initialization list. 16286 * superclass' constructor from within a constructor's initialization list.
16254 * 16287 *
16255 * <pre> 16288 * <pre>
16256 * superInvocation ::= 16289 * superInvocation ::=
16257 * 'super' ('.' [SimpleIdentifier])? [ArgumentList] 16290 * 'super' ('.' [SimpleIdentifier])? [ArgumentList]
16258 * </pre> 16291 * </pre>
(...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after
19661 _elements[index] = node; 19694 _elements[index] = node;
19662 } 19695 }
19663 void clear() { 19696 void clear() {
19664 _elements = <E> []; 19697 _elements = <E> [];
19665 } 19698 }
19666 int get length => _elements.length; 19699 int get length => _elements.length;
19667 void set length(int value) { 19700 void set length(int value) {
19668 throw new UnsupportedError("Cannot resize NodeList."); 19701 throw new UnsupportedError("Cannot resize NodeList.");
19669 } 19702 }
19670 } 19703 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | pkg/analyzer/test/generated/ast_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698