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

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

Issue 294903015: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/element.dart » ('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) 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.constant; 8 library engine.constant;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 } 1715 }
1716 // We should never get here. 1716 // We should never get here.
1717 throw new IllegalStateException("times returned a ${result.runtimeType.toStr ing()}"); 1717 throw new IllegalStateException("times returned a ${result.runtimeType.toStr ing()}");
1718 } 1718 }
1719 1719
1720 @override 1720 @override
1721 String toString() => "${type.displayName} (${_state.toString()})"; 1721 String toString() => "${type.displayName} (${_state.toString()})";
1722 } 1722 }
1723 1723
1724 /** 1724 /**
1725 * Instances of the class `DeclaredVariables` provide access to the values of va riables that
1726 * have been defined on the command line using the `-D` option.
1727 */
1728 class DeclaredVariables {
1729 /**
1730 * A table mapping the names of declared variables to their values.
1731 */
1732 Map<String, String> _declaredVariables = new Map<String, String>();
1733
1734 /**
1735 * Define a variable with the given name to have the given value.
1736 *
1737 * @param variableName the name of the variable being defined
1738 * @param value the value of the variable
1739 */
1740 void define(String variableName, String value) {
1741 _declaredVariables[variableName] = value;
1742 }
1743
1744 /**
1745 * Return the value of the variable with the given name interpreted as a boole an value, or
1746 * `null` if the variable is not defined.
1747 *
1748 * @param typeProvider the type provider used to find the type 'bool'
1749 * @param variableName the name of the variable whose value is to be returned
1750 */
1751 DartObject getBool(TypeProvider typeProvider, String variableName) {
1752 String value = _declaredVariables[variableName];
1753 if (value == null) {
1754 return null;
1755 }
1756 if (value == "true") {
1757 return new DartObjectImpl(typeProvider.boolType, BoolState.from(true));
1758 } else if (value == "false") {
1759 return new DartObjectImpl(typeProvider.boolType, BoolState.from(false));
1760 }
1761 return null;
1762 }
1763
1764 /**
1765 * Return the value of the variable with the given name interpreted as an inte ger value, or
1766 * `null` if the variable is not defined.
1767 *
1768 * @param typeProvider the type provider used to find the type 'int'
1769 * @param variableName the name of the variable whose value is to be returned
1770 * @throws NumberFormatException if the value of the variable is not a valid i nteger value
1771 */
1772 DartObject getInt(TypeProvider typeProvider, String variableName) {
1773 String value = _declaredVariables[variableName];
1774 if (value == null) {
1775 return null;
1776 }
1777 return new DartObjectImpl(typeProvider.intType, new IntState(int.parse(value )));
1778 }
1779
1780 /**
1781 * Return the value of the variable with the given name interpreted as a Strin g value, or
1782 * `null` if the variable is not defined.
1783 *
1784 * @param typeProvider the type provider used to find the type 'String'
1785 * @param variableName the name of the variable whose value is to be returned
1786 */
1787 DartObject getString(TypeProvider typeProvider, String variableName) {
1788 String value = _declaredVariables[variableName];
1789 if (value == null) {
1790 return null;
1791 }
1792 return new DartObjectImpl(typeProvider.stringType, new StringState(value));
1793 }
1794 }
1795
1796 /**
1725 * Instances of the class `DoubleState` represent the state of an object represe nting a 1797 * Instances of the class `DoubleState` represent the state of an object represe nting a
1726 * double. 1798 * double.
1727 */ 1799 */
1728 class DoubleState extends NumState { 1800 class DoubleState extends NumState {
1729 /** 1801 /**
1730 * The value of this instance. 1802 * The value of this instance.
1731 */ 1803 */
1732 final double value; 1804 final double value;
1733 1805
1734 /** 1806 /**
(...skipping 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after
4733 ErrorResult _error(AstNode node, ErrorCode code) => new ErrorResult.con1(node, code); 4805 ErrorResult _error(AstNode node, ErrorCode code) => new ErrorResult.con1(node, code);
4734 4806
4735 /** 4807 /**
4736 * Return a result object representing the given value. 4808 * Return a result object representing the given value.
4737 * 4809 *
4738 * @param value the value to be represented as a result object 4810 * @param value the value to be represented as a result object
4739 * @return a result object representing the given value 4811 * @return a result object representing the given value
4740 */ 4812 */
4741 ValidResult _valueOf(DartObjectImpl value) => new ValidResult(value); 4813 ValidResult _valueOf(DartObjectImpl value) => new ValidResult(value);
4742 } 4814 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698