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

Side by Side Diff: pkg/analyzer/lib/src/summary/format.dart

Issue 1864753002: Use isValidConst flag to distinguish between const / final expressions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge and tweaks. Created 4 years, 8 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/format.fbs » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script "pkg/analyzer/tool/generate_files". 6 // To regenerate the file, use the script "pkg/analyzer/tool/generate_files".
7 7
8 library analyzer.src.summary.format; 8 library analyzer.src.summary.format;
9 9
10 import 'flat_buffers.dart' as fb; 10 import 'flat_buffers.dart' as fb;
(...skipping 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 @override 3243 @override
3244 String toString() => convert.JSON.encode(toJson()); 3244 String toString() => convert.JSON.encode(toJson());
3245 } 3245 }
3246 3246
3247 class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id l.UnlinkedConst { 3247 class UnlinkedConstBuilder extends Object with _UnlinkedConstMixin implements id l.UnlinkedConst {
3248 bool _finished = false; 3248 bool _finished = false;
3249 3249
3250 List<idl.UnlinkedExprAssignOperator> _assignmentOperators; 3250 List<idl.UnlinkedExprAssignOperator> _assignmentOperators;
3251 List<double> _doubles; 3251 List<double> _doubles;
3252 List<int> _ints; 3252 List<int> _ints;
3253 bool _isInvalid; 3253 bool _isValidConst;
3254 List<idl.UnlinkedConstOperation> _operations; 3254 List<idl.UnlinkedConstOperation> _operations;
3255 List<EntityRefBuilder> _references; 3255 List<EntityRefBuilder> _references;
3256 List<String> _strings; 3256 List<String> _strings;
3257 3257
3258 @override 3258 @override
3259 List<idl.UnlinkedExprAssignOperator> get assignmentOperators => _assignmentOpe rators ??= <idl.UnlinkedExprAssignOperator>[]; 3259 List<idl.UnlinkedExprAssignOperator> get assignmentOperators => _assignmentOpe rators ??= <idl.UnlinkedExprAssignOperator>[];
3260 3260
3261 /** 3261 /**
3262 * Sequence of operators used by assignment operations. 3262 * Sequence of operators used by assignment operations.
3263 */ 3263 */
(...skipping 21 matching lines...) Expand all
3285 * `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`, 3285 * `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`,
3286 * `makeList`, and `makeMap`. 3286 * `makeList`, and `makeMap`.
3287 */ 3287 */
3288 void set ints(List<int> _value) { 3288 void set ints(List<int> _value) {
3289 assert(!_finished); 3289 assert(!_finished);
3290 assert(_value == null || _value.every((e) => e >= 0)); 3290 assert(_value == null || _value.every((e) => e >= 0));
3291 _ints = _value; 3291 _ints = _value;
3292 } 3292 }
3293 3293
3294 @override 3294 @override
3295 bool get isInvalid => _isInvalid ??= false; 3295 bool get isValidConst => _isValidConst ??= false;
3296 3296
3297 /** 3297 /**
3298 * Indicates whether the expression is not a valid potentially constant 3298 * Indicates whether the expression is a valid potentially constant
3299 * expression. 3299 * expression.
3300 */ 3300 */
3301 void set isInvalid(bool _value) { 3301 void set isValidConst(bool _value) {
3302 assert(!_finished); 3302 assert(!_finished);
3303 _isInvalid = _value; 3303 _isValidConst = _value;
3304 } 3304 }
3305 3305
3306 @override 3306 @override
3307 List<idl.UnlinkedConstOperation> get operations => _operations ??= <idl.Unlink edConstOperation>[]; 3307 List<idl.UnlinkedConstOperation> get operations => _operations ??= <idl.Unlink edConstOperation>[];
3308 3308
3309 /** 3309 /**
3310 * Sequence of operations to execute (starting with an empty stack) to form 3310 * Sequence of operations to execute (starting with an empty stack) to form
3311 * the constant value. 3311 * the constant value.
3312 */ 3312 */
3313 void set operations(List<idl.UnlinkedConstOperation> _value) { 3313 void set operations(List<idl.UnlinkedConstOperation> _value) {
(...skipping 20 matching lines...) Expand all
3334 3334
3335 /** 3335 /**
3336 * Sequence of strings consumed by the operations `pushString` and 3336 * Sequence of strings consumed by the operations `pushString` and
3337 * `invokeConstructor`. 3337 * `invokeConstructor`.
3338 */ 3338 */
3339 void set strings(List<String> _value) { 3339 void set strings(List<String> _value) {
3340 assert(!_finished); 3340 assert(!_finished);
3341 _strings = _value; 3341 _strings = _value;
3342 } 3342 }
3343 3343
3344 UnlinkedConstBuilder({List<idl.UnlinkedExprAssignOperator> assignmentOperators , List<double> doubles, List<int> ints, bool isInvalid, List<idl.UnlinkedConstOp eration> operations, List<EntityRefBuilder> references, List<String> strings}) 3344 UnlinkedConstBuilder({List<idl.UnlinkedExprAssignOperator> assignmentOperators , List<double> doubles, List<int> ints, bool isValidConst, List<idl.UnlinkedCons tOperation> operations, List<EntityRefBuilder> references, List<String> strings} )
3345 : _assignmentOperators = assignmentOperators, 3345 : _assignmentOperators = assignmentOperators,
3346 _doubles = doubles, 3346 _doubles = doubles,
3347 _ints = ints, 3347 _ints = ints,
3348 _isInvalid = isInvalid, 3348 _isValidConst = isValidConst,
3349 _operations = operations, 3349 _operations = operations,
3350 _references = references, 3350 _references = references,
3351 _strings = strings; 3351 _strings = strings;
3352 3352
3353 /** 3353 /**
3354 * Flush [informative] data recursively. 3354 * Flush [informative] data recursively.
3355 */ 3355 */
3356 void flushInformative() { 3356 void flushInformative() {
3357 _references?.forEach((b) => b.flushInformative()); 3357 _references?.forEach((b) => b.flushInformative());
3358 } 3358 }
(...skipping 28 matching lines...) Expand all
3387 fbBuilder.startTable(); 3387 fbBuilder.startTable();
3388 if (offset_assignmentOperators != null) { 3388 if (offset_assignmentOperators != null) {
3389 fbBuilder.addOffset(6, offset_assignmentOperators); 3389 fbBuilder.addOffset(6, offset_assignmentOperators);
3390 } 3390 }
3391 if (offset_doubles != null) { 3391 if (offset_doubles != null) {
3392 fbBuilder.addOffset(4, offset_doubles); 3392 fbBuilder.addOffset(4, offset_doubles);
3393 } 3393 }
3394 if (offset_ints != null) { 3394 if (offset_ints != null) {
3395 fbBuilder.addOffset(1, offset_ints); 3395 fbBuilder.addOffset(1, offset_ints);
3396 } 3396 }
3397 if (_isInvalid == true) { 3397 if (_isValidConst == true) {
3398 fbBuilder.addBool(5, true); 3398 fbBuilder.addBool(5, true);
3399 } 3399 }
3400 if (offset_operations != null) { 3400 if (offset_operations != null) {
3401 fbBuilder.addOffset(0, offset_operations); 3401 fbBuilder.addOffset(0, offset_operations);
3402 } 3402 }
3403 if (offset_references != null) { 3403 if (offset_references != null) {
3404 fbBuilder.addOffset(2, offset_references); 3404 fbBuilder.addOffset(2, offset_references);
3405 } 3405 }
3406 if (offset_strings != null) { 3406 if (offset_strings != null) {
3407 fbBuilder.addOffset(3, offset_strings); 3407 fbBuilder.addOffset(3, offset_strings);
(...skipping 10 matching lines...) Expand all
3418 } 3418 }
3419 3419
3420 class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl. UnlinkedConst { 3420 class _UnlinkedConstImpl extends Object with _UnlinkedConstMixin implements idl. UnlinkedConst {
3421 final fb.BufferPointer _bp; 3421 final fb.BufferPointer _bp;
3422 3422
3423 _UnlinkedConstImpl(this._bp); 3423 _UnlinkedConstImpl(this._bp);
3424 3424
3425 List<idl.UnlinkedExprAssignOperator> _assignmentOperators; 3425 List<idl.UnlinkedExprAssignOperator> _assignmentOperators;
3426 List<double> _doubles; 3426 List<double> _doubles;
3427 List<int> _ints; 3427 List<int> _ints;
3428 bool _isInvalid; 3428 bool _isValidConst;
3429 List<idl.UnlinkedConstOperation> _operations; 3429 List<idl.UnlinkedConstOperation> _operations;
3430 List<idl.EntityRef> _references; 3430 List<idl.EntityRef> _references;
3431 List<String> _strings; 3431 List<String> _strings;
3432 3432
3433 @override 3433 @override
3434 List<idl.UnlinkedExprAssignOperator> get assignmentOperators { 3434 List<idl.UnlinkedExprAssignOperator> get assignmentOperators {
3435 _assignmentOperators ??= const fb.ListReader<idl.UnlinkedExprAssignOperator> (const _UnlinkedExprAssignOperatorReader()).vTableGet(_bp, 6, const <idl.Unlinke dExprAssignOperator>[]); 3435 _assignmentOperators ??= const fb.ListReader<idl.UnlinkedExprAssignOperator> (const _UnlinkedExprAssignOperatorReader()).vTableGet(_bp, 6, const <idl.Unlinke dExprAssignOperator>[]);
3436 return _assignmentOperators; 3436 return _assignmentOperators;
3437 } 3437 }
3438 3438
3439 @override 3439 @override
3440 List<double> get doubles { 3440 List<double> get doubles {
3441 _doubles ??= const fb.Float64ListReader().vTableGet(_bp, 4, const <double>[] ); 3441 _doubles ??= const fb.Float64ListReader().vTableGet(_bp, 4, const <double>[] );
3442 return _doubles; 3442 return _doubles;
3443 } 3443 }
3444 3444
3445 @override 3445 @override
3446 List<int> get ints { 3446 List<int> get ints {
3447 _ints ??= const fb.Uint32ListReader().vTableGet(_bp, 1, const <int>[]); 3447 _ints ??= const fb.Uint32ListReader().vTableGet(_bp, 1, const <int>[]);
3448 return _ints; 3448 return _ints;
3449 } 3449 }
3450 3450
3451 @override 3451 @override
3452 bool get isInvalid { 3452 bool get isValidConst {
3453 _isInvalid ??= const fb.BoolReader().vTableGet(_bp, 5, false); 3453 _isValidConst ??= const fb.BoolReader().vTableGet(_bp, 5, false);
3454 return _isInvalid; 3454 return _isValidConst;
3455 } 3455 }
3456 3456
3457 @override 3457 @override
3458 List<idl.UnlinkedConstOperation> get operations { 3458 List<idl.UnlinkedConstOperation> get operations {
3459 _operations ??= const fb.ListReader<idl.UnlinkedConstOperation>(const _Unlin kedConstOperationReader()).vTableGet(_bp, 0, const <idl.UnlinkedConstOperation>[ ]); 3459 _operations ??= const fb.ListReader<idl.UnlinkedConstOperation>(const _Unlin kedConstOperationReader()).vTableGet(_bp, 0, const <idl.UnlinkedConstOperation>[ ]);
3460 return _operations; 3460 return _operations;
3461 } 3461 }
3462 3462
3463 @override 3463 @override
3464 List<idl.EntityRef> get references { 3464 List<idl.EntityRef> get references {
3465 _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader()) .vTableGet(_bp, 2, const <idl.EntityRef>[]); 3465 _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader()) .vTableGet(_bp, 2, const <idl.EntityRef>[]);
3466 return _references; 3466 return _references;
3467 } 3467 }
3468 3468
3469 @override 3469 @override
3470 List<String> get strings { 3470 List<String> get strings {
3471 _strings ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet( _bp, 3, const <String>[]); 3471 _strings ??= const fb.ListReader<String>(const fb.StringReader()).vTableGet( _bp, 3, const <String>[]);
3472 return _strings; 3472 return _strings;
3473 } 3473 }
3474 } 3474 }
3475 3475
3476 abstract class _UnlinkedConstMixin implements idl.UnlinkedConst { 3476 abstract class _UnlinkedConstMixin implements idl.UnlinkedConst {
3477 @override 3477 @override
3478 Map<String, Object> toJson() { 3478 Map<String, Object> toJson() {
3479 Map<String, Object> _result = <String, Object>{}; 3479 Map<String, Object> _result = <String, Object>{};
3480 if (assignmentOperators.isNotEmpty) _result["assignmentOperators"] = assignm entOperators.map((_value) => _value.toString().split('.')[1]).toList(); 3480 if (assignmentOperators.isNotEmpty) _result["assignmentOperators"] = assignm entOperators.map((_value) => _value.toString().split('.')[1]).toList();
3481 if (doubles.isNotEmpty) _result["doubles"] = doubles.map((_value) => _value. isFinite ? _value : _value.toString()).toList(); 3481 if (doubles.isNotEmpty) _result["doubles"] = doubles.map((_value) => _value. isFinite ? _value : _value.toString()).toList();
3482 if (ints.isNotEmpty) _result["ints"] = ints; 3482 if (ints.isNotEmpty) _result["ints"] = ints;
3483 if (isInvalid != false) _result["isInvalid"] = isInvalid; 3483 if (isValidConst != false) _result["isValidConst"] = isValidConst;
3484 if (operations.isNotEmpty) _result["operations"] = operations.map((_value) = > _value.toString().split('.')[1]).toList(); 3484 if (operations.isNotEmpty) _result["operations"] = operations.map((_value) = > _value.toString().split('.')[1]).toList();
3485 if (references.isNotEmpty) _result["references"] = references.map((_value) = > _value.toJson()).toList(); 3485 if (references.isNotEmpty) _result["references"] = references.map((_value) = > _value.toJson()).toList();
3486 if (strings.isNotEmpty) _result["strings"] = strings; 3486 if (strings.isNotEmpty) _result["strings"] = strings;
3487 return _result; 3487 return _result;
3488 } 3488 }
3489 3489
3490 @override 3490 @override
3491 Map<String, Object> toMap() => { 3491 Map<String, Object> toMap() => {
3492 "assignmentOperators": assignmentOperators, 3492 "assignmentOperators": assignmentOperators,
3493 "doubles": doubles, 3493 "doubles": doubles,
3494 "ints": ints, 3494 "ints": ints,
3495 "isInvalid": isInvalid, 3495 "isValidConst": isValidConst,
3496 "operations": operations, 3496 "operations": operations,
3497 "references": references, 3497 "references": references,
3498 "strings": strings, 3498 "strings": strings,
3499 }; 3499 };
3500 3500
3501 @override 3501 @override
3502 String toString() => convert.JSON.encode(toJson()); 3502 String toString() => convert.JSON.encode(toJson());
3503 } 3503 }
3504 3504
3505 class UnlinkedConstructorInitializerBuilder extends Object with _UnlinkedConstru ctorInitializerMixin implements idl.UnlinkedConstructorInitializer { 3505 class UnlinkedConstructorInitializerBuilder extends Object with _UnlinkedConstru ctorInitializerMixin implements idl.UnlinkedConstructorInitializer {
(...skipping 4819 matching lines...) Expand 10 before | Expand all | Expand 10 after
8325 "propagatedTypeSlot": propagatedTypeSlot, 8325 "propagatedTypeSlot": propagatedTypeSlot,
8326 "type": type, 8326 "type": type,
8327 "visibleLength": visibleLength, 8327 "visibleLength": visibleLength,
8328 "visibleOffset": visibleOffset, 8328 "visibleOffset": visibleOffset,
8329 }; 8329 };
8330 8330
8331 @override 8331 @override
8332 String toString() => convert.JSON.encode(toJson()); 8332 String toString() => convert.JSON.encode(toJson());
8333 } 8333 }
8334 8334
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/format.fbs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698