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

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

Issue 1674073002: Add UnlinkedConst.isValid and set it during summarizing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Generate the 'isInvalid' property. Created 4 years, 10 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
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 /** 5 /**
6 * This file is an "idl" style description of the summary format. It 6 * This file is an "idl" style description of the summary format. It
7 * contains abstract classes which declare the interface for reading data from 7 * contains abstract classes which declare the interface for reading data from
8 * summaries. It is parsed and transformed into code that implements the 8 * summaries. It is parsed and transformed into code that implements the
9 * summary format. 9 * summary format.
10 * 10 *
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 * potentially constant expression. 514 * potentially constant expression.
515 * 515 *
516 * Constant expressions are represented using a simple stack-based language 516 * Constant expressions are represented using a simple stack-based language
517 * where [operations] is a sequence of operations to execute starting with an 517 * where [operations] is a sequence of operations to execute starting with an
518 * empty stack. Once all operations have been executed, the stack should 518 * empty stack. Once all operations have been executed, the stack should
519 * contain a single value which is the value of the constant. Note that some 519 * contain a single value which is the value of the constant. Note that some
520 * operations consume additional data from the other fields of this class. 520 * operations consume additional data from the other fields of this class.
521 */ 521 */
522 abstract class UnlinkedConst extends base.SummaryClass { 522 abstract class UnlinkedConst extends base.SummaryClass {
523 /** 523 /**
524 * Indicates whether the expression is not a valid potentially constant
525 * expression.
526 */
527 bool get isInvalid;
528
529 /**
524 * Sequence of operations to execute (starting with an empty stack) to form 530 * Sequence of operations to execute (starting with an empty stack) to form
525 * the constant value. 531 * the constant value.
526 */ 532 */
527 List<UnlinkedConstOperation> get operations; 533 List<UnlinkedConstOperation> get operations;
528 534
529 /** 535 /**
530 * Sequence of unsigned 32-bit integers consumed by the operations 536 * Sequence of unsigned 32-bit integers consumed by the operations
531 * `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`, 537 * `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`,
532 * `makeList`, and `makeMap`. 538 * `makeList`, and `makeMap`.
533 */ 539 */
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 * this variable, so its static type is `dynamic`. 1276 * this variable, so its static type is `dynamic`.
1271 * 1277 *
1272 * Note that although strong mode considers initializing formals to be 1278 * Note that although strong mode considers initializing formals to be
1273 * inferable, they are not marked as such in the summary; if their type is 1279 * inferable, they are not marked as such in the summary; if their type is
1274 * not specified, they always inherit the static type of the corresponding 1280 * not specified, they always inherit the static type of the corresponding
1275 * field. 1281 * field.
1276 */ 1282 */
1277 int get inferredTypeSlot; 1283 int get inferredTypeSlot;
1278 1284
1279 /** 1285 /**
1280 * If the parameter has a default value the constant expression in the 1286 * If the parameter has a default value, the constant expression in the
1281 * default value. 1287 * default value. Note that the presence of this expression does not mean
1288 * that it is a valid , check [UnlinkedConst.isValid].
Paul Berry 2016/02/08 17:07:41 Missing a word here. I think you mean: "...that i
1282 */ 1289 */
1283 UnlinkedConst get defaultValue; 1290 UnlinkedConst get defaultValue;
1284 } 1291 }
1285 1292
1286 /** 1293 /**
1287 * Enum used to indicate the kind of a parameter. 1294 * Enum used to indicate the kind of a parameter.
1288 */ 1295 */
1289 enum UnlinkedParamKind { 1296 enum UnlinkedParamKind {
1290 /** 1297 /**
1291 * Parameter is required. 1298 * Parameter is required.
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 */ 1612 */
1606 List<UnlinkedConst> get annotations; 1613 List<UnlinkedConst> get annotations;
1607 1614
1608 /** 1615 /**
1609 * Declared type of the variable. Absent if the type is implicit. 1616 * Declared type of the variable. Absent if the type is implicit.
1610 */ 1617 */
1611 EntityRef get type; 1618 EntityRef get type;
1612 1619
1613 /** 1620 /**
1614 * If [isConst] is true, and the variable has an initializer, the constant 1621 * If [isConst] is true, and the variable has an initializer, the constant
1615 * expression in the initializer. 1622 * expression in the initializer. Note that the presence of this expression
1623 * does not mean that it is a valid, check [UnlinkedConst.isValid].
Paul Berry 2016/02/08 17:07:41 Similar comment here.
1616 */ 1624 */
1617 UnlinkedConst get constExpr; 1625 UnlinkedConst get constExpr;
1618 1626
1619 /** 1627 /**
1620 * Indicates whether the variable is declared using the `static` keyword. 1628 * Indicates whether the variable is declared using the `static` keyword.
1621 * 1629 *
1622 * Note that for top level variables, this flag is false, since they are not 1630 * Note that for top level variables, this flag is false, since they are not
1623 * declared using the `static` keyword (even though they are considered 1631 * declared using the `static` keyword (even though they are considered
1624 * static for semantic purposes). 1632 * static for semantic purposes).
1625 */ 1633 */
(...skipping 20 matching lines...) Expand all
1646 int get propagatedTypeSlot; 1654 int get propagatedTypeSlot;
1647 1655
1648 /** 1656 /**
1649 * If this variable is inferable, nonzero slot id identifying which entry in 1657 * If this variable is inferable, nonzero slot id identifying which entry in
1650 * [LinkedLibrary.types] contains the inferred type for this variable. If 1658 * [LinkedLibrary.types] contains the inferred type for this variable. If
1651 * there is no matching entry in [LinkedLibrary.types], then no type was 1659 * there is no matching entry in [LinkedLibrary.types], then no type was
1652 * inferred for this variable, so its static type is `dynamic`. 1660 * inferred for this variable, so its static type is `dynamic`.
1653 */ 1661 */
1654 int get inferredTypeSlot; 1662 int get inferredTypeSlot;
1655 } 1663 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/format.dart ('k') | pkg/analyzer/lib/src/summary/summarize_const_expr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698