diff --git a/lib/compiler/compiler.dart b/lib/compiler/compiler.dart index b7a780fe826..4038fad3606 100644 --- a/lib/compiler/compiler.dart +++ b/lib/compiler/compiler.dart @@ -46,7 +46,5 @@ Future compile(Uri script, options); compiler.run(script); String code = compiler.assembledCode; - Completer completer = new Completer(); - completer.complete(code); - return completer.future; + return new Future.immediate(code); } diff --git a/lib/compiler/implementation/dart2js.dart b/lib/compiler/implementation/dart2js.dart index 1593ca608a4..e463a62ec3b 100644 --- a/lib/compiler/implementation/dart2js.dart +++ b/lib/compiler/implementation/dart2js.dart @@ -164,9 +164,7 @@ void compile(List argv) { dartBytesRead += source.length; sourceFiles[uri.toString()] = new SourceFile(relativize(cwd, uri), source); - Completer completer = new Completer(); - completer.complete(source); - return completer.future; + return new Future.immediate(source); } void info(var message) { diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart index 44664d94087..6465ac096f6 100644 --- a/lib/compiler/implementation/ssa/codegen.dart +++ b/lib/compiler/implementation/ssa/codegen.dart @@ -468,9 +468,12 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { declaredVariables.add(variableName); buffer.add("var "); } - } else if (!isGeneratingDeclaration() - && !isVariableDeclared(variableName)) { - delayedVariablesDeclaration.add(variableName); + } else if (!isVariableDeclared(variableName)) { + if (!isGeneratingDeclaration()) { + delayedVariablesDeclaration.add(variableName); + } else { + declaredVariables.add(variableName); + } } } else if (!isVariableDeclared(variableName)) { declaredVariables.add(variableName);