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

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

Issue 23852002: java2dart improvements and new analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.constant; 3 library engine.constant;
4 import 'java_core.dart'; 4 import 'java_core.dart';
5 import 'source.dart' show Source; 5 import 'source.dart' show Source;
6 import 'error.dart' show AnalysisError, ErrorCode, CompileTimeErrorCode; 6 import 'error.dart' show AnalysisError, ErrorCode, CompileTimeErrorCode;
7 import 'scanner.dart' show TokenType; 7 import 'scanner.dart' show TokenType;
8 import 'ast.dart'; 8 import 'ast.dart';
9 import 'element.dart'; 9 import 'element.dart';
10 import 'engine.dart' show AnalysisEngine; 10 import 'engine.dart' show AnalysisEngine;
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 * 528 *
529 * @param leftResult the first set of errors, or `null` if there was no previo us collection 529 * @param leftResult the first set of errors, or `null` if there was no previo us collection
530 * of errors 530 * of errors
531 * @param rightResult the errors to be added to the collection, or a valid res ult if there are no 531 * @param rightResult the errors to be added to the collection, or a valid res ult if there are no
532 * errors to be added 532 * errors to be added
533 * @return the union of the errors encoded in the given results 533 * @return the union of the errors encoded in the given results
534 */ 534 */
535 ErrorResult union(ErrorResult leftResult, EvaluationResultImpl rightResult) { 535 ErrorResult union(ErrorResult leftResult, EvaluationResultImpl rightResult) {
536 if (rightResult is ErrorResult) { 536 if (rightResult is ErrorResult) {
537 if (leftResult != null) { 537 if (leftResult != null) {
538 return new ErrorResult.con2(leftResult, (rightResult as ErrorResult)); 538 return new ErrorResult.con2(leftResult, rightResult as ErrorResult);
539 } else { 539 } else {
540 return rightResult as ErrorResult; 540 return rightResult as ErrorResult;
541 } 541 }
542 } 542 }
543 return leftResult; 543 return leftResult;
544 } 544 }
545 } 545 }
546 /** 546 /**
547 * Instances of the class `DirectedGraph` implement a directed graph in which th e nodes are 547 * Instances of the class `DirectedGraph` implement a directed graph in which th e nodes are
548 * arbitrary (client provided) objects and edges are represented implicitly. The graph will allow an 548 * arbitrary (client provided) objects and edges are represented implicitly. The graph will allow an
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 if (node is BinaryExpression) { 1250 if (node is BinaryExpression) {
1251 if (!isAnyNullBoolNumString || !leftOperand.isAnyNullBoolNumString) { 1251 if (!isAnyNullBoolNumString || !leftOperand.isAnyNullBoolNumString) {
1252 return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING ); 1252 return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING );
1253 } 1253 }
1254 } 1254 }
1255 Object leftValue = leftOperand.value; 1255 Object leftValue = leftOperand.value;
1256 if (leftValue == null) { 1256 if (leftValue == null) {
1257 return valueOf2(_value == null); 1257 return valueOf2(_value == null);
1258 } else if (leftValue is bool) { 1258 } else if (leftValue is bool) {
1259 if (_value is bool) { 1259 if (_value is bool) {
1260 return valueOf2(identical(((leftValue as bool)), ((_value as bool)))); 1260 return valueOf2(identical(leftValue as bool, _value as bool));
1261 } 1261 }
1262 return RESULT_FALSE; 1262 return RESULT_FALSE;
1263 } else if (leftValue is int) { 1263 } else if (leftValue is int) {
1264 if (_value is int) { 1264 if (_value is int) {
1265 return valueOf2(((leftValue as int)) == _value); 1265 return valueOf2(((leftValue as int)) == _value);
1266 } else if (_value is double) { 1266 } else if (_value is double) {
1267 return valueOf2(toDouble((leftValue as int)) == _value); 1267 return valueOf2(toDouble(leftValue as int) == _value);
1268 } 1268 }
1269 return RESULT_FALSE; 1269 return RESULT_FALSE;
1270 } else if (leftValue is double) { 1270 } else if (leftValue is double) {
1271 if (_value is int) { 1271 if (_value is int) {
1272 return valueOf2(((leftValue as double)) == toDouble((_value as int))); 1272 return valueOf2(((leftValue as double)) == toDouble(_value as int));
1273 } else if (_value is double) { 1273 } else if (_value is double) {
1274 return valueOf2(((leftValue as double)) == _value); 1274 return valueOf2(((leftValue as double)) == _value);
1275 } 1275 }
1276 return RESULT_FALSE; 1276 return RESULT_FALSE;
1277 } else if (leftValue is String) { 1277 } else if (leftValue is String) {
1278 if (_value is String) { 1278 if (_value is String) {
1279 return valueOf2(((leftValue as String)) == _value); 1279 return valueOf2(((leftValue as String)) == _value);
1280 } 1280 }
1281 return RESULT_FALSE; 1281 return RESULT_FALSE;
1282 } 1282 }
1283 return RESULT_FALSE; 1283 return RESULT_FALSE;
1284 } 1284 }
1285 EvaluationResultImpl greaterThanError(BinaryExpression node, ErrorResult leftO perand) => leftOperand; 1285 EvaluationResultImpl greaterThanError(BinaryExpression node, ErrorResult leftO perand) => leftOperand;
1286 EvaluationResultImpl greaterThanOrEqualError(BinaryExpression node, ErrorResul t leftOperand) => leftOperand; 1286 EvaluationResultImpl greaterThanOrEqualError(BinaryExpression node, ErrorResul t leftOperand) => leftOperand;
1287 EvaluationResultImpl greaterThanOrEqualValid(BinaryExpression node, ValidResul t leftOperand2) { 1287 EvaluationResultImpl greaterThanOrEqualValid(BinaryExpression node, ValidResul t leftOperand2) {
1288 if (!isAnyNum || !leftOperand2.isAnyNum) { 1288 if (!isAnyNum || !leftOperand2.isAnyNum) {
1289 return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM); 1289 return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
1290 } 1290 }
1291 if (isSomeNum || leftOperand2.isSomeNum) { 1291 if (isSomeNum || leftOperand2.isSomeNum) {
1292 return RESULT_BOOL; 1292 return RESULT_BOOL;
1293 } 1293 }
1294 Object leftValue = leftOperand2.value; 1294 Object leftValue = leftOperand2.value;
1295 if (leftValue == null) { 1295 if (leftValue == null) {
1296 return error(node.leftOperand); 1296 return error(node.leftOperand);
1297 } else if (_value == null) { 1297 } else if (_value == null) {
1298 return error(node.rightOperand); 1298 return error(node.rightOperand);
1299 } else if (leftValue is int) { 1299 } else if (leftValue is int) {
1300 if (_value is int) { 1300 if (_value is int) {
1301 return valueOf2(((leftValue as int)).compareTo((_value as int)) >= 0); 1301 return valueOf2(((leftValue as int)).compareTo(_value as int) >= 0);
1302 } else if (_value is double) { 1302 } else if (_value is double) {
1303 return valueOf2(((leftValue as int)).toDouble() >= ((_value as double))) ; 1303 return valueOf2(((leftValue as int)).toDouble() >= ((_value as double))) ;
1304 } 1304 }
1305 } else if (leftValue is double) { 1305 } else if (leftValue is double) {
1306 if (_value is int) { 1306 if (_value is int) {
1307 return valueOf2(((leftValue as double)) >= ((_value as int)).toDouble()) ; 1307 return valueOf2(((leftValue as double)) >= ((_value as int)).toDouble()) ;
1308 } else if (_value is double) { 1308 } else if (_value is double) {
1309 return valueOf2(((leftValue as double)) >= ((_value as double))); 1309 return valueOf2(((leftValue as double)) >= ((_value as double)));
1310 } 1310 }
1311 } 1311 }
1312 return error(node); 1312 return error(node);
1313 } 1313 }
1314 EvaluationResultImpl greaterThanValid(BinaryExpression node, ValidResult leftO perand2) { 1314 EvaluationResultImpl greaterThanValid(BinaryExpression node, ValidResult leftO perand2) {
1315 if (!isAnyNum || !leftOperand2.isAnyNum) { 1315 if (!isAnyNum || !leftOperand2.isAnyNum) {
1316 return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM); 1316 return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
1317 } 1317 }
1318 if (isSomeNum || leftOperand2.isSomeNum) { 1318 if (isSomeNum || leftOperand2.isSomeNum) {
1319 return RESULT_BOOL; 1319 return RESULT_BOOL;
1320 } 1320 }
1321 Object leftValue = leftOperand2.value; 1321 Object leftValue = leftOperand2.value;
1322 if (leftValue == null) { 1322 if (leftValue == null) {
1323 return error(node.leftOperand); 1323 return error(node.leftOperand);
1324 } else if (_value == null) { 1324 } else if (_value == null) {
1325 return error(node.rightOperand); 1325 return error(node.rightOperand);
1326 } else if (leftValue is int) { 1326 } else if (leftValue is int) {
1327 if (_value is int) { 1327 if (_value is int) {
1328 return valueOf2(((leftValue as int)).compareTo((_value as int)) > 0); 1328 return valueOf2(((leftValue as int)).compareTo(_value as int) > 0);
1329 } else if (_value is double) { 1329 } else if (_value is double) {
1330 return valueOf2(((leftValue as int)).toDouble() > ((_value as double))); 1330 return valueOf2(((leftValue as int)).toDouble() > ((_value as double)));
1331 } 1331 }
1332 } else if (leftValue is double) { 1332 } else if (leftValue is double) {
1333 if (_value is int) { 1333 if (_value is int) {
1334 return valueOf2(((leftValue as double)) > ((_value as int)).toDouble()); 1334 return valueOf2(((leftValue as double)) > ((_value as int)).toDouble());
1335 } else if (_value is double) { 1335 } else if (_value is double) {
1336 return valueOf2(((leftValue as double)) > ((_value as double))); 1336 return valueOf2(((leftValue as double)) > ((_value as double)));
1337 } 1337 }
1338 } 1338 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 if (isSomeNum || leftOperand2.isSomeNum) { 1381 if (isSomeNum || leftOperand2.isSomeNum) {
1382 return RESULT_BOOL; 1382 return RESULT_BOOL;
1383 } 1383 }
1384 Object leftValue = leftOperand2.value; 1384 Object leftValue = leftOperand2.value;
1385 if (leftValue == null) { 1385 if (leftValue == null) {
1386 return error(node.leftOperand); 1386 return error(node.leftOperand);
1387 } else if (_value == null) { 1387 } else if (_value == null) {
1388 return error(node.rightOperand); 1388 return error(node.rightOperand);
1389 } else if (leftValue is int) { 1389 } else if (leftValue is int) {
1390 if (_value is int) { 1390 if (_value is int) {
1391 return valueOf2(((leftValue as int)).compareTo((_value as int)) <= 0); 1391 return valueOf2(((leftValue as int)).compareTo(_value as int) <= 0);
1392 } else if (_value is double) { 1392 } else if (_value is double) {
1393 return valueOf2(((leftValue as int)).toDouble() <= ((_value as double))) ; 1393 return valueOf2(((leftValue as int)).toDouble() <= ((_value as double))) ;
1394 } 1394 }
1395 } else if (leftValue is double) { 1395 } else if (leftValue is double) {
1396 if (_value is int) { 1396 if (_value is int) {
1397 return valueOf2(((leftValue as double)) <= ((_value as int)).toDouble()) ; 1397 return valueOf2(((leftValue as double)) <= ((_value as int)).toDouble()) ;
1398 } else if (_value is double) { 1398 } else if (_value is double) {
1399 return valueOf2(((leftValue as double)) <= ((_value as double))); 1399 return valueOf2(((leftValue as double)) <= ((_value as double)));
1400 } 1400 }
1401 } 1401 }
1402 return error(node); 1402 return error(node);
1403 } 1403 }
1404 EvaluationResultImpl lessThanValid(BinaryExpression node, ValidResult leftOper and2) { 1404 EvaluationResultImpl lessThanValid(BinaryExpression node, ValidResult leftOper and2) {
1405 if (!isAnyNum || !leftOperand2.isAnyNum) { 1405 if (!isAnyNum || !leftOperand2.isAnyNum) {
1406 return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM); 1406 return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
1407 } 1407 }
1408 if (isSomeNum || leftOperand2.isSomeNum) { 1408 if (isSomeNum || leftOperand2.isSomeNum) {
1409 return RESULT_BOOL; 1409 return RESULT_BOOL;
1410 } 1410 }
1411 Object leftValue = leftOperand2.value; 1411 Object leftValue = leftOperand2.value;
1412 if (leftValue == null) { 1412 if (leftValue == null) {
1413 return error(node.leftOperand); 1413 return error(node.leftOperand);
1414 } else if (_value == null) { 1414 } else if (_value == null) {
1415 return error(node.rightOperand); 1415 return error(node.rightOperand);
1416 } else if (leftValue is int) { 1416 } else if (leftValue is int) {
1417 if (_value is int) { 1417 if (_value is int) {
1418 return valueOf2(((leftValue as int)).compareTo((_value as int)) < 0); 1418 return valueOf2(((leftValue as int)).compareTo(_value as int) < 0);
1419 } else if (_value is double) { 1419 } else if (_value is double) {
1420 return valueOf2(((leftValue as int)).toDouble() < ((_value as double))); 1420 return valueOf2(((leftValue as int)).toDouble() < ((_value as double)));
1421 } 1421 }
1422 } else if (leftValue is double) { 1422 } else if (leftValue is double) {
1423 if (_value is int) { 1423 if (_value is int) {
1424 return valueOf2(((leftValue as double)) < ((_value as int)).toDouble()); 1424 return valueOf2(((leftValue as double)) < ((_value as int)).toDouble());
1425 } else if (_value is double) { 1425 } else if (_value is double) {
1426 return valueOf2(((leftValue as double)) < ((_value as double))); 1426 return valueOf2(((leftValue as double)) < ((_value as double)));
1427 } 1427 }
1428 } 1428 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 return valueOf2(_value != null); 1499 return valueOf2(_value != null);
1500 } else if (leftValue is bool) { 1500 } else if (leftValue is bool) {
1501 if (_value is bool) { 1501 if (_value is bool) {
1502 return valueOf2(((leftValue as bool)) != ((_value as bool))); 1502 return valueOf2(((leftValue as bool)) != ((_value as bool)));
1503 } 1503 }
1504 return RESULT_TRUE; 1504 return RESULT_TRUE;
1505 } else if (leftValue is int) { 1505 } else if (leftValue is int) {
1506 if (_value is int) { 1506 if (_value is int) {
1507 return valueOf2(((leftValue as int)) != _value); 1507 return valueOf2(((leftValue as int)) != _value);
1508 } else if (_value is double) { 1508 } else if (_value is double) {
1509 return valueOf2(toDouble((leftValue as int)) != _value); 1509 return valueOf2(toDouble(leftValue as int) != _value);
1510 } 1510 }
1511 return RESULT_TRUE; 1511 return RESULT_TRUE;
1512 } else if (leftValue is double) { 1512 } else if (leftValue is double) {
1513 if (_value is int) { 1513 if (_value is int) {
1514 return valueOf2(((leftValue as double)) != toDouble((_value as int))); 1514 return valueOf2(((leftValue as double)) != toDouble(_value as int));
1515 } else if (_value is double) { 1515 } else if (_value is double) {
1516 return valueOf2(((leftValue as double)) != _value); 1516 return valueOf2(((leftValue as double)) != _value);
1517 } 1517 }
1518 return RESULT_TRUE; 1518 return RESULT_TRUE;
1519 } else if (leftValue is String) { 1519 } else if (leftValue is String) {
1520 if (_value is String) { 1520 if (_value is String) {
1521 return valueOf2(((leftValue as String)) != _value); 1521 return valueOf2(((leftValue as String)) != _value);
1522 } 1522 }
1523 return RESULT_TRUE; 1523 return RESULT_TRUE;
1524 } 1524 }
(...skipping 12 matching lines...) Expand all
1537 Object leftValue = leftOperand2.value; 1537 Object leftValue = leftOperand2.value;
1538 if (leftValue == null) { 1538 if (leftValue == null) {
1539 return error(node.leftOperand); 1539 return error(node.leftOperand);
1540 } else if (_value == null) { 1540 } else if (_value == null) {
1541 return error(node.rightOperand); 1541 return error(node.rightOperand);
1542 } else if (leftValue is int) { 1542 } else if (leftValue is int) {
1543 if (_value is int) { 1543 if (_value is int) {
1544 if (((_value as int)) == 0) { 1544 if (((_value as int)) == 0) {
1545 return valueOf3(((leftValue as int)).toDouble() % ((_value as int)).to Double()); 1545 return valueOf3(((leftValue as int)).toDouble() % ((_value as int)).to Double());
1546 } 1546 }
1547 return valueOf(((leftValue as int)).remainder((_value as int))); 1547 return valueOf(((leftValue as int)).remainder(_value as int));
1548 } else if (_value is double) { 1548 } else if (_value is double) {
1549 return valueOf3(((leftValue as int)).toDouble() % ((_value as double))); 1549 return valueOf3(((leftValue as int)).toDouble() % ((_value as double)));
1550 } 1550 }
1551 } else if (leftValue is double) { 1551 } else if (leftValue is double) {
1552 if (_value is int) { 1552 if (_value is int) {
1553 return valueOf3(((leftValue as double)) % ((_value as int)).toDouble()); 1553 return valueOf3(((leftValue as double)) % ((_value as int)).toDouble());
1554 } else if (_value is double) { 1554 } else if (_value is double) {
1555 return valueOf3(((leftValue as double)) % ((_value as double))); 1555 return valueOf3(((leftValue as double)) % ((_value as double)));
1556 } 1556 }
1557 } 1557 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 ValidResult valueOf3(double value) => new ValidResult(value); 1735 ValidResult valueOf3(double value) => new ValidResult(value);
1736 1736
1737 /** 1737 /**
1738 * Return a result object representing the given value. 1738 * Return a result object representing the given value.
1739 * 1739 *
1740 * @param value the value to be represented as a result object 1740 * @param value the value to be represented as a result object
1741 * @return a result object representing the given value 1741 * @return a result object representing the given value
1742 */ 1742 */
1743 ValidResult valueOf4(String value) => new ValidResult(value); 1743 ValidResult valueOf4(String value) => new ValidResult(value);
1744 } 1744 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/ast.dart ('k') | pkg/analyzer_experimental/lib/src/generated/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698