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

Side by Side Diff: src/typing.cc

Issue 307453005: Fix check for empty type (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "typing.h" 5 #include "typing.h"
6 6
7 #include "frames.h" 7 #include "frames.h"
8 #include "frames-inl.h" 8 #include "frames-inl.h"
9 #include "parser.h" // for CompileTimeValue; TODO(rossberg): should move 9 #include "parser.h" // for CompileTimeValue; TODO(rossberg): should move
10 #include "scopes.h" 10 #include "scopes.h"
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // is no 'positive Smi' type for the lower bound, we use the smallest 668 // is no 'positive Smi' type for the lower bound, we use the smallest
669 // union of Smi and Unsigned32 as upper bound instead. 669 // union of Smi and Unsigned32 as upper bound instead.
670 NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone()))); 670 NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
671 break; 671 break;
672 case Token::ADD: { 672 case Token::ADD: {
673 RECURSE(Visit(expr->left())); 673 RECURSE(Visit(expr->left()));
674 RECURSE(Visit(expr->right())); 674 RECURSE(Visit(expr->right()));
675 Bounds l = expr->left()->bounds(); 675 Bounds l = expr->left()->bounds();
676 Bounds r = expr->right()->bounds(); 676 Bounds r = expr->right()->bounds();
677 Type* lower = 677 Type* lower =
678 l.lower->Is(Type::None()) || r.lower->Is(Type::None()) ? 678 !l.lower->IsInhabited() || !r.lower->IsInhabited() ?
679 Type::None(zone()) : 679 Type::None(zone()) :
680 l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ? 680 l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ?
681 Type::String(zone()) : 681 Type::String(zone()) :
682 l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ? 682 l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ?
683 Type::SignedSmall(zone()) : Type::None(zone()); 683 Type::SignedSmall(zone()) : Type::None(zone());
684 Type* upper = 684 Type* upper =
685 l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ? 685 l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ?
686 Type::String(zone()) : 686 Type::String(zone()) :
687 l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ? 687 l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ?
688 Type::Number(zone()) : Type::NumberOrString(zone()); 688 Type::Number(zone()) : Type::NumberOrString(zone());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 void AstTyper::VisitModuleUrl(ModuleUrl* module) { 773 void AstTyper::VisitModuleUrl(ModuleUrl* module) {
774 } 774 }
775 775
776 776
777 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { 777 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) {
778 RECURSE(Visit(stmt->body())); 778 RECURSE(Visit(stmt->body()));
779 } 779 }
780 780
781 781
782 } } // namespace v8::internal 782 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698