Bug 444409: outparams.js was trying to analyze 'this' as an outparam for strings, r=bsmedberg

This commit is contained in:
David Mandelin 2008-07-09 18:24:57 -07:00
Родитель 2c04f20658
Коммит 2a3bef1678
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -455,7 +455,7 @@ OutparamCheck.prototype.processCall = function(dest, expr, blame, state) {
// considered no-fail. // considered no-fail.
state.update(function(ss) { state.update(function(ss) {
for each (let [vbl, sem] in updates) { for each (let [vbl, sem] in updates) {
if (sem == ps.OUTNOFAIL) { if (sem == ps.OUTNOFAIL || sem == ps.OUTNOFAILNOCHECK) {
ss.assignValue(vbl, av.WRITTEN, blame); ss.assignValue(vbl, av.WRITTEN, blame);
return [ss]; return [ss];
} else { } else {
@ -644,6 +644,10 @@ OutparamCheck.prototype.logResult = function(rv, msg, kind) {
// checked by this analysis // checked by this analysis
let ps = { let ps = {
OUTNOFAIL: { label: 'out-no-fail', val: av.WRITTEN, check: true }, OUTNOFAIL: { label: 'out-no-fail', val: av.WRITTEN, check: true },
// Special value for receiver of strings methods. Callers should
// consider this to be an outparam (i.e., it modifies the string),
// but we don't want to check the method itself.
OUTNOFAILNOCHECK: { label: 'out-no-fail-no-check' },
OUT: { label: 'out', val: av.WRITTEN, check: true }, OUT: { label: 'out', val: av.WRITTEN, check: true },
INOUT: { label: 'inout', val: av.WRITTEN, check: true }, INOUT: { label: 'inout', val: av.WRITTEN, check: true },
MAYBE: { label: 'maybe', val: av.MAYBE_WRITTEN}, // maybe out MAYBE: { label: 'maybe', val: av.MAYBE_WRITTEN}, // maybe out
@ -680,7 +684,8 @@ OutparamCheck.prototype.func_param_semantics = function(callable) {
let sem; let sem;
if (i == 0 && string_mutator) { if (i == 0 && string_mutator) {
// Special case: string mutator receiver is an no-fail outparams // Special case: string mutator receiver is an no-fail outparams
sem = ps.OUTNOFAIL; // but not checkable
sem = ps.OUTNOFAILNOCHECK;
} else { } else {
if (params) sem = decode_attr(DECL_ATTRIBUTES(params[i])); if (params) sem = decode_attr(DECL_ATTRIBUTES(params[i]));
if (TRACE_CALL_SEM >= 2) print("param " + i + ": annotated " + sem); if (TRACE_CALL_SEM >= 2) print("param " + i + ": annotated " + sem);