| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library fasta.body_builder; | 5 library fasta.body_builder; |
| 6 | 6 |
| 7 import '../parser/parser.dart' show FormalParameterType, optional; | 7 import '../parser/parser.dart' show FormalParameterType, optional; |
| 8 | 8 |
| 9 import '../parser/error_kind.dart' show ErrorKind; | 9 import '../parser/error_kind.dart' show ErrorKind; |
| 10 | 10 |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 bool negate = false; | 577 bool negate = false; |
| 578 String operator = token.stringValue; | 578 String operator = token.stringValue; |
| 579 if (identical("!=", operator)) { | 579 if (identical("!=", operator)) { |
| 580 operator = "=="; | 580 operator = "=="; |
| 581 negate = true; | 581 negate = true; |
| 582 } | 582 } |
| 583 if (!isBinaryOperator(operator) && !isMinusOperator(operator)) { | 583 if (!isBinaryOperator(operator) && !isMinusOperator(operator)) { |
| 584 return buildCompileTimeError( | 584 return buildCompileTimeError( |
| 585 "Not an operator: '$operator'.", token.charOffset); | 585 "Not an operator: '$operator'.", token.charOffset); |
| 586 } else { | 586 } else { |
| 587 Expression result = makeBinary(a, new Name(operator), null, b); | 587 Expression result = |
| 588 makeBinary(a, new Name(operator), null, b, token.charOffset); |
| 588 if (isSuper) { | 589 if (isSuper) { |
| 589 result = toSuperMethodInvocation(result); | 590 result = toSuperMethodInvocation(result); |
| 590 } | 591 } |
| 591 return negate ? new Not(result) : result; | 592 return negate ? new Not(result) : result; |
| 592 } | 593 } |
| 593 } | 594 } |
| 594 | 595 |
| 595 void doLogicalExpression(Token token) { | 596 void doLogicalExpression(Token token) { |
| 596 Expression argument = popForValue(); | 597 Expression argument = popForValue(); |
| 597 Expression receiver = popForValue(); | 598 Expression receiver = popForValue(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 push(token); | 778 push(token); |
| 778 } | 779 } |
| 779 | 780 |
| 780 @override | 781 @override |
| 781 void handleStringPart(Token token) { | 782 void handleStringPart(Token token) { |
| 782 debugEvent("StringPart"); | 783 debugEvent("StringPart"); |
| 783 push(token); | 784 push(token); |
| 784 } | 785 } |
| 785 | 786 |
| 786 @override | 787 @override |
| 787 void endLiteralString(int interpolationCount) { | 788 void endLiteralString(int interpolationCount, Token endToken) { |
| 788 debugEvent("endLiteralString"); | 789 debugEvent("endLiteralString"); |
| 789 if (interpolationCount == 0) { | 790 if (interpolationCount == 0) { |
| 790 Token token = pop(); | 791 Token token = pop(); |
| 791 push(new StringLiteral(unescapeString(token.value))); | 792 push(new StringLiteral(unescapeString(token.value))); |
| 792 } else { | 793 } else { |
| 793 List parts = popList(1 + interpolationCount * 2); | 794 List parts = popList(1 + interpolationCount * 2); |
| 794 Token first = parts.first; | 795 Token first = parts.first; |
| 795 Token last = parts.last; | 796 Token last = parts.last; |
| 796 Quote quote = analyzeQuote(first.value); | 797 Quote quote = analyzeQuote(first.value); |
| 797 List<Expression> expressions = <Expression>[]; | 798 List<Expression> expressions = <Expression>[]; |
| 798 expressions | 799 expressions |
| 799 .add(new StringLiteral(unescapeFirstStringPart(first.value, quote))); | 800 .add(new StringLiteral(unescapeFirstStringPart(first.value, quote))); |
| 800 for (int i = 1; i < parts.length - 1; i++) { | 801 for (int i = 1; i < parts.length - 1; i++) { |
| 801 var part = parts[i]; | 802 var part = parts[i]; |
| 802 if (part is Token) { | 803 if (part is Token) { |
| 803 expressions.add(new StringLiteral(unescape(part.value, quote))); | 804 expressions.add(new StringLiteral(unescape(part.value, quote))); |
| 804 } else { | 805 } else { |
| 805 expressions.add(toValue(part)); | 806 expressions.add(toValue(part)); |
| 806 } | 807 } |
| 807 } | 808 } |
| 808 expressions | 809 expressions |
| 809 .add(new StringLiteral(unescapeLastStringPart(last.value, quote))); | 810 .add(new StringLiteral(unescapeLastStringPart(last.value, quote))); |
| 810 push(new StringConcatenation(expressions)); | 811 push(new StringConcatenation(expressions) |
| 812 ..fileOffset = endToken.charOffset); |
| 811 } | 813 } |
| 812 } | 814 } |
| 813 | 815 |
| 814 @override | 816 @override |
| 815 void handleScript(Token token) { | 817 void handleScript(Token token) { |
| 816 debugEvent("Script"); | 818 debugEvent("Script"); |
| 817 } | 819 } |
| 818 | 820 |
| 819 @override | 821 @override |
| 820 void handleStringJuxtaposition(int literalCount) { | 822 void handleStringJuxtaposition(int literalCount) { |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 DartType typeArgument = const DynamicType(); | 1060 DartType typeArgument = const DynamicType(); |
| 1059 if (typeArguments != null) { | 1061 if (typeArguments != null) { |
| 1060 typeArgument = typeArguments.first; | 1062 typeArgument = typeArguments.first; |
| 1061 if (typeArguments.length > 1) { | 1063 if (typeArguments.length > 1) { |
| 1062 typeArgument = const DynamicType(); | 1064 typeArgument = const DynamicType(); |
| 1063 warning( | 1065 warning( |
| 1064 "Too many type arguments on List literal.", beginToken.charOffset); | 1066 "Too many type arguments on List literal.", beginToken.charOffset); |
| 1065 } | 1067 } |
| 1066 } | 1068 } |
| 1067 push(new ListLiteral(expressions, | 1069 push(new ListLiteral(expressions, |
| 1068 typeArgument: typeArgument, isConst: constKeyword != null)); | 1070 typeArgument: typeArgument, isConst: constKeyword != null) |
| 1071 ..fileOffset = constKeyword?.charOffset ?? beginToken.charOffset); |
| 1069 } | 1072 } |
| 1070 | 1073 |
| 1071 @override | 1074 @override |
| 1072 void handleLiteralBool(Token token) { | 1075 void handleLiteralBool(Token token) { |
| 1073 debugEvent("LiteralBool"); | 1076 debugEvent("LiteralBool"); |
| 1074 bool value = optional("true", token); | 1077 bool value = optional("true", token); |
| 1075 assert(value || optional("false", token)); | 1078 assert(value || optional("false", token)); |
| 1076 push(new BoolLiteral(value)); | 1079 push(new BoolLiteral(value)); |
| 1077 } | 1080 } |
| 1078 | 1081 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1101 keyType = const DynamicType(); | 1104 keyType = const DynamicType(); |
| 1102 valueType = const DynamicType(); | 1105 valueType = const DynamicType(); |
| 1103 warning( | 1106 warning( |
| 1104 "Map literal requires two type arguments.", beginToken.charOffset); | 1107 "Map literal requires two type arguments.", beginToken.charOffset); |
| 1105 } else { | 1108 } else { |
| 1106 keyType = typeArguments[0]; | 1109 keyType = typeArguments[0]; |
| 1107 valueType = typeArguments[1]; | 1110 valueType = typeArguments[1]; |
| 1108 } | 1111 } |
| 1109 } | 1112 } |
| 1110 push(new MapLiteral(entries, | 1113 push(new MapLiteral(entries, |
| 1111 keyType: keyType, valueType: valueType, isConst: constKeyword != null)); | 1114 keyType: keyType, valueType: valueType, isConst: constKeyword != null) |
| 1115 ..fileOffset = constKeyword?.charOffset ?? beginToken.charOffset); |
| 1112 } | 1116 } |
| 1113 | 1117 |
| 1114 @override | 1118 @override |
| 1115 void endLiteralMapEntry(Token colon, Token endToken) { | 1119 void endLiteralMapEntry(Token colon, Token endToken) { |
| 1116 debugEvent("LiteralMapEntry"); | 1120 debugEvent("LiteralMapEntry"); |
| 1117 Expression value = popForValue(); | 1121 Expression value = popForValue(); |
| 1118 Expression key = popForValue(); | 1122 Expression key = popForValue(); |
| 1119 push(new MapEntry(key, value)); | 1123 push(new MapEntry(key, value)); |
| 1120 } | 1124 } |
| 1121 | 1125 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 Expression thenExpression = popForValue(); | 1266 Expression thenExpression = popForValue(); |
| 1263 Expression condition = popForValue(); | 1267 Expression condition = popForValue(); |
| 1264 push(new ConditionalExpression( | 1268 push(new ConditionalExpression( |
| 1265 condition, thenExpression, elseExpression, const DynamicType())); | 1269 condition, thenExpression, elseExpression, const DynamicType())); |
| 1266 } | 1270 } |
| 1267 | 1271 |
| 1268 @override | 1272 @override |
| 1269 void endThrowExpression(Token throwToken, Token endToken) { | 1273 void endThrowExpression(Token throwToken, Token endToken) { |
| 1270 debugEvent("ThrowExpression"); | 1274 debugEvent("ThrowExpression"); |
| 1271 Expression expression = popForValue(); | 1275 Expression expression = popForValue(); |
| 1272 push(new Throw(expression)); | 1276 push(new Throw(expression)..fileOffset = throwToken.charOffset); |
| 1273 } | 1277 } |
| 1274 | 1278 |
| 1275 @override | 1279 @override |
| 1276 void endFormalParameter( | 1280 void endFormalParameter( |
| 1277 Token covariantKeyword, Token thisKeyword, FormalParameterType kind) { | 1281 Token covariantKeyword, Token thisKeyword, FormalParameterType kind) { |
| 1278 debugEvent("FormalParameter"); | 1282 debugEvent("FormalParameter"); |
| 1279 // TODO(ahe): Need beginToken here. | 1283 // TODO(ahe): Need beginToken here. |
| 1280 int charOffset = thisKeyword?.charOffset; | 1284 int charOffset = thisKeyword?.charOffset; |
| 1281 if (thisKeyword != null) { | 1285 if (thisKeyword != null) { |
| 1282 if (!inConstructor) { | 1286 if (!inConstructor) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1311 } | 1315 } |
| 1312 type = field.target.type ?? const DynamicType(); | 1316 type = field.target.type ?? const DynamicType(); |
| 1313 variable = new VariableDeclaration(name.name, | 1317 variable = new VariableDeclaration(name.name, |
| 1314 type: type, initializer: name.initializer); | 1318 type: type, initializer: name.initializer); |
| 1315 } else { | 1319 } else { |
| 1316 addCompileTimeError( | 1320 addCompileTimeError( |
| 1317 name.fileOffset, "'${name.name}' isn't a field in this class."); | 1321 name.fileOffset, "'${name.name}' isn't a field in this class."); |
| 1318 } | 1322 } |
| 1319 } | 1323 } |
| 1320 variable ??= new VariableDeclaration(name.name, | 1324 variable ??= new VariableDeclaration(name.name, |
| 1321 type: type ?? const DynamicType(), initializer: name.initializer); | 1325 type: type ?? const DynamicType(), |
| 1326 initializer: name.initializer)..fileOffset = name.fileOffset; |
| 1322 push(variable); | 1327 push(variable); |
| 1323 } | 1328 } |
| 1324 | 1329 |
| 1325 @override | 1330 @override |
| 1326 void endOptionalFormalParameters( | 1331 void endOptionalFormalParameters( |
| 1327 int count, Token beginToken, Token endToken) { | 1332 int count, Token beginToken, Token endToken) { |
| 1328 debugEvent("OptionalFormalParameters"); | 1333 debugEvent("OptionalFormalParameters"); |
| 1329 FormalParameterType kind = optional("{", beginToken) | 1334 FormalParameterType kind = optional("{", beginToken) |
| 1330 ? FormalParameterType.NAMED | 1335 ? FormalParameterType.NAMED |
| 1331 : FormalParameterType.POSITIONAL; | 1336 : FormalParameterType.POSITIONAL; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 if (optional("++", token)) return plusName; | 1497 if (optional("++", token)) return plusName; |
| 1493 if (optional("--", token)) return minusName; | 1498 if (optional("--", token)) return minusName; |
| 1494 return internalError("Unknown increment operator: ${token.value}"); | 1499 return internalError("Unknown increment operator: ${token.value}"); |
| 1495 } | 1500 } |
| 1496 | 1501 |
| 1497 @override | 1502 @override |
| 1498 void handleUnaryPrefixAssignmentExpression(Token token) { | 1503 void handleUnaryPrefixAssignmentExpression(Token token) { |
| 1499 debugEvent("UnaryPrefixAssignmentExpression"); | 1504 debugEvent("UnaryPrefixAssignmentExpression"); |
| 1500 var accessor = pop(); | 1505 var accessor = pop(); |
| 1501 if (accessor is BuilderAccessor) { | 1506 if (accessor is BuilderAccessor) { |
| 1502 push(accessor.buildPrefixIncrement(incrementOperator(token))); | 1507 push(accessor.buildPrefixIncrement( |
| 1508 incrementOperator(token), token.charOffset)); |
| 1503 } else { | 1509 } else { |
| 1504 push(wrapInvalid(toValue(accessor))); | 1510 push(wrapInvalid(toValue(accessor))); |
| 1505 } | 1511 } |
| 1506 } | 1512 } |
| 1507 | 1513 |
| 1508 @override | 1514 @override |
| 1509 void handleUnaryPostfixAssignmentExpression(Token token) { | 1515 void handleUnaryPostfixAssignmentExpression(Token token) { |
| 1510 debugEvent("UnaryPostfixAssignmentExpression"); | 1516 debugEvent("UnaryPostfixAssignmentExpression"); |
| 1511 var accessor = pop(); | 1517 var accessor = pop(); |
| 1512 if (accessor is BuilderAccessor) { | 1518 if (accessor is BuilderAccessor) { |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2096 } | 2102 } |
| 2097 if (target == null && name == null) { | 2103 if (target == null && name == null) { |
| 2098 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2104 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
| 2099 "No target of break.", breakKeyword.charOffset)); | 2105 "No target of break.", breakKeyword.charOffset)); |
| 2100 } else if (target == null || | 2106 } else if (target == null || |
| 2101 target is! JumpTarget || | 2107 target is! JumpTarget || |
| 2102 !target.isBreakTarget) { | 2108 !target.isBreakTarget) { |
| 2103 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2109 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
| 2104 "Can't break to '$name'.", breakKeyword.next.charOffset)); | 2110 "Can't break to '$name'.", breakKeyword.next.charOffset)); |
| 2105 } else { | 2111 } else { |
| 2106 BreakStatement statement = new BreakStatement(null); | 2112 BreakStatement statement = new BreakStatement(null) |
| 2113 ..fileOffset = breakKeyword.charOffset; |
| 2107 target.addBreak(statement); | 2114 target.addBreak(statement); |
| 2108 push(statement); | 2115 push(statement); |
| 2109 } | 2116 } |
| 2110 } | 2117 } |
| 2111 | 2118 |
| 2112 @override | 2119 @override |
| 2113 void handleContinueStatement( | 2120 void handleContinueStatement( |
| 2114 bool hasTarget, Token continueKeyword, Token endToken) { | 2121 bool hasTarget, Token continueKeyword, Token endToken) { |
| 2115 debugEvent("ContinueStatement"); | 2122 debugEvent("ContinueStatement"); |
| 2116 var target = continueTarget; | 2123 var target = continueTarget; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2141 return; | 2148 return; |
| 2142 } | 2149 } |
| 2143 } | 2150 } |
| 2144 if (target == null) { | 2151 if (target == null) { |
| 2145 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2152 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
| 2146 "No target of continue.", continueKeyword.charOffset)); | 2153 "No target of continue.", continueKeyword.charOffset)); |
| 2147 } else if (!target.isContinueTarget) { | 2154 } else if (!target.isContinueTarget) { |
| 2148 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( | 2155 push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement( |
| 2149 "Can't continue at '$name'.", continueKeyword.next.charOffset)); | 2156 "Can't continue at '$name'.", continueKeyword.next.charOffset)); |
| 2150 } else { | 2157 } else { |
| 2151 BreakStatement statement = new BreakStatement(null); | 2158 BreakStatement statement = new BreakStatement(null) |
| 2159 ..fileOffset = continueKeyword.charOffset; |
| 2152 target.addContinue(statement); | 2160 target.addContinue(statement); |
| 2153 push(statement); | 2161 push(statement); |
| 2154 } | 2162 } |
| 2155 } | 2163 } |
| 2156 | 2164 |
| 2157 @override | 2165 @override |
| 2158 void endTypeVariable(Token token, Token extendsOrSuper) { | 2166 void endTypeVariable(Token token, Token extendsOrSuper) { |
| 2159 logEvent("TypeVariable"); | 2167 logEvent("TypeVariable"); |
| 2160 // TODO(ahe): Implement this when enabling generic method syntax. | 2168 // TODO(ahe): Implement this when enabling generic method syntax. |
| 2161 } | 2169 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 | 2371 |
| 2364 Expression buildAssignment(Expression value, {bool voidContext: false}) { | 2372 Expression buildAssignment(Expression value, {bool voidContext: false}) { |
| 2365 return internalError("not supported"); | 2373 return internalError("not supported"); |
| 2366 } | 2374 } |
| 2367 | 2375 |
| 2368 Expression buildNullAwareAssignment(Expression value, DartType type, | 2376 Expression buildNullAwareAssignment(Expression value, DartType type, |
| 2369 {bool voidContext: false}) { | 2377 {bool voidContext: false}) { |
| 2370 return internalError("not supported"); | 2378 return internalError("not supported"); |
| 2371 } | 2379 } |
| 2372 | 2380 |
| 2373 Expression buildCompoundAssignment(Name binaryOperator, Expression value, | 2381 Expression buildCompoundAssignment( |
| 2382 Name binaryOperator, Expression value, int charOffset, |
| 2374 {bool voidContext: false, Procedure interfaceTarget}) { | 2383 {bool voidContext: false, Procedure interfaceTarget}) { |
| 2375 return internalError("not supported"); | 2384 return internalError("not supported"); |
| 2376 } | 2385 } |
| 2377 | 2386 |
| 2378 Expression buildPrefixIncrement(Name binaryOperator, | 2387 Expression buildPrefixIncrement(Name binaryOperator, int charOffset, |
| 2379 {bool voidContext: false, Procedure interfaceTarget}) { | 2388 {bool voidContext: false, Procedure interfaceTarget}) { |
| 2380 return internalError("not supported"); | 2389 return internalError("not supported"); |
| 2381 } | 2390 } |
| 2382 | 2391 |
| 2383 Expression buildPostfixIncrement(Name binaryOperator, | 2392 Expression buildPostfixIncrement(Name binaryOperator, int charOffset, |
| 2384 {bool voidContext: false, Procedure interfaceTarget}) { | 2393 {bool voidContext: false, Procedure interfaceTarget}) { |
| 2385 return internalError("not supported"); | 2394 return internalError("not supported"); |
| 2386 } | 2395 } |
| 2387 | 2396 |
| 2388 makeInvalidRead() => internalError("not supported"); | 2397 makeInvalidRead() => internalError("not supported"); |
| 2389 | 2398 |
| 2390 makeInvalidWrite(Expression value) => internalError("not supported"); | 2399 makeInvalidWrite(Expression value) => internalError("not supported"); |
| 2391 } | 2400 } |
| 2392 | 2401 |
| 2393 class DelayedAssignment extends ContextAccessor { | 2402 class DelayedAssignment extends ContextAccessor { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2404 } | 2413 } |
| 2405 | 2414 |
| 2406 Expression buildForEffect() { | 2415 Expression buildForEffect() { |
| 2407 return handleAssignment(true); | 2416 return handleAssignment(true); |
| 2408 } | 2417 } |
| 2409 | 2418 |
| 2410 Expression handleAssignment(bool voidContext) { | 2419 Expression handleAssignment(bool voidContext) { |
| 2411 if (identical("=", assignmentOperator)) { | 2420 if (identical("=", assignmentOperator)) { |
| 2412 return accessor.buildAssignment(value, voidContext: voidContext); | 2421 return accessor.buildAssignment(value, voidContext: voidContext); |
| 2413 } else if (identical("+=", assignmentOperator)) { | 2422 } else if (identical("+=", assignmentOperator)) { |
| 2414 return accessor.buildCompoundAssignment(plusName, value, | 2423 return accessor.buildCompoundAssignment(plusName, value, charOffset, |
| 2415 voidContext: voidContext); | 2424 voidContext: voidContext); |
| 2416 } else if (identical("-=", assignmentOperator)) { | 2425 } else if (identical("-=", assignmentOperator)) { |
| 2417 return accessor.buildCompoundAssignment(minusName, value, | 2426 return accessor.buildCompoundAssignment(minusName, value, charOffset, |
| 2418 voidContext: voidContext); | 2427 voidContext: voidContext); |
| 2419 } else if (identical("*=", assignmentOperator)) { | 2428 } else if (identical("*=", assignmentOperator)) { |
| 2420 return accessor.buildCompoundAssignment(multiplyName, value, | 2429 return accessor.buildCompoundAssignment(multiplyName, value, charOffset, |
| 2421 voidContext: voidContext); | 2430 voidContext: voidContext); |
| 2422 } else if (identical("%=", assignmentOperator)) { | 2431 } else if (identical("%=", assignmentOperator)) { |
| 2423 return accessor.buildCompoundAssignment(percentName, value, | 2432 return accessor.buildCompoundAssignment(percentName, value, charOffset, |
| 2424 voidContext: voidContext); | 2433 voidContext: voidContext); |
| 2425 } else if (identical("&=", assignmentOperator)) { | 2434 } else if (identical("&=", assignmentOperator)) { |
| 2426 return accessor.buildCompoundAssignment(ampersandName, value, | 2435 return accessor.buildCompoundAssignment(ampersandName, value, charOffset, |
| 2427 voidContext: voidContext); | 2436 voidContext: voidContext); |
| 2428 } else if (identical("/=", assignmentOperator)) { | 2437 } else if (identical("/=", assignmentOperator)) { |
| 2429 return accessor.buildCompoundAssignment(divisionName, value, | 2438 return accessor.buildCompoundAssignment(divisionName, value, charOffset, |
| 2430 voidContext: voidContext); | 2439 voidContext: voidContext); |
| 2431 } else if (identical("<<=", assignmentOperator)) { | 2440 } else if (identical("<<=", assignmentOperator)) { |
| 2432 return accessor.buildCompoundAssignment(leftShiftName, value, | 2441 return accessor.buildCompoundAssignment(leftShiftName, value, charOffset, |
| 2433 voidContext: voidContext); | 2442 voidContext: voidContext); |
| 2434 } else if (identical(">>=", assignmentOperator)) { | 2443 } else if (identical(">>=", assignmentOperator)) { |
| 2435 return accessor.buildCompoundAssignment(rightShiftName, value, | 2444 return accessor.buildCompoundAssignment(rightShiftName, value, charOffset, |
| 2436 voidContext: voidContext); | 2445 voidContext: voidContext); |
| 2437 } else if (identical("??=", assignmentOperator)) { | 2446 } else if (identical("??=", assignmentOperator)) { |
| 2438 return accessor.buildNullAwareAssignment(value, const DynamicType(), | 2447 return accessor.buildNullAwareAssignment(value, const DynamicType(), |
| 2439 voidContext: voidContext); | 2448 voidContext: voidContext); |
| 2440 } else if (identical("^=", assignmentOperator)) { | 2449 } else if (identical("^=", assignmentOperator)) { |
| 2441 return accessor.buildCompoundAssignment(caretName, value, | 2450 return accessor.buildCompoundAssignment(caretName, value, charOffset, |
| 2442 voidContext: voidContext); | 2451 voidContext: voidContext); |
| 2443 } else if (identical("|=", assignmentOperator)) { | 2452 } else if (identical("|=", assignmentOperator)) { |
| 2444 return accessor.buildCompoundAssignment(barName, value, | 2453 return accessor.buildCompoundAssignment(barName, value, charOffset, |
| 2445 voidContext: voidContext); | 2454 voidContext: voidContext); |
| 2446 } else if (identical("~/=", assignmentOperator)) { | 2455 } else if (identical("~/=", assignmentOperator)) { |
| 2447 return accessor.buildCompoundAssignment(mustacheName, value, | 2456 return accessor.buildCompoundAssignment(mustacheName, value, charOffset, |
| 2448 voidContext: voidContext); | 2457 voidContext: voidContext); |
| 2449 } else { | 2458 } else { |
| 2450 return internalError("Unhandled: $assignmentOperator"); | 2459 return internalError("Unhandled: $assignmentOperator"); |
| 2451 } | 2460 } |
| 2452 } | 2461 } |
| 2453 | 2462 |
| 2454 Initializer buildFieldInitializer( | 2463 Initializer buildFieldInitializer( |
| 2455 Map<String, FieldInitializer> initializers) { | 2464 Map<String, FieldInitializer> initializers) { |
| 2456 if (!identical("=", assignmentOperator) || | 2465 if (!identical("=", assignmentOperator) || |
| 2457 !accessor.isThisPropertyAccessor) { | 2466 !accessor.isThisPropertyAccessor) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2471 class DelayedPostfixIncrement extends ContextAccessor { | 2480 class DelayedPostfixIncrement extends ContextAccessor { |
| 2472 final Name binaryOperator; | 2481 final Name binaryOperator; |
| 2473 | 2482 |
| 2474 final Procedure interfaceTarget; | 2483 final Procedure interfaceTarget; |
| 2475 | 2484 |
| 2476 DelayedPostfixIncrement(BuilderHelper helper, int charOffset, | 2485 DelayedPostfixIncrement(BuilderHelper helper, int charOffset, |
| 2477 BuilderAccessor accessor, this.binaryOperator, this.interfaceTarget) | 2486 BuilderAccessor accessor, this.binaryOperator, this.interfaceTarget) |
| 2478 : super(helper, charOffset, accessor); | 2487 : super(helper, charOffset, accessor); |
| 2479 | 2488 |
| 2480 Expression buildSimpleRead() { | 2489 Expression buildSimpleRead() { |
| 2481 return accessor.buildPostfixIncrement(binaryOperator, | 2490 return accessor.buildPostfixIncrement(binaryOperator, charOffset, |
| 2482 voidContext: false, interfaceTarget: interfaceTarget); | 2491 voidContext: false, interfaceTarget: interfaceTarget); |
| 2483 } | 2492 } |
| 2484 | 2493 |
| 2485 Expression buildForEffect() { | 2494 Expression buildForEffect() { |
| 2486 return accessor.buildPostfixIncrement(binaryOperator, | 2495 return accessor.buildPostfixIncrement(binaryOperator, charOffset, |
| 2487 voidContext: true, interfaceTarget: interfaceTarget); | 2496 voidContext: true, interfaceTarget: interfaceTarget); |
| 2488 } | 2497 } |
| 2489 } | 2498 } |
| 2490 | 2499 |
| 2491 class JumpTarget extends Builder { | 2500 class JumpTarget extends Builder { |
| 2492 final List<Statement> users = <Statement>[]; | 2501 final List<Statement> users = <Statement>[]; |
| 2493 | 2502 |
| 2494 final JumpTargetKind kind; | 2503 final JumpTargetKind kind; |
| 2495 | 2504 |
| 2496 JumpTarget(this.kind, MemberBuilder member, int charOffset) | 2505 JumpTarget(this.kind, MemberBuilder member, int charOffset) |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2695 } else if (node is TypeDeclarationBuilder) { | 2704 } else if (node is TypeDeclarationBuilder) { |
| 2696 return node.name; | 2705 return node.name; |
| 2697 } else if (node is PrefixBuilder) { | 2706 } else if (node is PrefixBuilder) { |
| 2698 return node.name; | 2707 return node.name; |
| 2699 } else if (node is ThisPropertyAccessor) { | 2708 } else if (node is ThisPropertyAccessor) { |
| 2700 return node.name.name; | 2709 return node.name.name; |
| 2701 } else { | 2710 } else { |
| 2702 return internalError("Unhandled: ${node.runtimeType}"); | 2711 return internalError("Unhandled: ${node.runtimeType}"); |
| 2703 } | 2712 } |
| 2704 } | 2713 } |
| OLD | NEW |