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

Unified Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10914286: Remove Object.dynamic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review smells. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/lib/interceptors.dart ('k') | lib/core/object.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/builder.dart
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
index f2fb383022adee59b8c2cbc3c464138a450a2c95..9baeb6c6ddfbdb3ce9db6e3800a32d700b716432 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -2398,24 +2398,33 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
// If the invoke is on foreign code, don't visit the first
// argument, which is the type, and the second argument,
// which is the foreign code.
- if (link.isEmpty() || link.isEmpty()) {
+ if (link.isEmpty() || link.tail.isEmpty()) {
compiler.cancel('At least two arguments expected',
node: node.argumentsNode);
}
- link = link.tail.tail;
List<HInstruction> inputs = <HInstruction>[];
- addGenericSendArgumentsToList(link, inputs);
- Node type = node.arguments.head;
- Node literal = node.arguments.tail.head;
- if (literal is !StringNode || literal.dynamic.isInterpolation) {
- compiler.cancel('JS code must be a string literal', node: literal);
- }
+ Node type = link.head;
+ Node code = link.tail.head;
+ addGenericSendArgumentsToList(link.tail.tail, inputs);
+
if (type is !LiteralString) {
- compiler.cancel(
- 'The type of a JS expression must be a string literal', node: type);
+ // The type must not be a juxtaposition or interpolation.
+ compiler.cancel('The type of a JS expression must be a string literal',
+ node: type);
+ }
+ LiteralString typeString = type;
+
+ if (code is StringNode) {
+ StringNode codeString = code;
+ if (!codeString.isInterpolation) {
+ // codeString may not be an interpolation, but may be a juxtaposition.
+ push(new HForeign(codeString.dartString,
+ typeString.dartString,
+ inputs));
+ return;
+ }
}
- push(new HForeign(
- literal.dynamic.dartString, type.dynamic.dartString, inputs));
+ compiler.cancel('JS code must be a string literal', node: literal);
}
void handleForeignUnintercepted(Send node) {
« no previous file with comments | « lib/compiler/implementation/lib/interceptors.dart ('k') | lib/core/object.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698