Version 1.9.0-dev.10.13
svn merge -c 44570 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 44621 https://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/vm/scopes.cc trunk/dart/runtime/vm/scopes.cc
git-svn-id: http://dart.googlecode.com/svn/trunk@44630 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index c4c417b..15088ca 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -45,12 +45,12 @@
int64_t remaining = num_bytes;
const char* current_buffer = reinterpret_cast<const char*>(buffer);
while (remaining > 0) {
- int64_t bytes_read = Write(current_buffer, remaining);
- if (bytes_read < 0) {
+ int64_t bytes_written = Write(current_buffer, remaining);
+ if (bytes_written < 0) {
return false;
}
- remaining -= bytes_read; // Reduce the number of remaining bytes.
- current_buffer += bytes_read; // Move the buffer forward.
+ remaining -= bytes_written; // Reduce the number of remaining bytes.
+ current_buffer += bytes_written; // Move the buffer forward.
}
return true;
}
@@ -140,9 +140,9 @@
int64_t byte = 0;
if (DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 1), &byte)) {
uint8_t buffer = static_cast<uint8_t>(byte & 0xff);
- int64_t bytes_written = file->Write(reinterpret_cast<void*>(&buffer), 1);
- if (bytes_written >= 0) {
- Dart_SetReturnValue(args, Dart_NewInteger(bytes_written));
+ bool success = file->WriteFully(reinterpret_cast<void*>(&buffer), 1);
+ if (success) {
+ Dart_SetReturnValue(args, Dart_NewInteger(1));
} else {
Dart_Handle err = DartUtils::NewDartOSError();
if (Dart_IsError(err)) Dart_PropagateError(err);
@@ -266,16 +266,19 @@
ASSERT(end <= buffer_len);
ASSERT(buffer != NULL);
- // Write the data out into the file.
- int64_t bytes_written = file->Write(buffer, length);
+ // Write all the data out into the file.
+ bool success = file->WriteFully(buffer, length);
+
// Release the direct pointer acquired above.
result = Dart_TypedDataReleaseData(buffer_obj);
if (Dart_IsError(result)) Dart_PropagateError(result);
- if (bytes_written != length) {
+ if (!success) {
Dart_Handle err = DartUtils::NewDartOSError();
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
+ } else {
+ Dart_SetReturnValue(args, Dart_Null());
}
}
@@ -955,9 +958,9 @@
if (!file->IsClosed()) {
int64_t byte = CObjectInt32OrInt64ToInt64(request[1]);
uint8_t buffer = static_cast<uint8_t>(byte & 0xff);
- int64_t bytes_written = file->Write(reinterpret_cast<void*>(&buffer), 1);
- if (bytes_written > 0) {
- return new CObjectInt64(CObject::NewInt64(bytes_written));
+ bool success = file->WriteFully(reinterpret_cast<void*>(&buffer), 1);
+ if (success) {
+ return new CObjectInt64(CObject::NewInt64(1));
} else {
return CObject::NewOSError();
}
@@ -1092,13 +1095,13 @@
}
start = 0;
}
- int64_t bytes_written =
- file->Write(reinterpret_cast<void*>(buffer_start), length);
+ bool success =
+ file->WriteFully(reinterpret_cast<void*>(buffer_start), length);
if (!request[1]->IsTypedData()) {
delete[] buffer_start;
}
- if (bytes_written >= 0) {
- return new CObjectInt64(CObject::NewInt64(bytes_written));
+ if (success) {
+ return new CObjectInt64(CObject::NewInt64(length));
} else {
return CObject::NewOSError();
}
diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
index f25d71a..05a4654 100644
--- a/runtime/vm/scopes.cc
+++ b/runtime/vm/scopes.cc
@@ -282,12 +282,7 @@
void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars,
int16_t* scope_id) {
(*scope_id)++;
- if (HasContextLevel() &&
- ((parent() == NULL) ||
- (!parent()->HasContextLevel()) ||
- (parent()->context_level() != context_level()))) {
- // This is the outermost scope with a context level or this scope's
- // context level differs from its parent's level.
+ if (num_context_variables() > 0) {
VarDesc desc;
desc.name = &Symbols::Empty(); // No name.
desc.info.set_kind(RawLocalVarDescriptors::kContextLevel);
diff --git a/tools/VERSION b/tools/VERSION
index 7b1f6aa..1000622 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 9
PATCH 0
PRERELEASE 10
-PRERELEASE_PATCH 12
+PRERELEASE_PATCH 13