Bug 778347: fix some MSVC warnings, r=luke
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -47,17 +47,17 @@ class GCConstList {
Vector<Value> list;
public:
GCConstList(JSContext *cx) : list(cx) {}
bool append(Value v) { JS_ASSERT_IF(v.isString(), v.toString()->isAtom()); return list.append(v); }
size_t length() const { return list.length(); }
void finish(ConstArray *array);
};
-class StmtInfoBCE;
+struct StmtInfoBCE;
struct BytecodeEmitter
{
typedef StmtInfoBCE StmtInfo;
SharedContext *const sc; /* context shared between parsing and bytecode generation */
BytecodeEmitter *const parent; /* enclosing function or global context */
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -103,17 +103,17 @@ PushStatementTC(TreeContext *tc, StmtInf
PushStatement(tc, stmt, type);
stmt->isFunctionBodyBlock = false;
}
Parser::Parser(JSContext *cx, const CompileOptions &options,
const jschar *chars, size_t length, bool foldConstants)
: AutoGCRooter(cx, PARSER),
context(cx),
- strictModeGetter(this),
+ strictModeGetter(thisForCtor()),
tokenStream(cx, options, chars, length, &strictModeGetter),
tempPoolMark(NULL),
allocator(cx),
traceListHead(NULL),
tc(NULL),
keepAtoms(cx->runtime),
foldConstants(foldConstants),
compileAndGo(options.compileAndGo)
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -102,16 +102,18 @@ struct Parser : private AutoGCRooter
inline bool reportError(ParseNode *pn, unsigned errorNumber, ...);
inline bool reportUcError(ParseNode *pn, unsigned errorNumber, ...);
inline bool reportWarning(ParseNode *pn, unsigned errorNumber, ...);
inline bool reportStrictWarning(ParseNode *pn, unsigned errorNumber, ...);
inline bool reportStrictModeError(ParseNode *pn, unsigned errorNumber, ...);
typedef bool (Parser::*Reporter)(ParseNode *pn, unsigned errorNumber, ...);
private:
+ Parser *thisForCtor() { return this; }
+
ParseNode *allocParseNode(size_t size) {
JS_ASSERT(size == sizeof(ParseNode));
return static_cast<ParseNode *>(allocator.allocNode());
}
/*
* Create a parse node with the given kind and op using the current token's
* atom.
--- a/js/src/frontend/SemanticAnalysis.h
+++ b/js/src/frontend/SemanticAnalysis.h
@@ -9,17 +9,17 @@
#define SemanticAnalysis_h__
namespace js {
class StackFrame;
namespace frontend {
-class Parser;
+struct Parser;
/*
* For each function in the compilation unit given by sc and functionList,
* decide whether the function is a full closure or a null closure and set
* JSFunction flags accordingly.
*/
bool
AnalyzeFunctions(Parser *parser, StackFrame *callerFrame);
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -2608,17 +2608,17 @@ class BytecodeRangeWithLineNumbers : pri
{
public:
using BytecodeRange::empty;
using BytecodeRange::frontPC;
using BytecodeRange::frontOpcode;
using BytecodeRange::frontOffset;
BytecodeRangeWithLineNumbers(JSContext *cx, JSScript *script)
- : BytecodeRange(script), lineno(script->lineno), sn(script->notes()), snpc(script->code), skip(cx, this)
+ : BytecodeRange(script), lineno(script->lineno), sn(script->notes()), snpc(script->code), skip(cx, thisForCtor())
{
if (!SN_IS_TERMINATOR(sn))
snpc += SN_DELTA(sn);
updateLine();
while (frontPC() != script->main())
popFront();
}
@@ -2626,16 +2626,18 @@ class BytecodeRangeWithLineNumbers : pri
BytecodeRange::popFront();
if (!empty())
updateLine();
}
size_t frontLineNumber() const { return lineno; }
private:
+ BytecodeRangeWithLineNumbers *thisForCtor() { return this; }
+
void updateLine() {
/*
* Determine the current line number by reading all source notes up to
* and including the current offset.
*/
while (!SN_IS_TERMINATOR(sn) && snpc <= frontPC()) {
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
if (type == SRC_SETLINE)